## Re: [stella] River Raid

 Subject: Re: [stella] River Raid From: Thomas Jentzsch Date: Fri, 28 Jun 2002 09:28:59 +0200
```Glenn wrote:
> Could somebody give me a table of precalculated values for this function
> below from River Raid or an algorithm that would work in another language
> like Javascript?

Here is some Pascal like code, I hope that works for you:

var
randomLo, randomHi : Byte;

procedure nextRandom;
var
r, C1, C2 : Byte;
begin
r:=(randomHi AND \$1F) * 8;
r:=r XOR randomHi;
if (r AND \$80 = 0) then C1:=0
else C1:=1;
r := (r AND \$7F) * 2;
if (randomLo AND \$80 = 0) then C2:=0
else C2:=1;
randomLo:=(randomLo AND \$7F) * 2 + C1;
randomHi:=(randomHi AND \$7F) * 2 + C2;
end;

> By doing this we can reassemble it to start further into the game by
> changing the seed value.  There is also a flag within the game to allow for
> full-width variation canyons which, when set to 0, should allow for a
> harder game on reset.
>
> I don't know how it handles the fuel placement.  It seems as the game
> progresses that there is more fuel, jets, and so on...  The goal would be
> to initialize the game exactly to how it runs x bridges into it.  I'm not
> sure I can do that, but if we can get a precalculated table, it's a start!

The game generates more enemies and less fuell when the difficulty level
increases (every bridge). The chances for a new enemy (helicopter and
ship) start at 48% and raise up to 88%.

The chances of a new fuel tank generated go from 26% downto 6%.

If no enemy or fuel tank is generated, a house in made instead, so in higher
levels there are also less houses.

The difficulty level is limited to 48 (starting at 1), the game doesn't get any
harder after that. You could increase the value of the constant MAX_LEVEL
up to 63, but then you won't get very much fuel anymore (~0.2%).

The initial value for the level is set in the table called "InitTab"

Have fun!
Thomas
_______________________________________________________
Thomas Jentzsch         | *** Every bit is sacred ! ***
tjentzsch at web dot de |

______________________________________________________________________________
All inclusive! 100 MB Speicher, SMS 50% gunstiger, 32 MB Attachment-Gro?e,
Preisvorteile und mehr unter http://club.web.de/?mc=021104

----------------------------------------------------------------------------------------------
Archives (includes files) at http://www.biglist.com/lists/stella/archives/
Unsub & more at http://www.biglist.com/lists/stella/

```