Pokemon Red/Blue - Vermillion Gym Trash Can glitches

Channel:
Subscribers:
12,600
Published on ● Video Link: https://www.youtube.com/watch?v=dyFA3gZMxrs



Duration: 2:29
18,438 views
146


IMPORTANT! - Apparently it's true that the first switch can only be in a can with an even value (0, 2, 4...), meaning that it being in 7 as shown in the video isn't actually possible. The principle is the same as if it was in 4 or 10 (A) though. More information below.

As we all know, there are 15 trash cans inside the Vermillion gym. To open the electric door that lets you reach Lt. Surge you have to find two switches inside the trash cans. Every time you pick one trash can wrong, the position of the switches gets randomized.

The first switch will be in either of the 15 trash cans, at random. Then, it was intended that the second switch would be in one of the adjacent trash cans. Adjacent trash cans include the ones above, below, to the left, or to the right, but not diagonally. This means that depending on the position of the first trash can, the second switch could be in 2, 3, or 4 different trash cans, with 4, 8, and 3 cases respectively.

Here's the layout of the trash can map identified by their harcoded hexadecimal id's:

0 | 3 | 6 | 9 | C
1 | 4 | 7 | A | D
2 | 5 | 8 | B | E

As a result of the routine that handles the switch positions being buggy, here's what happens after the position of the first switch is known:

- For the cans that have two adjacent cans, the adjacent can with the lowest id will never contain the second switch.
- For the cans that have four adjacent cans, the adjacent cans with the first, second, and third lowest id's will never contain the second switch. For example if the first switch is in 7, the second switch will never be in 4, 6 or 8. This leaves A as the seemingly only option but...
- In addition to this, can 0 (top left) always has a chance to contain the second switch, regardless of where the first switch was. If the first switch had two or four adjacent cans, there is a 50% chance that the second switch is in can 0. If the first switch had three adjacent cans, there is a 25% chance that the second switch is in can 0. The remaining probability is split between the other possible cans (if these also include can 0, the probabilities of the second switch being in can 0 add up).

What does this mean?

If switch one is in 4, 7, or A, switch two will be in 7, A, D respectively (50%), or in 0 (50%).
If switch one is in 0, 2, C, or E, switch two will be in 3, 5, D, D respectively (50%), or in 0 (50%).
If switch one is in any of the other positions, their three adjacent cans will have a 25% each, and can 0 will have the other 25%.

The first bug of not all adjacent cans being possible is because the number of adjacent cans is used as a mask and ANDed with a random number. ANDing with 3 (%0011) leaves all options of 0, 1, 2, 3 possible, but ANDing with 2 (%0010) only leaves 0 or 2, while ANDing with 4 (%0100) only leaves 0 or 4.

To sum up the cause of the second bug, it is as a result of the number obtained above being decremented (by 1) in order to point to the right value in the trash can data structure. If the result was 0, it gives 255 when decremented causing the function to grab the second switch position from a location in ROM where there's no data (just 0's). If this happens, a 0 will be read and treated as switch 0.







Tags:
pokemon glitch
pokemon hack
pokemon secrets
celebi glitch
glitch pokemon
pokemon red glitch
Crystal_
thezzazzglitch
arbitrary code execution
pokemon speedrun
pokemon hacks
pokemon gameboy
glitch city
pokemon assembly
gameboy
pannenkoek
pokemon yellow glitch
arbitrary code
pokemon glitches
pokemon pyrite
mew glitch
credits warp
pokemon crystal
pokemon mechanics
missingno
pokemon beta
coin case glitch
8f glitch
chickasaurusgl
pokemon corruptions



Other Statistics

Pokémon Red and Blue Statistics For Crystal_

At present, Crystal_ has 796,590 views spread across 41 videos for Pokémon Red and Blue, and close to 6 hours worth of content for Pokémon Red and Blue published on his channel. This is 32.95% of the total watchable video on Crystal_'s YouTube channel.