anyone know how to do this without resorting to the ugliness that is a bunch of if statements?
i need to compare 4 ints. 3 in 1 situation, and 4 in the second situation.
maybe i should explain the prompt a little better....
this is a game of the cardgame War... i'm writing the computer's AI as opposed to randomly drawing a card from his 3 hand deck.
if he goes first, then he picks highest card. (what if the 2 top cards are equal?)
if he goes second, he picks the lowest card that is still higher than the opponent's played card. (what if the opponent's played card is equal to his? another if statement..)
if he has no cards that can beat his opponent, then he picks his lowest card (again, what if the 2 bottom cards are equal?)
i have little under 6 hours to finish this... i have it working with all other prompt inputs working than this. i have it working if the computer draws a random card...
what i really need is an idea on how to write member functions "lowestOfThree" and "highestOfThree"
as for the advanced AI part, i suppose a really crappy solution would be to stick em into an array of type card with size of 4, and then organize em lowest to highest, then output the one just above the player-played card. if none are above it, then output the bottom card.... that takes care of the "lowestOfThree" idea, but doesnt take care of the "highestofthree" idea.... i still need to figure out how to play that...
i need to compare 4 ints. 3 in 1 situation, and 4 in the second situation.
maybe i should explain the prompt a little better....
this is a game of the cardgame War... i'm writing the computer's AI as opposed to randomly drawing a card from his 3 hand deck.
if he goes first, then he picks highest card. (what if the 2 top cards are equal?)
if he goes second, he picks the lowest card that is still higher than the opponent's played card. (what if the opponent's played card is equal to his? another if statement..)
if he has no cards that can beat his opponent, then he picks his lowest card (again, what if the 2 bottom cards are equal?)
i have little under 6 hours to finish this... i have it working with all other prompt inputs working than this. i have it working if the computer draws a random card...
what i really need is an idea on how to write member functions "lowestOfThree" and "highestOfThree"
as for the advanced AI part, i suppose a really crappy solution would be to stick em into an array of type card with size of 4, and then organize em lowest to highest, then output the one just above the player-played card. if none are above it, then output the bottom card.... that takes care of the "lowestOfThree" idea, but doesnt take care of the "highestofthree" idea.... i still need to figure out how to play that...