As of May 31, 2023, we have updated our Code of Conduct.

# Questions tagged [sliding-tile-puzzle]

A puzzle, usually consisting of 8 tiles on a 3 × 3 grid or 15 tiles on a 4 × 4 grid, in which the tiles need to be rearranged into a winning configuration by sliding into the void square

57 questions
Filter by
Sorted by
Tagged with
590 views

### Simple N Puzzle console game

I am completely new to object oriented programing (OOP). I have also never worked with C# before. The exercise from my book had some requirements that should be ...
• 163
280 views

### 15 Puzzle in Pygame

This is a 15 puzzle implemented in pygame. The tiles can be moved with the arrow keys or by clicking and dragging the mouse. Parts of the code that require extra like icons and sound effects files ...
1 vote
512 views

### Linear conflicts heuristic for 15 puzzle game

I'm trying to solve the 15 Puzzle problem using IDA* algorithm with a Linear Conflicts heuristic. I already implemented the heuristic from what I understood : link Here's my goal state ("snail&...
• 181
542 views

### How can I speed up my IDA* algorithm for N-puzzle?

I'm trying to solve the N-Puzzle problem using IDA* algorithm with a Manhattan heuristic. I already implemented the algorithm from the pseudocode in this Wikipedia page (link). Here's my code so far : ...
• 181
235 views

### Solving 15Puzzle with Julia

Asking here instead of SO as suggested. I'm trying to use Julia to solve the common tile game 15 Puzzle using Julia using A* algorithm. I am quite new to the language and my style may seem very C like....
2k views

### programmed 15 puzzle in java

This is my code for a 15 puzzle. The basic gist is to get a grid of equal width and height (size) and number them in ascending order, with the exception of the last square getting a 0 value ('0' ...
332 views

### State space search for sliding tile puzzle

I am working on state space search (8 Puzzle) in Python and when I run my program with python3 -m profile, I find out that most of time program performs a few ...
• 203
387 views

### Optimize depth-first search for sliding tile puzzle

My current code implementing a depth-first search works well for puzzle 1. But my code is too slow; I think I use too many loops and I am not sure I am using the right data structure. So I have a ...
441 views

### Python Turtle implementation of the 15 Puzzle

Please can I have some feedback on my Python Turtle implementation of the 15 Puzzle? I have deliberately avoided using OOP as my aim is to develop a clear and clean coding style suitable for teaching ...
3k views

### (Leetcode) Sliding puzzle in Python

This is a Leetcode problem: On a 2 x 3 board, there are 5 tiles represented by the integers 1 through ...
• 2,468
111 views

### Animation loop for a sliding puzzle game

I'm building a "sliding puzzle" game. This is the animation code for when you click a Tile. This "loop" function is running all the time. When you click a tile, if it's available to move, I set the "...
• 335
2k views

### N-puzzle solver using A* search

I have written a Java program to solve a N-puzzle with A* search and manhattan distance. My program can solve every 8-puzzle I have tested under 1 second, but it can't solve a 15-puzzle after 30 ...
• 585
3k views

### 15 Puzzle Game JavaScript

I have created a program that lets you play the fifteen puzzle game. You have to get the blocks into ascending order by moving them into the one open space. I would like some feedback on the code and ...
• 551
78 views

### n-puzzle in Clojurescript

I'm in the process of creating a n-puzzle solver in Clojurescript. I have the basic model up and running and can move tiles on the screen. I plan to implement A* or such an algorithm to solve a given ...
• 235
8k views

### Optimizing the code for 8-puzzle in Python

I am new to programming and I am trying to solve the 8-puzzle using brute force algorithm. The code works for very simple puzzle configuration but freaks out when the even a modest puzzle is input to ...
399 views

### Command line sliding tile puzzle in C++

I have rolled a simple program for controlling a sliding tile puzzle via command line. I would like to hear comments on how to make it more idiomatic C++17 and efficient. Here is my code: ...
• 26.7k
214 views

### A* search on 4x4 sliding tile puzzle scales poorly

I am trying to improve the time complexity of my A* search algorithm and I have tried approaching this from every which way I believe is possible. I believe I may be doing something fundamentally ...
• 131
1 vote
238 views

### Bidirectional iterative deepening pathfinding algorithm in Java

Introduction I have this iterative deepening search algorithm. The main "research" attempt was to find out a bidirectional version of that search, and it turned out to be superior compared to two ...
• 26.7k
583 views

### Npuzzle solver using A* with Manhattan + Linear Conflict (Updated Code)

Here is the old thread that I started out with. The code I've got now is vastly different thanks to those two. What I have now functions fairly well and looks pretty good. I've managed to work it back ...
• 97
2k views

### N-puzzle solver using A* with Manhattan + Linear Conflict

I've been working on this solution for a couple days now. Finally managed to get it to work and I got it to where it solves about half of the time. The other half goes for so long that it eventually ...
• 97
9k views

### Solve 8-tile sliding puzzle

I created a BFS algorithm in order to solve an 8-puzzle, and while it works, it is awfully slow compared to my DFS implementation. My main point of concern is the puzzleExists() function, which ...
• 93
1 vote
97 views

### Performance concerns when solving sliding-tile-puzzle via A* algorithm

I have implemented n-puzzle solving in Clojure using A-star algorithm. The following code, when used like this: (solve [0 1 2 3 4 0 6 7 5 8] 3) would return ...
• 235
6k views

### Make DFS Implementation faster for 8 puzzle problem in Python

I am implementing DFS algorithm for the 8 puzzle problem which works fine if the goal is reached in less than 10 iterations. But for longer number of iterations, my implementation doesn't return the ...
• 41
14k views

### A* implementation of 8 puzzle

I'm trying to implement 8 puzzle problem using A Star algorithm. The goal state is: 0 1 2 3 4 5 6 7 8 and the heuristic used is Manhattan distance. Here's the code: ...
1k views

### Slider puzzle solver for short solutions

This is a solution to a community puzzle from CodinGame. Input for the program: 1st line: Two integers, height and width of the grid. Next lines: The given slider puzzle grid consisting of ...
• 444
1k views

### Minimum number of moves to solve "game of fifteen"

I read about this game and tried to make my own algorithm to solve this. I asked it on StackOverflow for the appropriate algorithm and logic to solve this problem. With the help of answers over ...
2k views

### Slow 8/15-puzzle IDA*

I am trying to find the optimal solution for a given 15-puzzle. So far as I can tell, the algorithm works (on simple instances of 8-puzzle), but is extremely slow for complex starting states (order of ...
525 views

### For finding whether a puzzle state is solvable

I have code which returns whether or not a sliding tile puzzle state is solvable. I was wondering whether there is any way I could either make the code a bit more readable or increase the performance ...
• 349
413 views

### C++ 8-Sliding Puzzle Solver is very slow

I have made a sliding puzzle solver which is currently for 8-puzzles only. It works too slowly even though it is based on an A* algorithm whose f-score is calculated on the basis of Manhattan Distance ...
• 329
307 views

### A function that moves a tile in the game of fifteen

I've created a a function that will move a tile that a user specifies within the game board. The game board can be from 3*3 up to 9*9 and is filled with values 1 to d - 1. This function is called ...
3k views

### Breadth First Search for a Slider Puzzle Solver

I plan to implement a few other solvers (depth first search, A*, etc), hence why I'm using the abstract base class (which is new to me). I'm using Python 3.6, so you'll see f-string literals. I would ...
• 161
2k views

### First HTML5 Canvas Game Puzzle 15

This is my first game made using canvas, currently it works well but I know my JavaScript could be better as I am still learning. What improvements can I make on the structure of my JavaScript? <...
115 views

### Storing configurations of states to a database - Breadth First Search

I have wrote some code to store all possible configurations of a set of numbers in the sliding tile puzzle but the process of doing slow is very slow. Say, for instance, I have a sliding tile puzzle ...
361 views

### Finding all neighbours of a node sliding tile

So I have some code which finds neighbours of a given State. So the positions the blank tile (which is represented as 0 in my code) can be moved. I am doing the 3x3 tile puzzle. The goal state is ...
• 349
4k views

### Sliding puzzle game of fifteen

I've made the Game of Fifteen in Unity this is how it looks : The code is rather short there's one class for the pieces and one for the game logic : MovablePiece : MonoBehaviour ...
• 8,438
233 views

### Game of 15 - A* search

I would be really thankful for review of this homework. I'm trying to write better code in terms of readability and design patterns. This program solves the classic 15 slider puzzle with A* search. ...
• 103
11k views

### 8puzzle solver using A*

That's gonna take long. This program solves 8 puzzle game (mini version of 15 puzzle) using A* algorithm. Program consists of 2 parts: Board.java - which serves ...
747 views

### SDL2 Game of Fifteen / Sliding Puzzle

I have made a simple sliding puzzle/game of fifteen using SDL. I originally attempted this to learn about game states, but it turned into a general exercise in code organisation and SDL use. Therefore,...
1 vote
1k views

### Solving 15-puzzle algorithm using IDA* or A*

I am currently using the BestFirst algorithm to solve the puzzle 15. It works well when I have a simple inputs and takes about 1-20 seconds to solve the puzzle. But when it comes to complicated inputs,...
• 11
3k views

### Manhattan Distance + Linear Conflicts scoring function for sliding tile puzzle solver

I have written yet another n-puzzle solver. I used the A* algorithm to search with the Manhattan Distance heuristic. It worked very well for the 9-puzzle (3x3) but was unusable for most instances of ...
• 409
255 views

### Revised - Game of Fifteen

This is a revised version of a previous post. I attempted to address each aspect of the feedback provided. The key changes are as follows: Replace the deprecated ...
• 847
832 views

### Game of Fifteen - A Sliding Puzzle Game

Update: I addressed the changes and created an updated post. I'm reviewing C by working through the edX CS50 problem sets. This task was to implement Game of Fifteen aka 15 Puzzle. Project details ...
• 847
5k views

### Sliding tiles solver in Python

I've implemented the sliding blocks puzzle in Python to solve it using different algorithms. I'd like to know if the class "Sliding_blocks" is nicely designed or if I am missing concepts of OOP. I ...
• 143
9k views

### DFS and BFS search for 8-puzzle

I implemented the DFS and BFS. Please offer improvements. ...
• 23
92 views

### SlidingNumberTile Program Efficiency

I created a Sliding Number Tile Game, and am looking for input on how to make the code better organized & more efficient. ...
1 vote
7k views

### Logic for shuffling sliding puzzle

I'm working on a sliding puzzle, one little project as a hobby, and yesterday I thought that instead of working on an algorithm to figure out a solved puzzle, it would be easier to make an algorithm ...
2k views

### Sliding tile puzzle

I'm making a sliding tile puzzle using C++, and have code that exchanges the blank tile for one adjacent to it. Using user input, the program takes the input and puts it in the function which uses a <...
443 views

### Simple 8 Puzzle - ASCII - follow up

Based on the previous question, I have implemented all suggestions with slight modifications. The game seems fine, are there any further improvements needed in this game? ...
• 3,268
3k views

### Simple 8 Puzzle - ASCII

I made a simple 8 puzzle which is 3x3 grids unsorted. The user has to move only one number at any direction, which is next to an empty tile. If the user sorted numbers, he/she wins the game, otherwise ...
• 3,268
I have this program that solves a $(n^2 - 1)$-puzzles for general $n$. I have three solvers: BidirectionalBFSPathFinder ...