pseudocode - A game I'm writing for my programming concepts class -


the randomcoord function given me in project. that's why it's not mentioned anywhere else. in pseudocode , wanted check if there wrong it.

the program supposed game 10x10 grid player starts off in middle , has enter commands up, down, left or right in order find antidote poison in 20 turns or die.

that's bare minimum, added story , want add walls somehow , want know if there wrong have far , if willing me create walls in game.

the function of walls if player lands on space program display "there's wall here" , put player onto previous spot.

can me please?

declare integer x declare integer y declare string decision declare string direction declare integer turn set px = 5 set py = 5 call randomcoord call randomcoord set tx = randomcoord set ty = randomcoord declare integer map [10] [10]     function integer moveup         if px+1>10then             display "there wall here"         else             set px = px + 1         end if     end function      function integer movedown         if px-1<0              display "there wall here"         else             set px = px - 1         end if     end function      function integer moveleft         if py-1<0             display "there wall here"         else             set py = py - 1         end if     end function      function integer moveright         if py+1>10             display "there wall here"         else             set py = py + 1         end if     end function module main ()       display "your name vladsworn, powerful necromancer.              during travels stumbled upon town of ascalon.  town full of theives, beggars, mages  practice blood magic, , corrupted king.  getting dark out , looks going rain place stay, there run down inn giant hole in roof decide check out anyway.  walk in , see innkeeper @ desk , talking shady elf man.  seems ranger, has bow  on along quiver, has long blonde hair.  walk desk , ask innkeeper room, says room left on top floor, right under hole,  elf says can stay in place night if need to, in forest surrounding town high in trees.  want stay @ inn? or take chance staying elf man met?  please type either elf, or inn"         input decision      display "you dont see around here, 2 choices either elf mans house in trees or run down inn in ascalon" until  decision == elf or decision == inn   if  decision == elf          display "you decide take chance , stay elf man, takes house in trees , on way talk him , find out alittle him, first      find out name adrian find out reason in shady town has been looking blood mage killed mother, sources      still lives in town , hes been here searching him months , didnt find on wherabouts.  asks if      aid him on quest , says pay if decide him.  arrive @ adrians treehouse, bigger      expected, high above huge redwood tree stairs cut side of tree.  climb stairs , enter house, nice little hut bedroom,     small kitchen , trophy room dragon heads on walls.  adrian hands bedroll , tired lay down , fall asleep.      after couple of hours of sleep woken sharp pain in neck , sound of adrian yelling , fighting someone.  stand , see adrian      battling mage, blood mage dissapears black smoke.  adrian explains blood mage looking , has realized has been      followed.  has injected magic poison has antidote to.  adrian speculates have 20 days live unless find antidote     , adrian set off right away find , kill mage." else     display "you decide stay in inn despite hole in roof.  dont know elf man , why eager have stay him, @ least innkeper     isnt shady elf.  hard sleep manage go sleep after couple of hours awake find whole room on fire, see dark      shadowy figure moving closer you.  try cast spell seems unnafected keeps moving towards until stops right in front of , stabs     right through heart pointed staff.  dead" end if  while decision == inn  display "you , adrian run town in search blood mage start in town square in center of town, can move up, down, left, or right. way  want move"     display "which way want move now?"     input direction     set turn=turn+1         if direction == or direction ==             call moveup         else             if direction == down or direction == down                 call movedown             else                 if direction == left or direction == left                     call moveleft                 else                     if direction == right or direction == right                         call moveright                     else                           display "i dont understand"                     end if                 end if             end if         end if until px==tx , py==ty or turn==20 if px==tx , py==ty     display "you found antidote , no longer effected poison!     must find , kill blood mage.  continued" else      display "you feel poison draining life force, fall dead on ground" 

display "you , adrian run town in search blood mage start in town square in center of town, can move up, down, left, or right. way want move"

should before while loop

if direction == or direction ==         call moveup     else         if direction == down or direction == down             call movedown         else             if direction == left or direction == left                 call moveleft             else                 if direction == right or direction == right                     call moveright                 else                      display "i dont understand"                 end if             end if         end if     end if 

use switch statement if possible

record if movement successful

increment turn @ end of movement , if movement successful


Comments