-- -- This module is submitted as part of the assessment for -- COMP1100. -- Its completion is substanitally my own work. -- (signed) Joseph Curtis 3952239 -- 1. The routine value in class card gives you the value of a single card. cards | value -------+------- H 9 | 9 S Q | 10 C10 | 10 H A | 11 D 7 | 7 D K | 10 2. The routine value in class card_hand gives you the value of a hand. hand | value ---------------------+-------- a) S Q, H 7, D A | 28, 18?? b) C10, D 3, H 4, D J | 27 c) H A, S J | 21 d) S A, C A, C 8 | 30, 20?? 3. a) Dealer value: 20. Player value: 22. Winner is Dealer. b) Dealer value: 19. Player value: 21. -- check this ace Winner is Player. 4. In deck.deal_card 5. A4_GAME | 1 | created on run DECK | 1 | a4_game.make CARD_PLAYER | 2 | both in a4_game.make CARD_HAND | 1 | card_player.make CARD | 1 | card_hand.add_card ARRAY[CARD] | 1 | card_hand.make 6. A4_GAME - CLIENTS: none - SUPPLIERS: DECK, CARD_PLAYER, REAL, STRING, BOOLEAN, STD_INPUT_OUTPUT. CARD_PLAYER - CLIENTS: A4_GAME - SUPPLIERS: STRING, CARD_HAND, REAL, CARD, STD_INPUT_OUTPUT. CARD - CLIENTS: CARD_HAND, DECK - SUPPLIERS: INTEGER, STD_INPUT_OUTPUT. CARD_HAND - CLIENTS: CARD_PLAYER - SUPPLIERS: ARRAY[CARD], INTEGER, CARD, INTEGER, STD_INPUT_OUTPUT. DECK - CLIENTS: A4_GAME - SUPPLIERS: STD_RAND, INTEGER, ARRAY[CARD], CARD, STD_INPUT_OUTPUT. 7. - Dealer deals a card to the player, himself and to the player again. - Player is dealt more cards until he does not want anymore. - The dealer keeps getting cards if his total is under 17. - The winner is evaluated. The person with the highest value and still under 22 wins. - The scores are updated. Winner adds the bet onto his score. The looser minuses the bet. If it is a tie (both equal or both over 21) then no points are given. OPTIONAL PROGRAM In the opt_a4_game class I added another procedure which recieves a valid bet from the player and returns it. Some more code was added to the play_hand procedure that checks to see if the hand is a blackjack (using the blackjack procedure in the opt_card_hand class) and adjusts the bet accordingly. It also awards a blackjack a win over a regular 21. The blackjack procedure was implemented in the opt_card_hand class. It checks to see if the value of the hand is 21 in the firs two cards, if so it returns true.