Skip to content

Commit

Permalink
doc: Add basic info
Browse files Browse the repository at this point in the history
  • Loading branch information
super7ramp committed Nov 28, 2024
1 parent 6406af5 commit c703ce4
Showing 1 changed file with 40 additions and 2 deletions.
42 changes: 40 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,42 @@
## eternity2-solver
# eternity2-solver

This is a solver for (reduced versions of) the [Eternity II](https://en.wikipedia.org/wiki/Eternity_II_puzzle)
This is a solver library for (reduced versions of) the [Eternity II](https://en.wikipedia.org/wiki/Eternity_II_puzzle)
puzzle. It is written in Java and uses a SAT solver ([Sat4j](http://www.sat4j.org/)).

## Installation

Add the following dependency to your `pom.xml`:

```xml
<dependency>
<groupId>re.belv</groupId>
<artifactId>eternity2-solver</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
```

## Usage

Here is an example of how to use the library:

```java
// The list of pieces (id, north color, east color, south color, west color).
final var pieces = new Piece[]{
new Piece(0, 0, 1, 2, 3),
new Piece(1, 0, 1, 2, 3),
new Piece(2, 0, 1, 2, 3),
new Piece(3, 0, 1, 2, 3),
};

// The board is a 2x2 grid. The bottom right piece is fixed.
final var initialBoard = new Piece[2][2];
initialBoard[1][1] = pieces[1].rotate(Piece.Rotation.PLUS_90);

// Instantiate the solver and solve the game.
final var solver = new Solver();
final Iterator<Piece[][]> solutions = solver.solve(pieces, initialBoard);
while(solutions.hasNext()){
final Piece[][] solution = solutions.next();
System.out.println(Arrays.deepToString(solution));
}
```

0 comments on commit c703ce4

Please sign in to comment.