Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/nstefan002/15puzzle.nvim

Classic 15 puzzle for Neovim.
https://github.com/nstefan002/15puzzle.nvim

game lua neovim neovim-plugin plugin puzzle-game

Last synced: 2 days ago
JSON representation

Classic 15 puzzle for Neovim.

Awesome Lists containing this project

README

        

# 15 Puzzle

> Implementation of the classic `15 Puzzle` game for Neovim.

## 📺 Showcase

https://github.com/NStefan002/15puzzle.nvim/assets/100767853/d613555a-b603-490f-b24a-cb8ef89246a3

### 🖼️ Gallery

Preview themes

![15P_theme1](https://github.com/NStefan002/15puzzle.nvim/assets/100767853/2e12ef24-7e22-49b5-b32e-d8cccece3295)

![15P_theme2](https://github.com/NStefan002/15puzzle.nvim/assets/100767853/25c94aa8-5e83-407f-b2f7-6b6d48fa05f2)

![15P_theme3](https://github.com/NStefan002/15puzzle.nvim/assets/100767853/cb1f738f-45be-4b42-bbad-958b80782780)

![15P_theme4](https://github.com/NStefan002/15puzzle.nvim/assets/100767853/996cdbd8-5006-41a9-b8bc-0c7bbc2e340d)

![15P_theme5](https://github.com/NStefan002/15puzzle.nvim/assets/100767853/3c0acfd1-06e3-4644-92b1-103907c37ce8)

## 🗞️ News

* **[26/03/2024]** A puzzle solver is now available. Press `s` (or the key you mapped to `solve`) and the solver will try to find
the **best** possible solution to the current puzzle state. If the solver does not find the solution in the
given time (see `solver_time_limit` option) it will exit and let you continue the game. However, if it finds
the solution quickly enough, it will start the animation that shows you the best moves to the solution.

## 📋 Installation

[lazy](https://github.com/folke/lazy.nvim):

```lua
{
"NStefan002/15puzzle.nvim",
cmd = "Play15puzzle",
config = true,
}
```

[packer](https://github.com/wbthomason/packer.nvim):

```lua
use({
"NStefan002/15puzzle.nvim",
config = function()
require("15puzzle").setup()
end,
})
```

[rocks.nvim](https://github.com/nvim-neorocks/rocks.nvim)

`:Rocks install 15puzzle.nvim`

## ❓ How to Play

1. `:Play15puzzle`
2. Use the `h`, `j`, `k`, `l` to slide the squares in the desired direction.
3. Place each square in its correct place.
4. Try to solve the puzzle in the fewest moves and as fast as possible.

## 🎮 Controls

- `h` - move the squares to the left
- `j` - move the squares down
- `k` - move the squares up
- `l` - move the squares to the right
- `n` - new game
- `s` - activate the puzzle solver
- `` - next theme
- `` - previous theme
- `` - confirm in menus
- `` - cancel in menus

**NOTE:**

You can change the default mappings and some additional settings.

```lua
require("15puzzle").setup({
keys = {
up = "k",
down = "j",
left = "h",
right = "l",
new_game = "n",
confirm = "",
cancel = "",
next_theme = "",
prev_theme = "",
solve = "s",
},
-- additional settings

solver_time_limit = 7000,
})
```