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

Filter by
Sorted by
Tagged with
3
votes
1answer
101 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
0answers
159 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&...
2
votes
1answer
216 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 : ...
3
votes
2answers
201 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....
4
votes
1answer
1k 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' ...
5
votes
1answer
235 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 ...
5
votes
2answers
260 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 ...
2
votes
1answer
232 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 ...
4
votes
1answer
2k 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 ...
4
votes
0answers
88 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 "...
3
votes
1answer
1k 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 ...
7
votes
1answer
2k 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 ...
3
votes
1answer
73 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 ...
5
votes
2answers
7k 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 ...
5
votes
1answer
342 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: ...
3
votes
1answer
176 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 ...
1
vote
0answers
214 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 ...
3
votes
2answers
510 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 ...
3
votes
3answers
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 ...
9
votes
1answer
7k 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 ...
1
vote
0answers
91 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 ...
4
votes
0answers
4k 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 ...
2
votes
1answer
11k 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: ...
4
votes
1answer
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 ...
4
votes
0answers
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 ...
4
votes
1answer
1k 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 ...
2
votes
3answers
480 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 ...
3
votes
1answer
341 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 ...
6
votes
2answers
303 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 ...
6
votes
1answer
2k 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 ...
6
votes
2answers
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? <...
3
votes
1answer
104 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 ...
5
votes
1answer
279 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 ...
6
votes
1answer
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 ...
10
votes
1answer
175 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. ...
8
votes
3answers
10k 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 ...
6
votes
1answer
629 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
0answers
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,...
4
votes
1answer
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 ...
8
votes
3answers
221 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 ...
7
votes
2answers
638 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 ...
4
votes
1answer
4k 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 ...
2
votes
1answer
8k views

DFS and BFS search for 8-puzzle

I implemented the DFS and BFS. Please offer improvements. ...
6
votes
1answer
88 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
2answers
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 ...
3
votes
3answers
1k 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 <...
4
votes
1answer
437 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? ...
4
votes
1answer
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 ...
5
votes
1answer
185 views

Comparing puzzle solvers in Java

I have this program that solves a \$(n^2 - 1)\$-puzzles for general \$n\$. I have three solvers: BidirectionalBFSPathFinder ...
4
votes
2answers
13k views

8-Puzzle using A* and Manhattan Distance

I have developed this 8-puzzle solver using A* with manhattan distance. Appreciate if you can help/guide me regarding: 1. Improving the readability and optimization of the code. 2. I am using sort to ...