Presentation is loading. Please wait.

Presentation is loading. Please wait.

Blackjack Programming Project

Similar presentations


Presentation on theme: "Blackjack Programming Project"— Presentation transcript:

1 Blackjack Programming Project
Computer Science WS2010 FH Aachen

2 Computer Science WS2010 FH Aachen
Group No. 3 Team A: Aniket Bapat Kamel Ajami Team B: Rojas Eduardo Ngo Quang Ha Team C: Thomas Bücker Vahid Ahsani Team D: Tonatiuh Saldaña Laura Paulina Cabello Computer Science WS2010 FH Aachen

3 Computer Science WS2010 FH Aachen
Overview 1. Used Components and Tools 2. First Concept by using «Use Case Diagram» 3. Main Program Functions 4. Flow Charts of Game Activities 5. Function Description 6. Doxygen Slides 7. User Manual Computer Science WS2010 FH Aachen

4 Computer Science WS2010 FH Aachen
1. USED COMPONENTS AND TOOLS Computer Science WS2010 FH Aachen

5 ACUAS Easy Programming Code Doxygen
Used Components and Tools Atmega 16 µController 4 Row LCD Display Joystick AVR Studio C-Code ACUAS Easy Programming Code Doxygen

6 Computer Science WS2010 FH Aachen
2. USE CASE DIAGRAM Computer Science WS2010 FH Aachen

7 Use Case Diagram

8 Computer Science WS2010 FH Aachen
3. MAIN PROGRAM PARTS Computer Science WS2010 FH Aachen

9 The program is organized into modules
Main Program Parts The program is organized into modules BlackJack Main Result Display Dealer`s Hand Shuffle Player`s Hand

10 Computer Science WS2010 FH Aachen
4. FLOW CHARTS OF THE GAME ACTIVITIES Computer Science WS2010 FH Aachen

11 Main Activity Diagram

12 Start New Game Activity Diagram

13 Player`s Hand Activity Diagram

14 Dealer`s Hand Activity Diagram

15 Get Card Activity Diagram

16 Finnish Match Activity Diagram

17 Computer Science WS2010 FH Aachen
5. FUNCTION DESCRIPTION Computer Science WS2010 FH Aachen

18 Function Description System Main Function
The main function will carry out the execution of the project files. The different functions will be integrated in conformity with the BlackJack Game rules. The main function: 1. Initializing and starting new game. 2. Fetching and displaying the PlayerHand, the cards that the player has, their values and suits and their sum. 3. Fetching the displaying the DealerHand, the cards that the dealer has, their values and suits and their sum. 4. Comparing each the Player and the Dealer cards and displaying the winner followed by the overall score.

19 Function Description Shuffle Function
It performs the shuffling process for the card deck. The shuffling process is displayed during which the following takes place: 1. An array of numbers p=[1,2,3,...51,52] is generated. 2. Mixing the cards r times (r=Randomize()+16) using ACUAS instruction RANDOM(0,51) at least 16 times. 3. A control subroutine checks whether already dealt cards are not generated again. 4. A progress bar is displayed to simulate the shuffling progress.

20 Function Description Player Hand Function
It processes, executes and displays the Player's play. The PlayerHand function carries out the following: - resets the Player points as long as loop=True - passes the Player a card - stores the dealt cards in Player's hand array - calculates the Player's hand points - displays the Player's play and result - checks if the Player busts - checks the number of cards condition - checks the BlackJack condition - stays in the loop if the Player wants another card Hit=1 or exits if the Player stands - increases the game array by 1 to accommodate for one more card in case of Hit=1

21 Function Description Take Card Function
This function is executed when Player or Dealer needs to take a new card. The TakeCard() function represents the dealing process. It proceeds as following: 1. The pack is shuffled. 2. A card is dealt and deducted from the cards' deck. 3. After taking a card, we put the card on the table. It will be stored in g[i]: the array of cards on the table.

22 Ask Hit or Stand Function
Function Description Ask Hit or Stand Function It asks for the Player`s decision to Hit or Stand through the Joystick and passes the information to the Function PlayerHand. This functions waits for the Player's decision: - ON_JOYSTICK_DOWN -> Hit=1; Player wants another card. - ON_JOYSTICK_UP -> Stand=1; Player turn is finished. Dealer's turn is started.

23 CountPlayerPoints Function
Function Description CountPlayerPoints Function It calculates the points of the Player's hand. This function will calculate how much in points the Player's hand is. It does that by the following steps: 1. Each card in the pack has been indexed. The card index is represented by the variable uint8_t CardID. 2. From the card index the integer value Number=((CardID-1)/4)+1 is calculated from which the CardValue is deduced. 3. PlayerPoints is calculated Pp+=CardValueAccording to the value of Pp, the ace value is determined. PAce11=0 => Ace equals 1 PAce11=1 => Ace equals 11

24 Function Description DealerHand Function
It processes, executes and displays the Dealer's play It takes Player BlackJack flag as input and does the following: resets the Dealer points as long as Dp<17: - passes the Dealer a card - stores the dealt cards in Dealer's hand array - calculates the Dealer's hand points - displays the Dealer's play and result - checks the BlackJack condition - checks the number of cards condition - increases the game array by 1 to accommodate for one more card.

25 CountDealerPoints Function
Function Description CountDealerPoints Function It calculates the points of the Delaer's hand. This function will calculate how much points the Dealer has. It does that by the following steps: - Each card in the pack has been indexed. The card index is represented by the variable uint8_t CardID. - From the card index the integer value Number=((CardID-1)/4)+1 is calculated from which the CardValue is deduced. - DealerPoints is calculated Dp+=CardValue According to the value of Dp, the ace value is determined. DAce11=0 => Ace equals 1 DAce11=1 => Ace equals 11

26 CardsDisplay Function
Function Description CardsDisplay Function It displays the hand's cards,their value, suit and sum. This function is called by both DealerHand() and PlayHand() function to display their cards on the LCD. It starts by displaying the current actor, Player or Dealer, then it displays the hand's cards, their value, suit and sum.

27 FinnishMatch Function
Function Description FinnishMatch Function It displays the winner and the score and prompts a screen asking the Player for a Rematch! and after every game the Player and Dealer cards are thrown on the table and set aside.

28 Computer Science WS2010 FH Aachen
6. DOXYGEN SLIDES Computer Science WS2010 FH Aachen

29 Computer Science WS2010 FH Aachen
7. USER MANUAL Computer Science WS2010 FH Aachen

30 Computer Science WS2010 FH Aachen
AND NOW, LET`S PLAY!!! Computer Science WS2010 FH Aachen


Download ppt "Blackjack Programming Project"

Similar presentations


Ads by Google