Giter Site home page Giter Site logo

toa_puzzle_solver's Introduction

 Tombs of Amascut Puzzle Solver 

A solver for the modified LightOut puzzle found in the Path of Scabaras within the raid.

Disclaimer

This is a personal project used for personal needs. It is not thoroughly error tested nor is it guarenteed to work on your operating system (my personal OS is Windows 10, so this is the best bet). Use at your own risk, or make it better!

Created using intellectual property belonging to Jagex Limited under the terms of Jagex's Fan Content Policy. This content is not endorsed by or affiliated with Jagex.

Usage

Installation

Simply download the executable in the dist folder found here and run on your machine. The source code used for the compiling of this exectuable (compiled through PyInstaller) is available here and the build output from PyInstaller is available here, so that you can have a little more trust running a .exe from some random person on the internet :D. You can always just download and run the source code in a command window if you like, also.

Solving the Puzzle

  1. Red tiles mean the tile is off, blue tiles mean the tile is on. Highlight those that are on in the tomb blue in the program.
    • Orientation does not matter, highlight however makes sense to you!
  2. When the blue tiles match the highlighted tiles from the raid, click solve.
  3. The solution will now highlight in blue the tiles needed you need to step on to solve the puzzle.
    • It does not matter what order you enter the solution, as the solution is commutative.

  4. You can verify this by entering it in the above grid, as the top puzzle will now behave like the in-game puzzle.
  5. To restart the process, simply click reset and re-do the process from above.

The Math Behind It

The puzzle in this game is adapted from a similar game called "Lights Out", although the middle square in this case has been removed. In either case, the math remains the same. I solve this puzzle by using a solving a linear system of equations which is based on a great WolframAlpha article by Margherita Barile. The basics of how and why this works are laid out over there, so I will not be re-explaining that here.

However, some adapting was needed. First and foremost, the lack of a center tile meant that the coefficient matrix (called A) had to be updated. Each 1x8 coefficient matrix (that is, how clicking each tile causes other tiles to react) was stacked on top of on another. See an example of this in the first row of A, where clicking the first tile changes itself, the second tile and the fourth tile (first tile in second row). Constructing the resultant 8x8 matrix was relatively easy so I did it by hand. The other two matrices, x, the variable matrix, and L, the tile matrix, were easy to adapt by simply shortening their length by one. L is defined by the initial tiles where, counting from the top left across then down, a one corresponds to an "on" tile and a zero to an "off" tile. These matrices are shown below, with L using the tiles from the previous section as an example.

The system of equations we are interested in solving is given by Ax=L, which can be solved easily in the real number space with some basic numpy functionality. Each entry in the 8x1 matrix solution is the number of times needed to press each button to solve the puzzle. Unfortunately, in the real number space we get weird things like 0.33 button presses. This is because the linear algebra solution is designed to work in (0,1) integer space (see the WolframAlpha article for more details), and integer linear algebra is quite a bit harder than in the reals.

I solved this problem by first solving the system of equations in real space before making use of some side-steps to get back to a (0,1) matrix solution which tells which buttons need to be pressed. To do this, I first turned the decimal results from the real space solution into fractions before getting their denominators. Then I brought the fractions to a common factor and multiplied through to get integer solutions. This solution will return some buttons which need to be pressed twice, that is returned to their original state. So the final step is to take mod 2 on this matrix (while also rounding to get rid of some floating-point weirdness) to get only those buttons that need to be pressed an odd number of times.

The returned matrix will be a length 8 matrix corresponding to the buttons that need to be pressed, counting across then down from the top left first.

toa_puzzle_solver's People

Contributors

andrew-s28 avatar

Stargazers

 avatar Thomas King avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.