# Tag Info

Accepted

### Solve 8-tile sliding puzzle

Here's the code you want to speed up: ...
• 19.4k
Accepted

### Game of Fifteen - A Sliding Puzzle Game

The GOOD, there are no MAGIC numbers, good job! The naming conventions of the constants and enums follow the current coding standards. The code is quite readable which suggests it is maintainable. ...
• 24k

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

Don't put implementation in header files You moved all of your code into header files. That's not what they are for. It is better to have only the declarations of the classes and functions in the .h ...
• 58.3k
Accepted

### Simple N Puzzle console game

I think you're real close to the ask of the problem. I have two main bits for you to change up: Your Tile class has no way of setting the tile value. Change so ...
• 13.9k

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

You're doing the same mistake that everyone who posts that their A* is slow is doing. You're using the wrong data structure for your open and closed structure. The closed should be a set, usually ...
• 16.6k
Accepted

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

Initial thoughts: Why optimize your code when there are 362 880 possibilities, the best way to optimize is to reduce the number of possibilities. The complexity here is O(n²!) meaning that it quickly ...
• 799
Accepted

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

As suggested in this answer, storing the board as a one-dimensional array would make the logic much simpler. For one thing, the location of the space could be represented as a single ...
• 144k

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

Reading past array bounds Each of your four checks has the possibility of reading past array bounds. Very bad things can happen when that happens. I will illustrate with an example: Let ...
• 28.5k
Accepted

### Game of 15 - A* search

I'll focus on the readability part of your code: Don't import modules you're not using. (import itertools) Don't import modules in the middle of your code. All the ...
• 9,046
Accepted

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

Prefer interfaces to implementations public static ArrayList<State> findNeighbours(State currentState) { Consider ...
• 21.6k
Accepted

### Sliding tiles solver in Python

Whether the code is well designed or not -- is hard to tell without using it. But I have several points: It's good that you have small functions/methods which do one thing and do well. It's good that ...
• 337
Accepted

### Revised - Game of Fifteen

Functions that do not modify the referenced data should be made const to indicate that in fact, the code does not change things. It also allows some optimizations, ...

### Game of Fifteen - A Sliding Puzzle Game

Bug - Valid Move Your valid_move method has this comment in it. ...
• 11.7k
Accepted

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

Bugs: A lot of memory is allocated (foo = new Container) and never deallocated (delete foo). N-puzzle implementations usually ...
• 11.8k

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

Platform-dependent code There's no need to bring in <Windows.h> - with a couple of small changes, this can be portable C++, accessible to everyone: ...
• 77.1k
Accepted

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

Good job refactoring. It looks much neater without the globals / Manager class. Good effort with cleaning up allocated memory, but we can do better (see below). The ...
• 11.8k

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

Here are a couple of points: You need to move your documentation and your comments into docstrings: ...
• 12.4k
Accepted

### N-puzzle solver using A* search

Advice 1: l_moves The name l_moves is ain't good at all. Consider numberOfMoves. Since it ...
• 28.7k
Accepted

### State space search for sliding tile puzzle

The initial approach definitely has a number of "bottlenecks" and space for optimizations. Let me present and explain the crucial points: starting with good naming: don't give Python identifiers/...
• 5,257
Accepted

### Solving 15Puzzle with Julia

That was a fun exercise to work on! I completely refactored the code; the basic complexity issue Marc mentions still holds. I recommend this blog post for the cartesian indexing tricks. ...
• 433

### Simple N Puzzle console game

I have a few scattered observations. Your Tile.Value is a field rather than a property. If using a public access modifier, you ...
• 6,360

### Revised - Game of Fifteen

I like the improvements you've made, so I've only got a few mostly cosmetic points: I don't like dim as a variable name. I think it's probably a hangover from ...
• 11.7k

### Revised - Game of Fifteen

More helper function Maybe the following piece of logic (in a least 4 places): game->board[get_row(i, game->dim)][get_col(i, game->dim)] could be ...
• 29.2k

### SDL2 Game of Fifteen / Sliding Puzzle

Overall it is good quality. I only have these complaints: ...
• 156

### 8puzzle solver using A*

Your A* is incorrectly implemented You are using the total number of moves explored as the priority for each search node. See here: ...
• 16.6k

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

Here are some suggestions that may help you improve your code. Be careful with signed and unsigned In a few places, the code compares an int ...
• 66.5k
Accepted

### 15 Puzzle Game JavaScript

Foreword Your code is quite decent. However, I did make a general outline of how I would probably implement a Board to improve readability. Don't feel the need to ...
• 421