ECE2049: Foundations of Embedded Systems Lab Exercise #1 C Term 2018 Implementing a Black Jack game

Similar documents
ECE2049: Embedded Systems in Engineering Design Lab Exercise #4 C Term 2018

CS 210 Fundamentals of Programming I Spring 2015 Programming Assignment 8

CS 210 Fundamentals of Programming I Fall 2015 Programming Project 8

For this assignment, your job is to create a program that plays (a simplified version of) blackjack. Name your program blackjack.py.

CMPT 125/128 with Dr. Fraser. Assignment 3

CS Project 1 Fall 2017

Activity 6: Playing Elevens

COMP 9 Lab 3: Blackjack revisited

Cashback Blackjack TO PLAY THE GAME. The objective of the game is to get closer to 21 than the dealer without going over.

Begin this assignment by first creating a new Java Project called Assignment 5.There is only one part to this assignment.

Players try to obtain a hand whose total value is greater than that of the house, without going over 21.

LET S PLAY PONTOON. Pontoon also offers many unique payouts as well as a Super Bonus of up to $5000 on certain hands.

Lab Exercise #10. Assignment Overview

Live Casino game rules. 1. Live Baccarat. 2. Live Blackjack. 3. Casino Hold'em. 4. Generic Rulette. 5. Three card Poker

Programming Assignment 4

NUMB3RS Activity: A Bit of Basic Blackjack. Episode: Double Down

CS107L Handout 06 Autumn 2007 November 2, 2007 CS107L Assignment: Blackjack

Programming Exam. 10% of course grade

Lab 1. CS 5233 Fall 2007 assigned August 22, 2007 Tom Bylander, Instructor due midnight, Sept. 26, 2007

Make better decisions. Learn the rules of the game before you play.

A. Rules of blackjack, representations, and playing blackjack

CSCI 4150 Introduction to Artificial Intelligence, Fall 2004 Assignment 7 (135 points), out Monday November 22, due Thursday December 9

HOW TO PLAY BLACKJACK

Project 2 - Blackjack Due 7/1/12 by Midnight

To play the game player has to place a bet on the ANTE bet (initial bet). Optionally player can also place a BONUS bet.

After receiving his initial two cards, the player has four standard options: he can "Hit," "Stand," "Double Down," or "Split a pair.

No Flop No Table Limit. Number of

CSE231 Spring Updated 04/09/2019 Project 10: Basra - A Fishing Card Game

Buster Blackjack. BGC ID: GEGA (October 2011)

Welcome to the Best of Poker Help File.

Computer Science 25: Introduction to C Programming

Programming Languages and Techniques Homework 3

A Rule-Based Learning Poker Player

PROBLEM SET 2 Due: Friday, September 28. Reading: CLRS Chapter 5 & Appendix C; CLR Sections 6.1, 6.2, 6.3, & 6.6;

ECE 497 Introduction to Mobile Robotics Spring 09-10

CPSC 217 Assignment 3 Due Date: Friday March 30, 2018 at 11:59pm

CHAPTER 649a. THREE CARD POKER

BLACKJACK Perhaps the most popular casino table game is Blackjack.

Blackjack Terms. Lucky Ladies: Lucky Ladies Side Bet

CS1301 Individual Homework 5 Olympics Due Monday March 7 th, 2016 before 11:55pm Out of 100 Points

MP212 Principles of Audio Technology II

CS Programming Project 1

Gamelogs: Blogging About Gameplay Definitions of Games and Play Magic Circle

A UNIQUE COMBINATION OF CHANCE & SKILL.

CARIBBEAN. The Rules

Ante or ante wager means the initial wager required to be made prior to any cards being dealt in order to participate in the round of play.

Maryland State Lottery and Gaming Control Agency Standard Rules Criss Cross Poker

Bridge Players: 4 Type: Trick-Taking Card rank: A K Q J Suit rank: NT (No Trumps) > (Spades) > (Hearts) > (Diamonds) > (Clubs)

Congratulations - Welcome to the easiest way to make money online!

Pro Xenon Mediathek Ltd. Game Description Lucky Dragon

Ch. 653a ULTIMATE TEXAS HOLD EM POKER a.1. CHAPTER 653a. ULTIMATE TEXAS HOLD EM POKER

CSEP 573 Applications of Artificial Intelligence Winter 2011 Assignment 3 Due: Wednesday February 16, 6:30PM

HIGH CARD FLUSH 1. Definitions

