Skip to content

j19sch/blackbox-puzzle-31

Repository files navigation

BlackBox Puzzle 31

You can find the blog post in which I share my line of thought here:
https://j19sch.github.io/blog/2019/solving-black-box-puzzle-31-with-data-analysis/

The puzzle

James Lyndsay has created a number of BlackBox Puzzles. Puzzle 31 is one of the puzzles with both a GUI and an API.

The plan

When exploring a BlackBox Puzzle through the GUI, you start from the input, observe the output, and try to find a pattern. Based on that pattern you form one or more hypotheses, which feedback into your exploration.

Using the API, however, allows you to get the output for all possible combinations of inputs (there are 512 for puzzle 31). Or rather, it allows you to do so more easily than through the GUI. Once you have that dataset, you can explore it starting from the output, from a range of inputs, etc.

Disclaimer: I knew the simple principle this puzzle adheres to before looking into this API/data analysis approach.

This repo

Contents

  • get_it_all.py: get the output for all possible input combinations and write it to the csv file puzzle31.csv
  • puzzle31.csv: all input combinations and their output
  • puzzle31.ods: LibreOffice Calc sheet using tables, conditional formatting and filters to solve the puzzle
  • puzzle31.ipynb: Jupyter notebook, run with jupyter notebook puzzle31.ipynb

Setup

  • Install Python 3
  • Create a virtual environment: python -m venv venv or python3 -m venv venv
  • Activate the virtual environment: (linux/mac) source ./venv/bin/activate or (win) venv\Scripts\activate
  • Install dependencies: pip install -r requirements.txt

Resources

Jupyter, Pandas, Seaborn etc.