This challenge is part of X-MAS CTF 2020. In this challenge you need play 50 rounds of Lazer tag against Krampus in 30 seconds. The instructions are given when you connect to the bot:

For each round we get both Krampus and player positions in x∈(0,1), y∈(0,1). Since the walls are made out of mirrors that reflect lazer we need to consider reflections when placing the lazer blockers. I googled around how to best calculate reflections until I found this page on Google that demonstrates how to simplify the calculations. The main principle is to reduce the reflections to straight lines, which is illustrated in the image below.

I setup a Jupyter notebook to visualise the situation and calculate the reflected player positions up to two reflections away:

I then calculate the midpoints where the lazer converges and that will be the blocker positions.

Next step is to calculate the reflected positions of the traps back to the [0,1],[0,1] coordinates. They overlap very closely to 16 positions but it’s still necessary to round up the coordinates so that there are only 16 positions since that is how many blockers we are given.

The Jupyter notebook can be found here: https://github.com/j11b0/lazertag/blob/main/LazerTag.ipynb

To play the game I use pwntools. The final code for the solution:

--

--