Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spawn pawn on any square #121

Open
ghost opened this issue Apr 19, 2020 · 4 comments
Open

Spawn pawn on any square #121

ghost opened this issue Apr 19, 2020 · 4 comments
Labels
engine engine-breaker-$$$ Winner of the Battlehack 2020 engine breaker prize!

Comments

@ghost
Copy link

ghost commented Apr 19, 2020

This code makes things like ints except that != always returns False.

class hacked_int(int):
	def __ne__(left, right):
		return False

Then, do

spawn(hacked_int(4), hacked_int(0))

to spawn a pawn at row = 4 and col = 0.

@arvid220u
Copy link
Contributor

omg i love this exploit

@pashneal
Copy link

pashneal commented Apr 20, 2020

It is interesting that you cannot access any member that has an underscore in it but you can overload object members with the same specs.

@jay20162016
Copy link

jay20162016 commented Apr 20, 2020

For some functions, e.g. __init__, __repr__, __str__, this doesn't work.

@spipm
Copy link

spipm commented Apr 21, 2020

Using this technique, you can also use the following to spawn on negative rows and columns:

class hi(int):
    def __ge__(left,right):
        return True
    def __ne__(left, right):
        return False

You can then for example do spawn(0, hi(-1)), which will trick the engine into thinking your bot is on column -1, which allows you to capture on the other side of the board (column 0), because of abs(col - new_col) != 1 in game.py.

@arvid220u arvid220u added engine-breaker-$$$ Winner of the Battlehack 2020 engine breaker prize! and removed 🤑? labels Apr 24, 2020
arvid220u added a commit to arvid220u/malthusia that referenced this issue Aug 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
engine engine-breaker-$$$ Winner of the Battlehack 2020 engine breaker prize!
Projects
None yet
Development

No branches or pull requests

4 participants