Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/victorkp/hexagony-solver
Solver for Jane Street's Hex-agony #2 Puzzle
https://github.com/victorkp/hexagony-solver
hexagony jane perl perl-script puzzle solver street
Last synced: about 1 month ago
JSON representation
Solver for Jane Street's Hex-agony #2 Puzzle
- Host: GitHub
- URL: https://github.com/victorkp/hexagony-solver
- Owner: victorkp
- Created: 2017-01-31T06:12:12.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-02-06T19:44:47.000Z (almost 8 years ago)
- Last Synced: 2024-10-13T11:43:03.751Z (2 months ago)
- Topics: hexagony, jane, perl, perl-script, puzzle, solver, street
- Language: Perl
- Homepage:
- Size: 2.12 MB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Hex-Agony 2 Solver #
This is a short Perl program built to solve Jane Street's January 2017 puzzle, [Hex-agony #2](https://www.janestreet.com/puzzles/hex-agony-2/).
## Operating Assumptions
The script makes a number of assumptions about the solution, which seemed reasonable after fiddling with the problem by hand. These assumptions greatly reduced the search space, and so you may observe that the script finds the correct solution in ~1 second on ageing hardware.1. There is a green 130,321 in the middle column
2. The red 169 has a blue 169 visible to it (implying that there are two black 13s whose product is 169)## Program Specifics ##
The Hex-agony puzzle is mapped to coordinates such that the bottom hex has row index 8:![Coordinate Layout](images/hexagony-coords.png)
## Constraints Solved, In Order
1. Green 130,321
* Is in the middle column
2. Black 19s
* Can see at least 19 "empty" hexes (which we later assume are red after solving the puzzle)
* Can see green 130,321
* Not visible to green 1
* Are four of these
3. Blue 169
* Visible to red 169
* Not visible to green 1
* Not obstructing any of the black 19s from seeing >= 19 empty spaces
4. Green 169
* Visible to blue 169
* Not obstructing any of the black 19s from seeing >= 19 empty spaces
4. Black 13s
* Not visible to green 130,321
* Visible to green 169
* Can see >= 13 empty spaces
* Not obstructing any of the black 19s from seeing >= 19 empty spaces## Solution
Solving these constraints results in this output from the Perl script:![Constraints Solved](images/hexagony-constraint.png)
And a bit of manual number crunching gives the final solution:
![Solution](images/hexagony-solved.png)