![]() The task is to find the winner of the game if A starts first and both play optimally.ģ and 6 are the elements that A can remove.Ī can remove 3 in his first move then B will have to remove 5. The player who can’t remove any element loses the game. ![]() Given an array arr of integers, two players A and B are playing a game where A can remove any number of non-zero elements from the array that are multiples of 3. FixedĪs for the CPU, right now I just wanted it to work instead of focus on winning, I'll look into creating a smarter AI which won't make simple mistakes or random choices and use the winning strategy if it goes first.ĮDIT: Here are the project steps from pbd.com. ![]() There are also bugs with validation methods where the error message won't be printed in case a player plays vs CPU, but I'll look into fixing that a bit later. Suggestions are welcome as well.Īs you might have noticed, there are some lines of code within Pile class that may look unused (like the 'name' field), this was due to the fact that column display looks messy when user types in their own custom pile name. I've been doing a lot of exercises on lately and have just finished the Nim game project, and before I jump to the Blackjack one, I'd like some feedback on my code and design of the game to see if I'm doing something wrong or if there is a better solution. ![]() Archived Anyone able to review my code for a Nim game? ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |