Canasta - 0.2
The card game Canasta
Peter Frase
(pefrase)
A computer implementation of the game of Canasta. Can be played in single-player mode, or by multiple players over the Internet. Requires Twisted in addition to python+pygame, but the Windows executable should work out of the box without any additional installs.
I'm a novice at Python, and this is my first attempt at writing a game with it. Canasta is mostly awesome, to me, because of its social aspects, so this program focuses heavily on the multiplayer element. You can start a game and have other players connect to you over the internet, as long as you have an accessible IP address and an open port. A chat window is provided throughout the game for players to communicate with each other.
A one-player game is available as well, although the computer opponents are still in a fairly rudimentary state.
If you don't know how to play Canasta, a Google search will turn up some good explanations. When you start the game, you can hit F1 to see a brief explanation of the controls. There is also a manual included in the form of a text file.
Changes
Version 0.2, now twice as good as 0.1!
Bug fixes:
-Passing with no cards left in the draw pile caused the server to hang
-Getting all four red threes would show up as 8 red threes on the end-round scoreboard
-"freeze on initial discard" option did not work
-Resizing the window on the main menu/assignment screens left black bars (resizing now disabled prior to game start).
-Crashed on ctrl-t (obsolete key binding)
Gameplay changes:
-Turn another card if the first turned is a wild or red three
-Concealed going out is enabled
-Many new gameplay options added for using alternate rules
-Made the interface for staging and melding more complete and consistent.
-Computer now guesses your intended target if you stage a wild card.
-cleaned up obsolete key bindings.
-Cards are now animated when they change locations. The animations can be turned off or made faster/slower through the options menu.
Under the hood:
-Streamlined the melding routine so that staging and melding share the same logic.
-Vastly simplified the melding logic and threw out some horrible code from the very beginning of the project.
-Streamlined the CanastaObjects file and the client and server to eliminate unecessary transport objects.
-Deprecated the special control code for melding wild cards, now using meld/stage command with a special token instead.
-Added more docstrings
Notes:
-Due to changes in the engine and the network protocol, versions 0.1 and 0.2 are incompatible--you cannot play on an 0.2 server with an 0.1 client, or vice-versa. From version 0.2 onwards, the server will check the client's version and reject incompatible clients. For now, versions must match exactly. Once the game is out of the testing stage, compatibility will be maintained between servers and clients sharing the same major version number.