Comp 200 Lab 1

Submitted by: Submitted by

Views: 205

Words: 2213

Pages: 9

Category: Science and Technology

Date Submitted: 12/04/2013 05:49 PM

Report This Essay

COMP 220 iLab 1

Specification:

This program is designed to implement a game of blackjack. The game starts with a dealer and number of players that are input by the user no more than 4. In the beginning, all players and the dealer are dealt with two cards each. Then number of dealer draws is determined by a random number from 0 to 3. The game continues until any of the player scores equal to 21 or all go above 21 or maximum of 5 draws have been made.

Test Plan: 

The game should continue to run as long as all players are under 21 and they have more draws remaining. The dealer should not be dealt card more than the random number picked for dealer draws. If any player goes on hold he should not be asked for any draw. My program worked fine with all these conditions.

I tested my program with different inputs and it worked fine in all cases. Here is a table showing some test cases that I applied

Test Scenario | Predicted Output | Actual Output |

Run the game and play when number of dealer draws = 0 | Total dealer draws should be 2 and then max of 5 for all other players | Same as predicted. |

Play the game with 1 player and a dealer and hold the player on the third draw. | The player 1 should not draw any card after the second draw. | Same as predicted. |

Play a game and then play another game in the same console window. | The new game should be fully loaded with fresh card deck. | Same as predicted. |

Hold all the players in the third draw | The game should not ask any player for draw the card then | Same as predicted. |

Summary and Conclusions: 

This program helped me understand how to play with multi-dimensional array. I had to declare and use 3D arrays and play with them. The end condition took some time to get working correctly, but the biggest problem was getting the cards to display correctly, I am still unsure what was wrong as I scraped my original attempt.

Source code:

// Programmer: Daniel A Godding

// Course: COMP220

//...