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