Puzzle Trouble

July 11, 2024 FCSC 2024 #misc

All the scripts used are available on my github repo

Here are the links to the original easy and hard challenges.

Easy

This was what we had as input : input easy

For the first program I started by taking the code from someone on internet who solved the 2023 prechall But I wanted to swap the pieces one by one interactively so i named each piece and solved it with the swap-easy.sh coordinated with the arrange-easy.py and got output-easy.png To solve it I used ./swap-easy.sh and swapped manually all the pieces with there names (by following the state of the puzzle)

watch 'cat arrange.py | sed -n "13,21p"'

We get the flag at the end: Easy output

Hard

This was what we had as input of this second challenge (there are many more pieces): input hard

Before starting the second challenge I sorted all the pieces of this second challenge by hues to facilitate the begining of the challenge. I thus used hues.py to sort all the image and start with a somewhat easier puzzle to solve.

Output sorted by hues

For the second challenge it was far too tedious to search what was each piece’s coordinates so i decided to do a python program that would get the coordinates of each piece I wanted to swap, so i only needed to click on two pieces to swap them. But as i had already programmed the swap and the arrange I reused them in a most hedious python program that would call a bash program to swap the image and then call a python program to regenerate the image.

I thus reprogrammed the swap-easy.sh in simple-swap.sh and only needed the python script exchange.py to exchange all the pieces.

To solve the puzzle thus I only needed to run exchange.py which would call simple-swap.sh which would call arrange.py

python exchange.py

Thus we get the output and the flag.

output hard