The Settlers of Catan is a board game for 3 to 4 players that combines strategic thinking, resource management, and trading skills. The objective of the game is to be the first to accumulate 10 victory points. You can find the full game rules here. This project implements a simplified version of the game for 3 players.
The game board consists of 19 hexagonal tiles, each representing different types of land:
- Forest: Produces lumber.
- Hills: Produces bricks.
- Pasture: Produces wool.
- Fields: Produces grain.
- Mountains: Produces ore.
- Desert: Produces no resources.
Each tile is assigned a number from 2 to 12. When a player rolls the dice, any tile matching the rolled number produces resources for adjacent settlements and cities.
Each player starts with:
- 2 settlements (worth 1 victory point each)
- 2 roads
- Initial resources based on the placement of their starting settlements.
Resources are used to build roads, settlements, cities, and to buy development cards. The resources include:
- Lumber
- Brick
- Wool
- Grain
- Ore
Players can use resources to:
- Build Roads: Cost 1 brick and 1 lumber.
- Build Settlements: Cost 1 brick, 1 lumber, 1 wool, and 1 grain. Settlements must be placed on intersections connected by a road and at least two edges away from other settlements.
- Upgrade Settlements to Cities: Cost 3 ore and 2 grain. Cities produce double resources and are worth 2 victory points.
- Buy Development Cards: Cost 1 ore, 1 wool, and 1 grain. Development cards can provide bonuses such as additional victory points, knights for the largest army, and special actions.
- Initial Placement: Players take turns placing their initial settlements and roads.
- Turn Sequence:
- Roll two dice to produce resources.
- Trade resources with other players.
- Build roads, settlements, cities, or buy development cards.
- End of Turn: The next player takes their turn.
- Special Rolls: Rolling a 7 activates the robber, which blocks resource production for the tile it is placed on and forces players with more than 7 cards to discard half.
- Winning the Game: The first player to reach 10 victory points wins.
- Catan: Manages the overall game flow, including turn management and determining the winner.
- Board: Represents the game board, including tiles, intersections, and roads.
- Player: Represents a player, managing their resources, settlements, roads, and development cards.
- Dot: Represents intersections on the board where settlements and cities can be built.
- Road: Represents roads that players can build between intersections.
- Tile: Represents a tile on the game board, holding resource and token information.
The main function demonstrates the setup and a sample round of gameplay:
- Initializes players and the game board.
- Sets up the game window using SFML for graphical representation.
- Demonstrates placing settlements, roads, rolling dice, and trading resources.
- Prints player points and determines the winner.
- SFML: Used for rendering the game board and UI elements.
A Makefile is provided to compile and run the project. The make catan command compiles the main game and runs a demonstration of a single round of gameplay.
make catan
./catan
./make cleanUnit tests are provided to ensure the correct functionality of the game logic. Tests cover:
- Resource allocation
- Validity of building placements
- Turn management
- Development card purchases
- Victory point calculations
- Ensure the SFML library is installed on your system for graphical output.
- The project includes
Combined_Map.pngfor the game board andarial.ttffor font rendering.
For any queries, you can reach out to:
Name: Gidi Rabi
Email: gidirabi111@gmail.com
Location: Petah Tikva, Israel