Pseudocode · Viking Code School

Pseudocoding for a Counter Game

The following is a program for a logic game using pseudocode. This is the third of three pseudocoded programs written for an assignment for the Software Engineering Basics course of Viking Code School’s prep work.

Pseudocode is the process of writing out the logic of solutions to specific coding challenges using plain English. It is a good way to write out all of the code you will need to write before actually coding and is not very time consuming.

The instructions:

  • 10 friends are sitting in a circle around a table and decide to play a new game. In it, they count up through the numbers from 1 to 100. The first person says “1”, the second says “2” and so on… but with a few catches:
  • Whenever the number is divisible by 7, they switch directions. So person 6 will say “6”, person 7 will say “7”, then person 6 again will say “8”.
  • Whenever the number is divisible by 11, they skip the next person.
  • Your job is to pseudocode a program which will determine which player says the number 100.

This was quite a fun one to think about as it took some breaking down of each process and how they could work together. I used a series of IF and ELSE statements within a WHILE DO loop to accomplish the goal.

game-pseudocode

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s