CSE 231 Fall 2012 Programming Project 8

HOW to PLAY TABLE GAMES

CATFISH BEND CASINOS RULES OF THE GAME THREE CARD POKER

TABLE OF CONTENTS TEXAS HOLD EM... 1 OMAHA... 2 PINEAPPLE HOLD EM... 2 BETTING...2 SEVEN CARD STUD... 3

FOUR CARD POKER. Hand-- means the best four card poker hand that can be formed by each player and the dealer from the cards they are dealt.

Maryland State Lottery and Gaming Control Agency Standard Rules - Double Draw Poker

Assignment 1. Due: 2:00pm, Monday 14th November 2016 This assignment counts for 25% of your final grade.

In 2004 the author published a paper on a

2. A separate designated betting area at each betting position for the placement of the ante wager;

CATFISH BEND CASINOS, L.C. RULES OF THE GAME FORTUNE PAI GOW

The game of poker. Gambling and probability. Poker probability: royal flush. Poker probability: four of a kind

HEADS UP HOLD EM. "Cover card" - means a yellow or green plastic card used during the cut process and then to conceal the bottom card of the deck.

Ch. 670a SIX-CARD FORTUNE PAI GOW POKER a.1. CHAPTER 670a. SIX-CARD FORTUNE PAI GOW POKER

La Gran Aventura. La Gran Aventura. Reels - 5 Wins are counted from left to right. Main Screen

CHAPTER 641a. FOUR CARD POKER

Electronic Wireless Texas Hold em. Owner s Manual and Game Instructions #64260

Blazing 7 s Blackjack Progressive

Homework #3: Trimodal Matching

CHAPTER 678a. HIGH CARD FLUSH. 678a.2. High Card Flush table physical characteristics.

CIDM 2315 Final Project: Hunt the Wumpus

GAMBLING ( ) Name: Partners: everyone else in the class

Embedded Systems Lab

Programmable Control Introduction

Kajot Casino Ltd. Game Description Joker Area

Dungeon Crawler Card Game

LET IT RIDE POKER. Stub-- means the remaining portion of the deck after all cards in the round of play have been dealt or delivered.

Ultimate Texas Hold em features head-to-head play against the player/dealer and optional bonus bets.

CSE 260 Digital Computers: Organization and Logical Design. Lab 4. Jon Turner Due 3/27/2012

Beeches Holiday Lets Games Manual

DELIVERABLES. This assignment is worth 50 points and is due on the crashwhite.polytechnic.org server at 23:59:59 on the date given in class.

1) = 10) 4-15 = 2) (-4)(-3) = 11) = 4) -9 6 = 13) = 5) = 14) (-3)(15) = = 15) 7) = 16) -7 (-18) =

Assignment III: Graphical Set

TABLE GAMES RULES OF THE GAME

Mathematical Analysis Player s Choice Poker

TEXAS HOLD EM BONUS POKER

Taffy Tangle. cpsc 231 assignment #5. Due Dates

Important Distributions 7/17/2006

Bonus Side Bets Analysis

User Guide / Rules (v1.6)

Assignment 6 Play A Game: Minesweeper or Battleship!!! Due: Sunday, December 3rd, :59pm

CHAPTER 659a. FORTUNE ASIA POKER

Introductory Module Object Oriented Programming. Assignment Dr M. Spann

Table Games Rules. MargaritavilleBossierCity.com FIN CITY GAMBLING PROBLEM? CALL

Problem Set 4: Video Poker

Programming Project 2

Blazing 7s Blackjack Progressive

THE LEVEL PLAYING FIELD ROULETTE SYSTEM

Transcription:

ECE2049: Foundations of Embedded Systems Lab Exercise #1 C Term 2018 Implementing a Black Jack game Card games were some of the very first applications implemented for personal computers. Even today, most operating systems still ship with some selection of card games (e.g. Solitaire or Free Cell) built in. There are literally thousands of card game apps for cell phones and any number of website (both gambling and non-gambling) where one can play cards against a CPU or against other players. In this lab you will implement a Blackjack, or 21-game, where the player plays against the MSP430. Assignment: Starting with the I/O functions from the demo project, implement a single player Blackjack game. MANDATORY PRE-LAB Assignmen t: READ THE ENTIRE LAB ASSIGNMENT! Using the main() function of the demo project from Lab 0 as a guide write the MAIN LOOP of your Blackjack game. You do not have to implement all the function or compile the loop. However, each student MUST show the TA (and sign-off) a draft of your Blackjack main loop at the beginning of your lab session. The idea is to actually THINK about the HOW to tackle the problem BEFORE you get to lab! It is recommended that you implement your game as a state machine. There are specific tasks or states that your code will move through within the main loop like Display the Welcome message, Shuffle and Deal, Check Player Input, etc. You can assign these states numbers (or define an enumerated type) and use a switch case construct to implement your game inside a while (1) loop something like switch (state) { case 0: // Display welcome screen.... break; case 1: // Shuffle & Deal.... break; case 2:.... break; etc... // Check Player Input This is just a notional example you will need to determine what states your game requires and what actions take place while in each state.

