docummentation for adventure game

5
Flowcharting for Adventure Game Start Inse rt Name Question Asked Inse rt Answ er If answ er is corr ect Next Question Asked Stop YES NO

Upload: hout300

Post on 12-Jan-2015

90 views

Category:

Technology


0 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Docummentation for adventure game

Flowcharting for Adventure Game

Start

Insert

Name

Question Asked

Insert

Answer

If answer is

correct

Next Question

Asked

Stop

YES

NO

Page 2: Docummentation for adventure game

Pseudocode for Adventure Game#GameOver = Falsename="" def main(): name = ask 'What is your name?' display 'Welcome to the corridor of DOOOOOOOMMMM!' display name, 'You are trapped in a corridor with five doors but before you can move out of the corridor you must answer the music questions behind each door in order of the door numbers. If you answer incorrectly you will be swallowed by the black hole and will have to start again Please go to door number one'  GameOver = False while not(GameOver): GameOver = PlayGame(name) final() def PlayGame(name):  endOfGame = False Outcome1 = questionOne(name) Outcome2 = questionTwo(name) Outcome3 = questionThree(name) Outcome4 = questionFour(name) Outcome5 = questionFive(name)  if Outcome1: Outcome2 = questionTwo(name) if Outcome2: Outcome3 = questionThree(name) if Outcome3: Outcome4 = questionFour(name) if Outcome4: Outcome5 = questionFive(name)  

Page 3: Docummentation for adventure game

if Outcome1 and Outcome2 and Outcome3 and Outcome4 and Outcome5: endOfGame = True return endOfGame #Question Onedef questionOne(name): display name, 'welcome to door number one, hold on for your question...' display name, 'How many members of there in Coldplay?' display 'a) 5' display 'b) 3' display 'c) 4' status = True message = name + 'please enter your answer: ' answer = ask for message display answer if answer == 'b': display name, 'congratulations, move onto door two' else: display name, 'sorry, the black hole has sucked you up you will have to go back to the beginning' status = False return (status) #Question Twodef questionTwo(name): display name, 'welcome to door number two, hold on for your question...' display name, 'Who is missing from this line up: Sporty Spice, Ginger Spice, Posh Spice, Baby Spice?' display 'a) Scary Spice' display 'b) Happy Spice' display 'c) Sad Spice’ status = True message = name + 'please enter your answer: ' answer = ask for message display answer if answer == 'a': display name, 'congratulations, move onto door two' else: display name, 'sorry, the black hole has sucked you up you will have to go back to the beginning') status = False return (status) 

Page 4: Docummentation for adventure game

#Question Threedef questionThree(): display name, 'welcome to door number three, hold on for your question...' display name, 'What band was Michael Jackson part of before becoming a solo artist?' display 'a) Jackson 5' display 'b) The Drifters' display 'c) Sister Sledge' status = True message = name + 'please enter your answer: ' answer = ask for message display answer if answer == 'a': display name, 'congratulations, move onto door two' else: display name, 'sorry, the black hole has sucked you up you will have to go back to the beginning' return (status)  #Question Fourdef questionFour(): display name, 'welcome to door number four, hold on for your question...' display name, 'Who collaborated with Robin Thicke on the Blurred Lines track?' display 'a) Pharrell' display 'b) Jay Z' display 'c) Pharrell and T.I' status = True message = name + 'please enter your answer: ' answer = input(message) if answer == 'c': display name, 'congratulations, move onto door two' else: display name, 'sorry, the black hole has sucked you up you will have to go back to the beginning' return (status)  

Page 5: Docummentation for adventure game

#Question Fivedef questionFive(): display name, 'welcome to door number five, hold on for your question...' display name, 'What is Fergies real name?' display 'a) Sarah Ferguson' display 'b) Stacey Ferguson' display 'c) Serena Ferguson' status = True message = name + 'please enter your answer: ' answer = input(message) if answer == 'b': display name, 'congratulations, move onto door two' else: display name, 'sorry, the black hole has sucked you up you will have to go back to the beginning' return (status) def final(): display name, 'well done you are the guru of the music world you may now leave the corridor and carry on with your life! '