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
2
votes
1answer
90 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
27 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
182 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 ...
5
votes
1answer
63 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
58 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 ...
4
votes
2answers
214 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 ...
2
votes
0answers
74 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
120 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
124 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 ...
2
votes
2answers
203 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
647 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
3k 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
75 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
429 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
5k 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
668 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
514 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
744 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 ...
3
votes
3answers
334 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
198 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
293 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
1k 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
1k 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
94 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
130 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
3k 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
142 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. ...
7
votes
3answers
5k 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
456 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
2k 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
154 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
327 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
2k 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
7k views

DFS and BFS search for 8-puzzle

I implemented the DFS and BFS. Please offer improvements. ...
6
votes
1answer
76 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
6k 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
375 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
166 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 ...
3
votes
1answer
7k 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 ...
4
votes
2answers
2k views

My 15 puzzle solver is too slow

It takes my code over 700 seconds to solve simple puzzle: 2 7 11 5 13 0 9 4 14 1 8 6 10 3 12 15 My function ...
6
votes
1answer
1k views

jQuery Plugin - Sliding Tile Puzzle

I created a basic jQuery plugin to make a basic sliding tile puzzle. ...
7
votes
4answers
19k views

Python 8-Puzzle and solver

I wrote a simple 8-Puzzle and solver and am interested in seeing how it might be improved. Please let me know if any style or design changes might enhance the readability/performance of my code. <...
13
votes
1answer
7k views

Solving 15 puzzle

I'm trying to solve 15 puzzle using A* algorithm, but something really bad goes on in my get_solution() function that ruins performance. I guess there is a too much ...
3
votes
2answers
5k views

Sliding block puzzle, A*

I'm a beginner programmer and I'm hoping someone would be willing to take a look at my code and tell me how to improve my coding style and development approach. Sorry about not commenting, I will try ...
3
votes
1answer
3k views

Simple exercice representing a slidepuzzle

I've been helping out a student with an exercice, typed this up rapidly and thought it would be the ideal opportunity to improve my own programming style and approach to problem solving. In this ...