Note: The labs for ECE2049 are not tutorial in nature. Rather, you will apply what you have learned in lecture to expand your code base (i.e. the demo project) to complete miniprojects. How you complete this week's project is up to you but you need to meet ALL the requirements listed below. You do not have to complete the steps in the order given. System Requirements: 1) When the game is not being played the LCD should display MSP430 Blackjack and Press * to start. The game should revert to this welcome screen after a game has finished. 2) A new game starts whenever the '*' key is pressed. The game should then prompt the user to Cut the deck by entering a number between 0 and 15 on the keypad. You will use the number input to generate the seed for the random number generator which you will use to shuffle and deal the cards. There is a random number generator function rand() in the C Standard Library (include <stdlib.h>) which returns pseudorandom integers within a certain range. There is also the srand() function which sets the seed for the random number generator. Changing the seed changes the sequence of random numbers generated. See CCS Help (or your C reference) for details on these functions. The value of the Cut input should be displayed on the LCD screen and the 4 LEDs should display its corresponding hex code 0 to F. How you set the random number generator seed using the value input is up to you. You may simply use the value as the seed or you can manipulate it any number of ways to produce the seed. 3) After the Cut the CPU should shuffle the deck and deal two cards to the player and to itself. The game should be played using a single, standard deck of 52 cards. Be sure that each card can only be dealt once per game. Explain how you achieved this in your report. Both player cards should be displayed on the LCD screen but only one of the CPU's cards should be face up. How will you store the cards dealt and remove them from your deck? Explain in your report. The player should never see the CPU's hole card until the end of the game. Below is how the screen might look after a deal where the Player has a Jack of Diamonds and a 3 of Spades while the CPU's face card is 8 of Hearts PLAYER 1: CPU: J-D 3-S 8-H xxx 4) The player then enters a bet, either 1, 2, 4, or 8, on the keypad and the corresponding LED should light. The LEDs serve as the player's different colored poker chips! The CPU then displays its bet. You should also write the bets to the LCD. Note: there must be fixed rules for how much the CPU bets based on it's hand. The player then either meets the computer's bet (by entering the difference of their bet and the computer's on the keypad) or folds by entering the '*'.

5) After the bets are placed, the player can request another card by hitting the 1 key and holds (i.e. stays with the cards dealt) by pressing the # key. New cards should appear with the players other cards. If the player goes bust (i.e. over 21) they lose and the game is over. If the player holds with < 21, the CPU can then choose to receive an additional card(s) or not. As in any casino or computer game there should be a rule that the the CPU always holds at a certain value, like 17. Remember that number cards are worth their face value (2 thru 10) and face cards are all worth 10. An ace can be counted either as 1 or as 11 depending on what results in the best hand. 6) When the CPU either holds or goes bust (over 21) the CPU displays all it's cards and then indicates who won and how much they won. You should implement proper celebration if the player wins and proper humiliation if the player loses using all your I/O resources (e.g. leds, buzzer, LCD screen). Be creative! 7) BONUS: The buzzer buzzes because a pulse width modulated (PWM) signal is applied to it. Modify the buzzeron() function to play a different pitch for each LED. Explain fully in your report how you achieved this. 8) Any modifications of functions or new functions you write should use the port register names defined in msp430f5529.h. No magic numbers! 9) Write a high quality lab report. Your report should include a flow chart of your game (or several flowcharts if that shows functionality better). All flow charts should be computer generated. 10) Remember to submit your code on-line. *****Remember to make your project names meaningful and unique. Use revision numbers to preserve hard-won functionality before going on to next step! Save your work to your R drive directory not on the local lab machine! SAVE OFTEN! SAVE MORE OFTEN! NOW IS A GOOD TIME TO SAVE! IMPORTANT REMINDERS!! 1) YOU and you LAB PARTNER are responsible for the lab board that was signed out to you. You are required to return the lab board with all its components in working order at the end of the term. You will not receive a grade until you lab board is returned. 2) IF your board is not functional at the end of term, you will receive a grade penalty. See the syllabus or class web page for more information. 3) Please properly STORE THE BOARD IN ITS PROTECTIVE BOX when not in use. Also, please don't destroy the box! 4) DO NOT PLACE THE BOARD ON A METAL SURFACE (like the computer case!) WHILE PLUGGED IN UNLESS IT HAS RUBBER FEET. It will short the board.

