i need hell creating a black jack game in C. this will be used withe MSP430 to execute the game. If i could have help creatkng the main loop in estableshing the different part and functions that would be great. im looking for a general outline with code that would be useful to the set parameters. dont worry about the MSP430 if not familiar, i can implement that later. thank you
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
) which returns pseudo-random integers within a certain range. There is also the sand 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 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 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: J-D 3-S CPU: 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 het. You should also write the bets to the LCD. Note: there must be fixed rules for how much the CPU bets based on its 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 cand by hitting the key and "holds" (i.c.stays with the cards dealt) by pressing the key. New cards should appear with the players other cards. If the player goes bustie. 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 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 10 resources (eg, leds, buzzer, LCD screen). Be creative! // Don't remove any #include statements, void main(void) { WDCTL = WDTPW | WDTHOLD; // Stop watchdog timer // Useful code starts here initLeds (); configDisplay ( ) ; configkeypad(); // Your setup code goes here! // (Initialize variables, configure things, etc.) while (1) { // Your code goes here