# Tag Info

Accepted

### Solve 8-tile sliding puzzle

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

### Logic for shuffling sliding puzzle

Object-oriented design There is more data being passed around than should be necessary with an object-oriented design. You have ran (a ...
• 144k
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. ...
• 23.8k

### 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 ...
• 55.6k
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
Accepted

### SlidingNumberTile Program Efficiency

Boolean comparisons Instead of: if (isBoardSolved(pB, truths) == true) { ... } else if (isBoardSolved(pB, truths) == false) { ... } The natural way to write is:...
• 111k

### 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

### Sliding tile puzzle

self documenting code: ...
• 95.1k

### Logic for shuffling sliding puzzle

(Disclaimer: I'm not a Java-expert). Moving the tile You intentionally left this one as a black box, to keep it out of scope, I think, but I'd still like to comment. ...
• 3,594
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

### 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

### 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.6k
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

### 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

### 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: ...
• 75.1k
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.7k
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.7k

### 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.2k
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,247
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,277

### 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.6k