Tuesday, 25 November 2014

Pseudo Code For Previous Projects

One part of the planning process when considering whether a project is feasible or not is to create pseudo code. Pseudo code is normally produced by designers as a way of conveying the desired functionality of a project to coders in a way a text they understand.

Here is some pseudo code i've produced for two projects while I was at college;

2D Platform game using Stencyl (3 person project)

This Pseudo code has been created with knowledge that the game will be created in the Stencyl game engine so any code relating to animations has been excluded. The pseudo code was useful because it enabled the level designers to understand roughly how the game functions for example they know that the jump height of the playable character is fixed meaning that the space between jumpable platforms shouldn't exceed a certain length or height.  We also used pseudo code when developing a board game as its a very useful method for clarifying the mechanics of a game which then enables the members of the group who focus on the aesthetic elements of the project to design according to the technical specification in the pseudo code.


Var  Player
Var  Player2
Var runningspeedleft: number = 10
Var runningspeedright:number =10
Var Jumpingheight:number = 15
Var GoldCup
Var Score:number = 0
Var Health:number = 1
Var Enemy


    Right Key is down
         Player.X > runningspeedright
   Left Key is down


   Up Key is down
        Player.Y >Jumpingheight


When Player collides with GoldCup
     Set Score + 100
          Create Player2 at Player.X + Player.Y
               Set Health =+1

  When Player collides with Enemy
       Set Health =-1
       Set Score =-300
If Health = 0
         Player.X = 0
         Player.Y = 0


   Print Score.txt at X =20 + Y = 20
   Print Health.txt at X =20 + Y =30

IT Security Robot

For the IT project the pseudo code was initially produced and then shown to the client pending their approval. If the client was happy that the pseudo code met the requirements of their brief it would then be passed onto the coder who would implement it.

NXT Brick 1 (Message Sender Robot)

Run     “Door Alarm”

Repeat       Duration 10 Seconds

If                 Target is within 30 centimetres then Status is “True”

        Else    Continue running till Status is set to “True”

If                 Status set = “True”

       Run     Block “Send Message”

       Wait     10 seconds

Loop          Duration “Unlimited”

NXT Brick 2 (Message Receiver Robot)

Run      “Receiver”

If           Logic is         “True”

               Run     Receive Message
               Run      Text      “Alarm”
               Run       Sound   “Alarm”
               Wait       10 seconds

Else        Wait till Logic is “True”

No comments:

Post a Comment