adicionar gestão de erros à função 'devolveCor()'
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
import sys
|
||||
import random
|
||||
from typing import type_check_only
|
||||
import pygame as pg
|
||||
from modules.agente import Agente
|
||||
from modules.mapa import Mapa
|
||||
@ -9,19 +10,20 @@ flags = 0
|
||||
|
||||
|
||||
def devolveCor(agente: Agente | None) -> tuple[int, int, int, int]:
|
||||
match agente.estrategia:
|
||||
case "Neutro":
|
||||
return (255, 255, 255, 0)
|
||||
case "Tit4Tat":
|
||||
return (255, 255, 0, 0)
|
||||
case "Vingativo":
|
||||
return (255, 0, 0, 0)
|
||||
case "Lunatico":
|
||||
return (0, 0, 255, 0)
|
||||
case None:
|
||||
return (0, 0, 0, 0)
|
||||
case _:
|
||||
return (0, 0, 0, 0)
|
||||
if type(agente) is None:
|
||||
return (0, 0, 0, 0)
|
||||
else:
|
||||
match agente.estrategia:
|
||||
case "Neutro":
|
||||
return (255, 255, 255, 0)
|
||||
case "Tit4Tat":
|
||||
return (255, 255, 0, 0)
|
||||
case "Vingativo":
|
||||
return (255, 0, 0, 0)
|
||||
case "Lunatico":
|
||||
return (0, 0, 255, 0)
|
||||
case _:
|
||||
return (0, 0, 0, 0)
|
||||
|
||||
|
||||
def criarTabuleiro(
|
||||
|
||||
Reference in New Issue
Block a user