mirror of
https://github.com/tilleul/apple2.git
synced 2024-11-29 15:50:11 +00:00
Update README.md
This commit is contained in:
parent
42d8d859e1
commit
206c348102
@ -41,3 +41,12 @@ How does the program check if the spaceship has hit a wall ? My intuition was th
|
||||
|
||||
Here's a representation of the 16 rectangle zones the maze is made of.
|
||||
![rectangle zones](./htc3.png)
|
||||
|
||||
The main problem is that the code goes through ALL of the coordinates testing for EACH rectangle zone EVERY time, even if it has found already found the zone where the spaceship is. Each of these tests is made of 4 conditions (testing 2 limits of X and then 2 limits of Y). That's 4x16=64 conditions in a row ... and this is killing the game.
|
||||
|
||||
16 lines like this one will kill the game:
|
||||
```basic
|
||||
100 IF (X > = 10 AND X < = 80) AND (Y > = 80 AND Y < = 100) THEN Z = 1
|
||||
```
|
||||
|
||||
It should be noted that although Z holds the zone number where the spaceship is, this variable is not used for anything else but testing if it's non-zero (in which case the spaceship is in none of the zones, thus out of the maze) and also that Z is not even properly set as lines 135 to 142 all set Z to 6 as if it was the same zone. Also, the comments indicate that there are 11 zones when in fact there are 16. It looks like during the development the maze was modified from 11 to 16 zones. And one last thing, some zones limits overlap but that's ok.
|
||||
|
Loading…
Reference in New Issue
Block a user