Hamurabi, Pseudo Coding

Today, I’m going to start with my version of pseudo coding.  I usually just right up a rough outline of the program and the start breaking up each part.

First we display some sort of program identification, like maybe the program title and a short description of the game.

With Hamurabi, you are playing for a ten year term so the main program is going to consist of ten turns.  Each turn you are going to:

Display this years status.

Handle land sales if any.

Handle land purchase if any.

Handle feeding the people.

Handle planting the fields

This will continue for ten years or until you really mess up.

The thing the I like about Pascal is you could almost use this as code.  It might look like this:

BEGIN (* MAIN CODING AREA *)
   WRITELN(‘Hamurabi’);
   WRITELN;
   WRITELN(‘Try your hand at governing Ancient Sumeria’);
   WRITELN(‘for a ten-year term of office.’);
   WRITELN;
   REPEAT
      year := year + 1;
      DisplayThisYearsStatus;
      HandleLandSalesIfAny;
      HandleLandPurchaseIfAny;
      HandleFeedingThePeople;
      HandlePlantingTheFields;
   UNTIL year = maxyear;
   DisplayFinalResults;
END. (* MAIN CODING AREA *)

 

Basic is not going to be as readable:

1000 Y=1
1010 GOSUB 10000 : REM DISPLAY THIS YEARS STATUS
1020 GOSUB 11000 : REM HANDLE LAND SALES IF ANY
1030 GOSUB 12000 : REM HANDLE LAND PURCHASE IF ANY
1040 GOSUB 13000 : REM HANDLE FEEDING THE PEOPLE
1050 GOSUB 14000 : REM HANDLE PLANTING THE FIELDS
1060 Y=Y+1
1070 IF Y <= 10 THEN 1010 : REM NEXT YEAR OF TERM
1080 GOSUB 15000 : REM DISPLAY FINAL RESULTS
1090 GOTO 32767
 

Although, anyone who has written in basic would say this part of the code is more readable than some.  Try looking at the Basic Computer Games version.  Keep in mind the this version types in with almost no editing on several different computer systems, which to me is an amazing feat in itself.

 

Posted in Apple //c, Programming, Projects Tagged with: , , , , , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

*