Urgenthomework logo
UrgentHomeWork
Live chat

Loading..

Card Game Simulation

Overview:

In this project you will create a program (script) that simulates a one player card game. The program will run the game completely without user input. The program should display each card in the command window and explain what is done with the card. Note: You do not need to use any images or figures for this project. The output should be text only. Your code must also include at least one user defined function that has both input and output arguments.

Background:

A standard deck consists of 52 cards. There are four suits, in the order shown below: Clubs (C), Spades (S), Hearts (H), and Diamonds (D). Each suit contains 13 cards: Ace, 2-10, Jack, Queen, King. There are many types of games that can be played alone with a deck of cards. You need to simulate one of these games. Details about different single player cards games and how they are played are available here: https://bicyclecards.com/rules/?results=show#filter=.1 Different games have very different game play, it is up to you to decide which game you want to implement. All games will be graded equally based on how accurately your program simulates the game, using the rules on the above website. You must use the games found at the website above. House rules and other games will receive a zero.

If you are completely unfamiliar with card game, there are several videos available on YouTube.

Standard Deck of Cards:

Card Game Simulation Image 1

Program Structure:

You will be provided with a.mat file that contains several variables that represent a deck of cards. It is up to you which of the variables you use based on the game you choose. However, you MUST use the provided variables, you cannot use other sources for the cards.

You should use a random number generator to simulate the result of shuffling the deck. The results from the random number generator should be 1-52 (without repeating) and can be used to index the matrix or cell arrays to get the card values. (Hint: MATLAB has a specific random number function for generating a random set of numbers without repetitions.) For instance, if the first three numbers that you generate are 3, 15, 34, the corresponding cards are Ace of Hearts, Four of Hearts, Nine of Diamonds.

Depending on the game you may shuffle multiple times. In some instances, you will have cards that have already been used, and thus would not be in the new shuffle, you will need to ensure that you don’t reuse cards inappropriately. Continue to shuffle and work through the game.

This process should continue until the game is successfully completed. When developing your code, it might work better to start with small goals before trying to let the simulation run for an entire game.

Project Deliverables:

  1. All code in a zip file.
  2. Instructions for running code (PDF): This document should assume that you have given the reader your code on a flash drive and explain all steps required to get from there to running the code.
  3. Example output (PDF): This should be the entirety of the output created for one game simulation (i.e. one time running the code).
  4. Brief Report (PDF): In narrative form answer the following questions:
    1. What was most challenging about completing this project?
    2. What did you learn while working on this project?
    3. Where did you go for help with this project?
    4. Would you recommend using this project again?
Copyright © 2009-2023 UrgentHomework.com, All right reserved.