nebsille / cgstack

MIT License
0 stars 0 forks source link

Define YAML format for cards #4

Open jcoonen opened 11 years ago

jcoonen commented 11 years ago

e.g.:

card category: suit enum values: [clubs, heart, diamond spades] optional: no countable: number values: 1-13

jcoonen commented 11 years ago

Throwing out ideas: use Ruby's eval() method to specify dependent properties? e.g., add to the above:

derived category: color value: black if @suit in [clubs, spades]; else red; derived category: facecard value: true if @number > 10; else false;

Classic intuition is this is unsafe -- it would be trivial to put something in that conditional that crashes the system. But ultimately I think this project has so much "user input" involved that trying to prevent these things would be fruitless.