Home Technical Talk

Pseudo code?

copyright
polycounter lvl 7
Offline / Send Message
copyright polycounter lvl 7
Hello, I am applying to Game Dev college in about 2 months, and I have met all the requirements, but there is one that I am stumbling on.

here is the demand:


Pseudo code is a kind of structured English for describing computer programs. It allows the designer to focus on the logic without
being distracted by details of language syntax. At the same time, the pseudo code needs to be complete. Using simple pseudo code,
describe the steps you currently take getting up in the morning and going to school or work. As an example of writing pseudo code,
below is the basic logic for a game of Monopoly. Attach your solution on a separate piece of paper



A Game of Monopoly, including one player’s turn:
Procedure: Monopoly_Game
Hand out every player's initial money.
Decide which player goes first.
Repeat
Call Procedure Monopoly_Move for next player.
Decide if this player must drop out.
Until all players except one have dropped out.
Declare the surviving player to be the winner.
Procedure: Monopoly_Move
Begin a player’s move.
Throw the dice.
If the player rolled 3 doubles in a row
then go to jail
Move the number of spaces on the board shown on the dice.
If the token landed on "Go to Jail,"
then go there immediately.
Else if the token landed on "Chance" or "Community Chest,"
then draw a card and follow its instructions.
Else
follow the usual rules for the square (buying property,
paying rent, collecting $200 for passing "Go", etc.).
If the player rolled doubles
then repeat the Monopoly_Move procedure
Else end one's move.


I am a bit confused on how to do this, and whenever I try learning more about it I get nothing but Pseudo Code used for math problems and not for this kind of stuff. If anyone could help me out or link me something similar to this, it would be great thanks!

Replies

  • Kwramm
    Offline / Send Message
    Kwramm interpolator
    They're asking you to write a basic computer program - in pseudo code, which defines the game play. As game design you might do something like that in a real programming language, e.g. Lua.

    Pseudo code is not a real programming language, but it reads similar enough to a real one. I don't think there's a standard for it though.
    It's used to write down program flow and logic, with the advantage that you don't have to follow the syntax of a particular programming language. You can read it like a cooking recipe:

    start:
    IF water boils THEN
    ...put pasta in water
    ...add salt
    ELSE
    ...wait
    ...go to start and repeat
    END

    I don't think you have to exactly copy the pseudo code standards used in the example. As long as your own solution is readable and you can follow it, then it should be ok. Basically you're using it to describe a process (cooking pasta) or things that should happen in your game, e.g.

    STUFF HAPPENING TO PLAYER:
    ...IF bullet hits player THEN
    ...... player health gets reset to zero
    ...... player loses 1 life
    ...ELSE IF stone hits player THEN
    ......player loses 10 health points
    ...END
    END

    If you have trouble reading the monopoly example, use indentation and break up the lines like in my example. It should be easier to read then. Especially indentation shows you which actions belong together (i.e. add paste and add salt belong together and only happen when the waiter boils).

    I hope this clarifies it a bit.
  • copyright
    Offline / Send Message
    copyright polycounter lvl 7
    Thanks for the help! That did clarify it, but how would you start the application question where you have to use it from the point where you wake up and describe your events?
  • Kwramm
    Offline / Send Message
    Kwramm interpolator
    the program always starts at the top. SO you could just do..

    GETTING UP:
    ...wait until alarm sounds
    ...repeat 3 times:
    ......hit snooze button
    ......sleep until till alarm sounds again
    ...turn alarm off
    ...get out of bed
    ...IF coffeemachine is OFF THEN
    ......turn coffee machine on
    ...ELSE
    ......ask brother to share coffee with you
    ...END
    ...go to bathroom
    ...brush teeth

    you get the idea :)
    Since its pseudocode you cannot really test the logic except in your head, making sure it all makes sense. But all this is supposed to be so simple, there should be no need to run it on a computer to make sure it makes sense.

    The college just wants to see if you can think logically and write down the flow of actions or gameplay.

    good luck

    P.S. if you're serious about this choice of college, I would recommend getting some basic programming skills, because you will most likely have to do some programming in your job - e.g. with Lua. Any language offering a quick and simple start would do to get familiar with the programming basics: Lua, Python or even Basic.
  • copyright
    Offline / Send Message
    copyright polycounter lvl 7
    thanks mate! You were great help!
Sign In or Register to comment.