Writing a High Quality Lab Report: Your lab should be written in a professional style. It should be an electronically prepared technical document like what you would submit to a co-worker or your boss. The report should include Introduction = 1-3 paragraphs (1/2 page tops) succinctly stating the objectives of the lab and giving an overview of what you accomplished. Discussion and Results = As many pages as it takes (without padding!). In this section you should thoroughly discuss what you did in each part of the lab. You should describe the approach you took to solving any problems. Include pseudo code descriptions and/or flow charts for any code you developed. Include listing of the functions themselves. Results should also be thoroughly discussed. Any measurements should be tabulated and figures should not be hand drawn. ANY questions asked in the assignment should be answered completely (in complete sentences) such that the grader can find the answers!! Snippets of code may be included in the report where useful but a code listing should not be attached as you will be submitting your code on-line. Summary and Conclusion = 1-3 paragraphs. Wrap-up and summarize what you accomplished in the lab. This should be a bookend to the introduction. Appendices = PRE-LAB assignments with a signature of a TA on the paper from BOTH students should be included. Also include any relevant raw data sheets. Do not include code listing. Code is to be submitted on-line. The original copy of the lab sign-off sheet must be attached to you report!

To submit your code for grading, you will need to create a zip file of your CCS project so that the TAs can build it. You can also use this method to create a complete backup copy of your project (perhaps to archive or send to your partner) for later. To do this: 1. Right click on your project and select "Rename..." 2. If you are submitting your project, enter a name in the following format: ece2049c18_lab1_username1_username2, where username1 and username2 are the user names of you and your partner. (NOTE: Failure to follow this step will result in points deducted from your lab grade!) 3. Click OK and wait for CCS to rename your project. 4. Right click on your project again and select "Export..." then select General and "Archive file" from the list and click Next. 5. In the next window, you should see the project you want to export selected in the left pane and all of the files in your project selected in the right pane. Select all. You should not need to change which files are selected. 6. Click the "Browse" button, find a location to save the archive (like your R drive) and type in a file name using the EXACT SAME NAME used in Step (2). 7. Click "Finish". CCS should now create a zip file in the directory you specified. 8. Go to the Assignments page on the class Canvas website. Click Lab 1 Code Submission. Attach the archive file of your project that you just created and hit the Submit button. Only one code submission per team.

ECE2049-C-2018 Lab 1 Sign-off Sheet Early (Bonus) Sign-off: Friday 1/26/18 Report due: Tuesday 1/30/18 Student 1: ECE mailbox: Student 2: ECE mailbox: Board #: Task Max points Max points PRE-LAB Complete at start of lab (students graded individually) TA MUST SIGN PRE-LAB PAPERS!!! BOTH PRE-LABS MUST BE ATTACHED 10 TO REPORT Display Welcome Screen 5 Game Start/ Restart (on *) 5 Cut & Shuffle 52 unique cards with no duplicates. Implementing random seed 10 Deal and display player's and CPU's cards 10 Take Bets 10 Deal additional cards 10 Proper player celebration/humiliation for winning or losing 5 BONUS: Have buzzer play different pitch for each LED (+5) Answer to TA Questions (5 pts per student, graded individually) 5 Report Total points (with bonuses) 30 100 105 TA s assessment Student 1 Student 2 Student 1 Student 2 5% Early Bonus: ** Both Students MUST be present at Sign-off for any and all parts!!

ECE2049 Lab 1 Report Grading Rubric Format -- 5 pts Did you follow instructions given above as to the format of your report? Is you code formatted, properly commented, etc.? What is expected for the following parts was already described above. Introduction 3 pts Discussion 15 pts Conclusion 3 pts Appendices 1 pt Professionalism 3 pts Spelling, grammar, neatness, presentation, etc.