Computer Assisted Yahtzee
Game Download
Here you can download the Yahtzee game. It has been zipped using WinRAR, which if you don't have it can be downloaded here. To load the game, run the "Computer Assisted Yahtzee.exe" file.Download Game
Brief
The briefing I was given for the project was as follows:Yahtzee is a simple dice-based game that can be played by two or more players and involves a number of rounds of play. To begin a player rolls five dice and after this first roll he may choose to `lock` any number of dice on the numbers just rolled, with the aim of achieving a higher scoring combination on the next roll. The player then proceeds to re-roll the remaining dice and subsequently he may choose to further `lock` any of the new numbers rolled. This process is repeated up to a maximum of three rolls. The player then chooses a category to assign his score to, such as `3 of a kind` (three dice with the same number), `small straight` (four dice with consecutive numbers), `full house` (3 of a kind and 2 of a kind), and so on. Each category can only be assigned once, and the skill of the game is in choosing which category to use. Play then passes to the next player and after all categories have been assigned the player with the highest score wins. The aim of this project is to write a program, in any suitable programming language (such as Java, C++, etc.), that will allow a human player to play the game through interacting with the program. The program should provide the user with hints as to what the most sensible moves will be after each given roll of the dice.
Project Progression
After writing up the Specification and Design documentation (links below), I made a start on the program development. I chose C++ as the development language for several reasons. I wanted the challenge of picking up a new language for the project, and C++ is a language that I had been interested in learning due to the fact that it is widely used. The University didn't offer any means of learning C++ so the only way to pick it up was by learning it myself. This project gave me the opportunity to do that.The first part was easy. Within a couple of months I had a finished version of the Yahtzee game that could be played without computer assistance. I programmed it progressively, starting with making a menu and, during the project, adding functionality to it. Next I added the dice objects, making them able to roll and then added the scorecard. Throughout each stage of development I made sure that all of the features already added were working as they should and interacted with each other as was intended to make a fully functional, interactive game.
The other half of the program was more difficult. This was where I had to add computer assistance to the game, by adding hints generated by the computer depending on what roll the player made and which categories had been chosen already during the game. For this I decided to use heuristics rather than using probabilities of rolling certain combinations as the program would have been far too large and complex and the lag between rolls would have been too much. With a logical approach it was easier to work in steps. For example, examining which combinations have been chosen already limits the number of considerations to make for the current roll.
I thoroughly enjoyed working on this project and the challenge it presented me. From it I have picked up a new language and feel more confident in my skills as a programmer and the work I can produce.
