This project is a C++ implementation of the classic dice game Farkle.
It was originally developed for a previous course and will be further enhanced as part of my CS 499 Capstone Project.
This project demonstrates my understanding of object-oriented programming, algorithm design, and structured code organization in C++.
Farkle is a turn-based dice game where players roll six dice and earn points for specific combinations, such as triples or certain numbers.
The goal is to reach a target score before your opponent, but if you "Farkle" (roll no scoring dice), you lose all points for that turn.
This version of the game runs in the console and allows players to:
- Roll dice and view the results
- Choose which dice to keep for scoring
- Track scores between players
- View the official game rules from a text file (
farkle_rules.txt)
- Object-Oriented Design: Organized using
Game,Player, andDiceclasses. - Algorithmic Scoring: Calculates points according to Farkle rules.
- File Handling: Reads game rules from an external text file.
- User Input: Lets players select which dice to keep or reroll.
- Modular Codebase: Source code is split into multiple files for clarity and maintainability.
For my upcoming capstone work, I plan to build on this project by:
- Expanding the scoring logic to include new combinations (such as straights and three pairs).
- Improving input checks so the program can handle mistakes or invalid entries more smoothly.
- Making the code easier to read and update by cleaning up how the scoring logic is written
- Adding more helpful comments and documentation to explain how each part of the program works.
These updates will make the program more user-friendly, reliable, and easier to maintain.
FarkleGame/
βββ FarkleGame/
β βββ Dice.cpp # Handles dice rolls and random values
β βββ Dice.h
β βββ Player.cpp # Stores player data and total scores
β βββ Player.h
β βββ Game.cpp # Main game logic and scoring calculations
β βββ Game.h
β βββ rules_reader.cpp # Loads rules from a text file
β βββ rules_reader.h
β βββ farkle_rules.txt # Reference file with Farkle rules
β βββ FarkleGame.vcxproj # Visual Studio project file
β βββ FarkleGame.vcxproj.filters
β βββ FarkleGame.vcxproj.user
β βββ main.cpp # Entry point of the program
βββ FarkleGame.sln # Visual Studio solution file
βββ .gitignore
βββ README.md
- Open in Visual Studio:
- Double-click
FarkleGame.slnto open the solution.
- Double-click
- Build the project:
- Select Build β Build Solution (or press
Ctrl+Shift+B).
- Select Build β Build Solution (or press
- Run the game:
- Press
Ctrl+F5to start without debugging.
- Press
- Follow the on-screen prompts to play!
Alex Leet
Computer Science Student & Developer
π« GitHub: AlexLeetDev