Code style applied. Increased the maximum number of gate blocks to 40.
Removed some whitespace.
Fixed a bug where an already closed gate got used for teleporting.