## The random number generator

### Seeding:

The random number generator is seeded with time in seconds since some unknown epoch modulo 65536.

### Iteration

The random number state is iterated by:
```X' = (22695477 * X + 1) mod 2^32
```
This formula is invertible:
```X = (690295837 * (X' - 1) ) mod 2^32
```
The RNG has a single cycle of 2^32 numbers.

### Random numbers

To generate a random number, the RNG is iterated once, then the RNG state is taken, divided by 65536 and ANDed with 32767.
Typically the resulting number is then divded by something depending on what the random number is used for and taking the remainder, e.g.:
• 11 when determining the type of fade to perform
• 1000 when determining the securty code

### RNG usage:

• The first throw is for security code, the second throw is for type of the first fade.
• Using the noid remover uses 75 random numbers.
• Some fade types use random numbers (amount unknown)
• Launching of bazooka might use one extra random number per frame?
• Floors use number of random numbers per frame, depending on the floor.
``` * Number of enemies doesn't seem to matter

```

Each time character transitions between rooms, a dialog box appears or disappears there is a fade.
This fade is random, and the fades vary wildly in length, so this is a good subject for luck manipulation.
The fade type is determined by taking a random number, dividing 11 and taking the remainder:
 Remainder Fade type Notes 0 Whole screen random Fast, uses random numbers 1 From top and bottom to center 2 Random from top Uses random numbers 3 Striped from top and bottom 4 From center to top and bottom 5 From left and right to center 6 From center to left and right Can be canceled 7 Random from bottom Uses random numbers 8 Random from left Uses random numbers 9 Random from right Uses random numbers 10 Diagonal
The fade type 6 is special: It can be canceled by a keypress. No other fade type behaves that way.
The fade type 0 is greatly faster than others (except canceled type 6).

## The missing three keys

The missing three keys are in following places:
• Phone on floor 9 (use it to pick the key)
• Phone on floor 11 (use it to pick the key)
• Phone on floor 29 (use it to pick the key).
``` * The security has to be deactivated first, otherwise it will blow up.
```

## Tricks

### Jump trick

This only works when moving left for some reason.
Hit either roll or jump when running. The character speed increases to 12 for one frame (normal running is 8).

### Event invincibility

• When jumping or rolling, the character is invincible to melee attacks, but not projectile attacks.
• When between floors, the character seems invincible to all attacks.

### Phones with optional stuff:

• Floor 18: The first digit of security code.
• Floor 20 (left): The second digit of security code.
• Floor 26: The third digit of security code.
• Floor 28: Two extra pizzas and two noid removers.

### Noid removers

Using noid remover will:
• Use 75 random numbers
• Remove all noids and missiles on screen
• If you have been knocked back by a melee attack, save your pizza.

Even if these addresses change, the differences between addresses should remain constant.
 0x1E344 Word Character X position 0x1E3B4 Word Time left minutes 0x1E3BA Word Time left seconds 0x1E3BE Word Time left quater seconds 0x1DE34 Dword RNG state 0x1707C Word Security code (0-999)

GameResources/DOS/AvoidTheNoid last edited by Ilari on 4/1/2012 10:39 AM