APS105 Lab 2

Objective

The objective of this lab is to give you practice writing C programs that use conditionals and loops.

Bogart

For this lab, you will implement the dice game Bogart.

Game Description

Note: The only difference between our version and the version described on the above Bogart page is that we will restrict the game to two players. (We also do not consider the Gambling Variant.) Below is my description of the game.

The game makes use of a pot of chips, initially with zero chips. It also makes use of regular dice with six sides. We begin by randomly choosing player 1 or player 2 to start the game. That initial player continues until their turn is over, at which point it is the other player's turn; when that player's turn is over, we return to the initial player again, and so on. The following happens on the current player's turn:

C Implementation

You will write a C implementation of this game in file bogart.c. Begin by printing a welcome message and randomly choosing which player (1 or 2) will have the first turn. Then, for each player's turn:

Sample Transcripts

Here is a sample transcript of a complete game. You should use this not only for another explication of the game, but also as the source for the strings you should use in your printf statements. You should use exactly the same prompts and output messages as are used in the transcript. Do not add any other prompts, and do not ask for any other input.

Here is another sample transcript. In this one, the game is won by successfully rolling five dice without getting any 1's.

Implementation Tips

Several aspects of this program require some "tricks" not discussed in class.

Submitting your Lab

When you have completed the lab, use the command submitaps105s 2 bogart.c to submit your file. Make sure you name your file exactly as stated (including lower/upper case letters). You may check the status of your submission using the command submitaps105s -l 2, where -l is a hyphen followed by the letter 'ell'.