[comp.sources.games.bugs] Lunar Lander - some instructions and BSD patches

stacey@hcr.UUCP (Stacey Campbell) (05/09/89)

A number of people have asked some questions about Lunar Lander,
a number of other people (usually compiling on BSD) have sent some
patches to deal with curses(3X) routines that are not in their version
of BSD curses.  Here is a compilation of info these people offered/required.

Controlling the Lander
----------------------

The lander is fitted with three rockets;

          /~\
          | |
   left  -+++-  right
           |
      vert. thrust

Press keys '0' - '9' to set the default power level,
where '0' == no power and '9' == full power.

Pressing 'z' sets the power output of the left rocket
to the default, this has the effect of pushing the lander
to the right (if the default power level is > 0).

Pressing 'c' sets the power output of the right rocket
to the default, this has the effect of pushing the lander
to the left.

Pressing 'x' sets the vertical thrust of the middle rocket
to the default level, if this is non zero it will slow the
rate of descent of the lander.  If it sets it to zero the
lander will drop like a brick!

What's on the Screen
--------------------

The top of the screen reads;

alt:  X:  dY:  dX:  Score:

'alt' 	- is the current altitude from "sea level" in metres
'X' 	- is how far you have moved horizontally (in meters)
'dY' 	- is your rate of change of vertical movement, (e.g. -10.0
	  means you fell 10 meters in the previous second)
'dX'	- is your rate of change of horizonal movement, (e.g. -10.0
	  means you moved left 10 metres in the previous second)
'Score'	- is your current score.

At the bottom of the screen;

Thrust - L:  vert:  R:  pow:  Fuel:

'L'	- is thrust from the left rocket (pushes you to the right)
'R'	- is thrust from the right rocket (pushes you to the left)
	  Both 'L' and 'R' alter the 'dX' value.
'vert'	- is thrust from the vertical rocket (slows the lander's
	  rate of descent i.e. alters 'dY')
'pow'	- is the default power setting that will be used when you
	  press 'z', 'x' or 'c'
'Fuel'	- the amount of fuel left, when this reaches zero all thrust
	  from rockets ceases.

The two rules for landing are;
	1. Try to get dY >= -5 metres per second, anything faster
	   than -5 will cause the lander to explode.
	2. Make sure you are landing on a pad.

Some BSD Patches
----------------

Gordon Vickers offered the following for Ultrix people (thanks)...

To deal with crmode() not being supported;

     File: screen.c
     Function: InitialiseScreen()
     Change: Added another #ifdef BSD
                 initscr();
                 noecho();
  |      #ifdef BSD
  |              crmode();
  |      #else
                 cbreak();
  |      #endif
                 *init_scr = stdscr

     Each of the above lines that start with a pipe ("|") represent lines
     that I've inserted. No lines were deleted.

To deal with endwin() leaving the cursor at to top of the screen;

      File: land.c
      Function: EndCurses()
      Change:
              while(wgetch(screen) != ' ');
        |     clear();
        |     refresh();
              endwin();

Hope this has been of some help.
-- 
Stacey Campbell, HCR Corporation, {lsuc,utzoo,utcsri}!hcr!stacey