can some one help me out for the pseudocode or flow chat of this Game

Asked by general about 1 year ago

choose a very simple childrens game and describe its logic, using a structured flowchart or pseudocode. For example, you might try to explain Rock, paper, Scissors; Musical Chairs; Duck, Duck, Goose; the card game War; or the elimination game Eenie, Meenie, Minie, Moe.

3 responses

  • enrique says

    Howdy general,

    I'm guessing this is some kind of school or university question?

    You should select one of the games and then do your own flowchart or code.

    I'm sure people would be happy to help you - after you have done a version of it, and even help review some code, but the purpose of you doing these type of questions is so you can learn. You learn nothing if the answer is provided to you.

    Cheers

  • general says

    Start

       Take bath
         press cloth
    

    if cloth not satisfied

       press again
    

    else wear cloth

    leave home 
    

    while

  • enrique says

    Thanks - that's a good start - it's not a game, but it's starting to think about the process. Best thing I learnt about computers is that they will do exactly what you tell them. Not what you mean, but what you say (or code). So planning out the program and the logic is very important.

    You might want to think about what's happening in the press again - do you want to keep checking if the 'cloth is satisfied' (a loop) or is it checked once and then worn (the 'if' that you have)

    Another example in pseudocode - think about a card came of Blackjack (also called '21') where you draw cards and try to add up to close to 21 but not over it:

    draw 2 cards from pack
    loop (sum of card points < 21) 
      if (sum of card points >=18) then
        alert "stay - no more cards"
        end game
      else
        draw 1 card from pack
      end if
    end of loop
    alert "busted! - game over"
    

    Hope it helps