Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Can anyone help me with this program of old maid? Urgent!!!

Jazz ChanJazz Chan Member Posts: 1

i am stuck in this but i need to hand in next week , please help me T_T
here is my program until now, please message me if u got some ideas and welcome to post your edited programme here, thank you so much for your generous help.......
This is what i need to do in this project
(i) pick up a card which is the “odd” card
(ii) display the cards obtained by each player
(iii) display the discharged cards by each player
(iv) display the cards in each player’s hand after discharging
(v) display the card drawn by each player, the discharged cards and the cards in the player’s hand
afterwards, repeat the steps until only one card is left

(vi) display maid, the last card of the loser and the winner

https://docs.google.com/document/d/13uZcXjcoT8zBoZ2a52KXmuBuCFU2loJK7sDjm9TnyPo/edit

please ask me to add you for editing the programme, thanksss <3

Answers

  • ActorActor Member Posts: 447 ✭✭

    As I understand the rules of the game it ends when one player has zero cards, not when there is only one card left.

    You need to start with something like this. This code assumes that the one card has been withheld from the deck and thus the "old maid" has been defined. The procedures shuffle, deal, player_discard, etc. have yet to be written.

    Sorry, but there doesn't seem to be any way to preserve the indentation.

    program old_maid ;
    begin
    shuffle ;
    deal ;
    player_discard ;
    if player_count = 0 then begin
    writeln('Player wins') ;
    halt
    end ;
    dealer_discard ;
    if dealer_count = 0 then begin
    writeln('Dealer wins') ;
    halt
    end ;
    while TRUE do begin
    player_draw ;
    player_discard ;
    if player_count = 0 then begin
    writeln('Player_wins') ;
    break
    end ;
    dealer_draw ;
    dealer_discard ;
    if dealer_count = 0 then begin
    writeln('Dealer wins') ;
    break ;
    end ;
    end
    end.

  • B00B00 Member Posts: 98 ✭✭✭

    @Actor said:
    Sorry, but there doesn't seem to be any way to preserve the indentation.

    Yes there is.

    sample
        code
            block
    

    sample line

Sign In or Register to comment.