0
I would like to use a constant I created in an Enum as an attribute of another, for example:
from enum import Enum
class Jokenpo(Enum):
PEDRA = ('Rock', [Jokenpo.PAPEL], [Jokenpo.TESOURA])
PAPEL = ('Paper', [Jokenpo.TESOURA], [Jokenpo.PEDRA])
TESOURA = ('Scissors', [Jokenpo.PEDRA], [Jokenpo.PAPEL])
def __init__(self, nome, fraco, forte):
self.nome = nome
self.fraco = fraco
self.forte = forte
In a game of stone-paper-scissors, to specify which stone loses to paper but wins scissors I can do something similar to that. Probably mine In one has some errors, I’m beginner, but it has how to use a constant within another?
Sounds like the problem XY. I analyze that you want to implement the logic of the game instead of actually having this doubt about enums.
– Mário Feroldi