General Documentation - Gecko05/GaussAlchemy GitHub Wiki

Description

Goal

  • The goal is to solve the matrix on each level according to the expected output without running out of energy. This means one should try to optimize their movements as much as possible.
  • Each swap and transmutation action costs 1 energy unit from either the swap or transmutation gauges.

Win condition

Make the workspace matrix equal to the expected matrix.

Lose condition

The gauges run out of energy.

Everything is divided under thre main categories:

  • Drawing
  • Logic/Updating
  • Initialization

Matrices

  • There are two matrices. The first one is the workspace matrix where all operations are performed.
  • The second matrix is the expected matrix and it is smaller than the workspace matrix.
  • Both matrices are tables in Lua, that hold row objects. Each row objects holds a reference to a table which contains the gems.

Gems

  • The gems are the basic units of which the game is based around. Each one represents an integer number from -2 to 2. There exist only 5 gems, and the possible operations are limited to simple arithmetic sums with a limit to how negative or positive a gem can get.
  • A gem cannot go below, nor rotate from -2 to 2, and viceversa.

Rows

  • A row contains three gems inside a table reference called as gems.
  • Rows have thre possible operations, in an analogous representation to Gauss Jordan elimination.
    • Transmutation: This represents the ability for the solver to multiply a row by a scalar.
    • Addition: This represents the addition and subtraction of one row to another row. It is also possible to transmute the row while it's in the addition zone.
    • Swapping: As in Gauss Jordan, the solver can swap the rows.
  • Workspace rows objects hold reference to:
    • Origin row number
    • Table with gems
    • State of the row
    • Number of the row
  • Additionally rows must be in the same order as they're listed to be by their row number member. This is repeated information and needs refactoring.
  • There is a special type of row called miniRow and it's used to represent the expected matrix. It is a simpler version of the workspace Row but with less members. This needs refactoring into inheritance maybe.