Board index Programs with AI or Rules Enforcement Magic: The Gathering - Duels of the Planeswalkers Programming Talk
How to code heads or tails?
Moderator: CCGHQ Admins
How to code heads or tails?
by Rockenchick » 05 Nov 2015, 01:40
How would one code a coin flip result for whether it's heads or tails, rather than win or lose? I looked a bit and it seems either the tail and heads themselves are assigned the number 0 or 1 or extra code would need to added to do so. So, if the game already considers each to be assigned a value of 0 or 1 then the result could be defined as that number without adding extra conditions (thereby replacing WIN or LOSE with said number), or am I totally off on this?
How would one code it so that all players flipped a coin at the same time, rather than just 1 player or less than all the players? I've seen different ways of determining that each player does something simultaneously but not in regards to flipping a coin.
I'm looking at making Goblin Assassin and those parts just really confused me.
How would one code it so that all players flipped a coin at the same time, rather than just 1 player or less than all the players? I've seen different ways of determining that each player does something simultaneously but not in regards to flipping a coin.
I'm looking at making Goblin Assassin and those parts just really confused me.
Last edited by Rockenchick on 05 Nov 2015, 02:02, edited 1 time in total.
- Rockenchick
- Posts: 21
- Joined: 16 Oct 2015, 05:05
- Has thanked: 4 times
- Been thanked: 2 times
Re: How to code heads or tails?
by Xander9009 » 05 Nov 2015, 01:59
"Lose" and "tails" are the same thing. When a coin is flipped, the result is a 0 or a 1 like you said. There happen to be two handy constants for comparing the results: COIN_FLIP_LOSE and COIN_FLIP_WIN. But that's all they are, constants, variables, just like any other variable you could name and set. Heads is 1 and tails is 0, COIN_FLIP_WIN is 1 and COIN_FLIP_LOSE is 0. So, tails and COIN_FLIP_LOSE are the same thing.
_______________________________
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
-
Xander9009 - Programmer
- Posts: 2905
- Joined: 29 Jun 2013, 07:44
- Location: Indiana, United States
- Has thanked: 121 times
- Been thanked: 445 times
2 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 7 guests