David's Webpage


Welcome to my Colors page! To contact me, email dc (my last name) AT gmail DOT com. Colors is my Windows implementation of the game Coloretto. The rules, source code, and Win32 executable are below. I am currently working on some AI for computer players and making a windowed version with actual colored cards. I'll post that when I get done; I don't like posting code that's not at least somewhat polished.

Source Code and Executable

I like playing around with different design patterns and keeping my code modular in case I feel like upgrading or changing some aspect of it, so I stuck to a mostly Model/View/Controller design. This should make it easy for you to change the UI or game rules if you wish.


Colors is a card collecting game for 2-5 players. There are 76 colored cards in the deck. There are 7 colors: (R)ed, (G)reen, (B)lue, (Y)ellow, (P)ink, (S)ilver, (V)iolet with 9 cards of each color in the deck. There are also 3 wilds and 8 cards worth +2 points. The goal is to have the highest score at the end by collecting as many as you can of any three colors, but beware, any other colored cards you collect count negatively. Wilds can count as any color and you do not have to specify the color until the end of the game.

The game is played in rounds. Cards are drawn one at a time from a face down deck and played in rows on the board by the players. Each round a player may take *one* row into his score pile; after he or she does this, they are completely out of the round. After every player has taken a row, the next round begins and everyone gets to play again. Thus there are as many rows as players in each round. Player proceeds clockwise from whichever player is chosen to go first in the first round. In subsequent rounds, the player to the left of the last player to take a row goes first. On a player's turn, he may either 1)Draw the top card of the deck AND place it on any one of the non-full rows on the board (rows may only hold up to 3 cards) OR 2)Take one nonempty row from the board into his score pile (and he is then out for the rest of the round). It is then the next player's turn. Play continues in this way until the round is over. By now, every player has taken a row, so the board is clear and the next round starts immediately.

Clearly, when playing cards, a player should take into account the colors each of the other players appear to be collecting. He or she does not want to build a row that is ideal for another player. The cards players collect in their score piles are public and must be visible at all times. A player does not have to declare what colors they are collecting until the end of the game and thus may change their mind at any time. Cards can NEVER be removed from a score pile, however, so take rows with caution. Wilds are very valuable as they can be added to any color's stack in your score pile at the end of the game. The +2 points cards are simply added to your score at the end of the game. The game is over when the last round is over. You know you are on the last round when there are no longer enough cards to guarantee that another round can be completed after the current one (i.e. there are not at least 3 * numberOfPlayers cards left in the deck. The game will announce when the current round is definitely the last round.

Scoring!: After the end of the last round, each player declares which three colors he or she would like scored positively, without fail these are the colors with the most cards. Each of these three *colors* is scored according to the chart below. Notice that it is not linear; specialization is good. Now, the other four colors for each player are also scored according to the chart but negatively! Wilds are added to the positive scoring color of your choice before you score it. Note that you get no bonus for having more than 6 of any one color. Each +2 points card simply adds two points to your score at the end. Now, the player with the highest score wins!

Scoring Table

# of cards Score
1 1
2 3
3 6
4 10
5 15
6-9 21

Change the css style for this page! You can also do this at the View - Page Style menu in Firefox. I think I prefer the elegant version myself.

Valid HTML 4.01 Strict

Valid CSS!