Thomas M. Bolstad's 291 project:
For my Phys291 project, I made a laddergame (or «ladder and chutes» as it is also called). It is a text only game, and it is coded in pure C++.
Rules of the game:
The game is for 1-4 players. And is a board game.
All players have a piece on the board, and they all start at the same place
The target, is to get all the way to the last zone of the board.
The first one to get to the end, wins the game. And number two is second etc.
To move your piece, you have to roll a dice, and move the piece to the zone with the number equal to the one you were on when rolled the dice plus the number on the dice. For example, if you are on zone 20 and roll a 5 you move your piece to zone 25.
If the zone you end up on after rolling the dice, is the beginning of a ladder that goes up, or one that goes down, you have to move your piece to the end of that ladder. For example if you are on zone 10 and roll a 5 and end up on zone 15, and on zone 15 there is an upward ladder which ends at zone 30, you will move your piece to zone 30, and will move from there the next turn.
How to play:
Playing the game through the program I made, consists of 3 phases:
1: Initial stage. Here you select amount of players (all human) before you start.
2: Playing stage. Here you play the game turn by turn. You have 4 different choices.
You can roll the dice, you can get an overview where the ladders are, you can get a summary of where each player is at, and you can quit the game.
3: Final stage. When every player has reached the goal, you get a summary of which player came in which place, as well as some basic statistics. And the program prompts you one final time for input before quitting the program to give the user enough time to view the statistics proerly before quitting.
The program consists of four files. One program file, one method file for classes, one header file for classes and a levelfile providing the program with an overview of how the board looks and what the special zones are.
There are two main classes in use by the program. A Player class and a Board class.
The Player class contains and manipulates data on a player, and provides updates to the players status. It gets manipulated every time a user rolls, and it provides data when asked for positions of the different players.
The Board class gets initialized by reading the levelfile and creating data that is needed throughout the game. It has a few methods which returns relevant data to the program to know what happends at which zone.
There are four files, three of which will need to be compiled, and one file which will need to be in the same folder as the program running, since the program reads the file
This source was compiled on a Linux Ubuntu system using g++, and compiled without problems and worked as intended.
Level file (click save target as):