Saturday, April 17, 2010

Card Simulation: Continued

Here is a code update for the day. I have to spend the rest of my day doing homework, so I don't know what progress will be made throughout the weekend. I may work on this more tomorrow.

Here is a link to the current build's source code.

As you can see, I have an Ai working to play against me. I currently don't have anything to have a player win the game, so there should be an exception thrown during one of the Ai's methods or during the makeMove method when either player has no cards in their hand.

The Ai works by creating a list of cards available to play, then randomly choosing one to play. If none of the cards in the Ai's are playable then it will draw a card from the deck. This reminds me, if the deck empties then there should be a thrown exception as well, as I haven't coded switching the stack with the deck when the deck is empty.

Since I created an Ai class, I should be able to instantiate multiple Ai instances with ease to allow for multiple Ai players to be playing simultaneously.

Once I work on this some more, I plan to handle the mentioned exceptions that should be thrown, as well as begin working on creating some unique cards. For now I like the "make next player skip their turn" and "wild card". The wild card would allow the player to switch the current suit to any suit desired.

Here is a .exe in case you wanted to play the game ^^

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.