Skip to content

NStefan002/15puzzle.nvim

Repository files navigation

15 Puzzle

Implementation of the classic 15 Puzzle game for Neovim.

📺 Showcase

15puzzle_showcase.mp4

🖼️ Gallery

Preview themes

15P_theme1

15P_theme2

15P_theme3

15P_theme4

15P_theme5

🗞️ 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:

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

packer:

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

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
  • <c-l> - next theme
  • <c-h> - previous theme
  • <CR> - confirm in menus
  • <Esc> - cancel in menus

NOTE:

You can change the default mappings and some additional settings.
require("15puzzle").setup({
    keys = {
        up = "k",
        down = "j",
        left = "h",
        right = "l",
        new_game = "n",
        confirm = "<CR>",
        cancel = "<Esc>",
        next_theme = "<c-l>",
        prev_theme = "<c-h>",
        solve = "s",
    },
    -- additional settings

    solver_time_limit = 7000,
})