Improving a Search Heuristic for symmetric number-board game

In summary: This technique can save time and effort by focusing on moves that are more likely to lead to a solution.
  • #1
Shaitan00
18
0
Board (4x3)
A B C D
E F G H
I J K L

You have 11 chips [1,1,1,1], [2,2,2,2], [3,3], [4] (for example) placed randomly on the 4x3 board in slots A,...,L and one empty slot (that moves) that we'll call X, the movements are done similarly to the 8-puzzle game where X (empty) can move either up/down/left/right.

The Goal is to ensure that the top row and bottom row are symmetric (middle row is irrelevant) - so the following would be valid solutions:
1 1 2 2
3 3 4 X
1 1 2 2
or
1 1 2 3
X 2 4 2
1 1 2 3
As you can see in both cases the TOP and BOTTOM rows are symmetric (identical)...

So - just to help understand the game a little - assume you have the following flow from initial state to goal state:
STATE(0)
3 3 1 1
4 2 1 2
3 3 1 X
--> Move LEFT

STATE(1)
3 3 1 1
4 2 1 2
3 3 X 1
--> Move UP

STATE(2)
3 3 1 1
4 2 X 2
3 3 1 1
! GOAL !

Therefore - my problem is to find out what is the BEST MOVE (up, down, left, right) to make.
Assume you are at STATE(0) in the example above, where do you move X to get the best result thus leading you closer to a GOAL? X could be moved UP or LEFT (two options) so why pick one over the other? The solution is to evaluate the two possible outcomes and pick the better one ... this is the part where I need help, the EVALUATION algorithm needed to choose the next best move.

My current method works rather well but not well enough to win first place (I think - needs to be under 3-seconds to solve puzzle) - I call it "Number of non-Symmetric Pairs" and it works as follows:
- For each state calculate the number of non-symmetric pairs and make the move that gives you the lowest number
- If you have equal lowest-numbers then choose one at random

Let me illustrate - for starters this would be the value for the states listed in the example above:
STATE(0) = 1 (as the 4th pair isn't symmetrical)
STATE(1) = 1 (as the 3rd pair isn't symmetrical)
STATE(2) = 0 (as all pairs are symmetrical)

Where this works - assume we are at STATE(1), we have 3 choices: LEFT, UP, RIGHT - which would each yield the following values:
STATE(1)->LEFT = 2
STATE(1)->UP = 0
STATE(1)->RIGHT = 1
Therefore the lowest number is 0 and we should move UP because that will generates less non-symmetrical pairs (and lucky for us in this case it is also the goal).

Where this doesn't work so well - assume we are at STATE(0), we have 2 choices: LEFT, UP - which would each yield the following values:
STATE(0)->UP = 1
STATE(0)->LEFT = 1
As you can see the values are identical, so in this case I cannot determine which move is best so I must try both routes, which in turns costs me a lot of time I was hoping I wouldn't have to waste.


With that said - I am looking to find a more "informed" (efficient, intelligent) function/algorithm to help me solve my problem quicker and in less moves which therefore yields a more favorable results.
Along the same lines I am trying to see if there is another or better way to evaluate how close one move is to a goal when compared to another...

Any ideas, hints, help you might come up with would be much appreciated.
Note that the cells could have words, colors, numbers - this was just an example to help illustrate how it works.

Thanks,
 
Physics news on Phys.org
  • #2
One potential solution is to use heuristics. Heuristics are AI techniques that can assess the "goodness" of a possible move, based on factors such as the number of pieces already in the correct place, the number of pieces that need to be moved to reach the goal, and the distance each piece needs to be moved. This information can then be used to determine which move is most likely to get you closer to the goal. For example, if some pieces are already in the correct position and only a few pieces need to be moved, then a move that moves these pieces closer to their final destination would be more beneficial than a move that does not. Additionally, if many pieces need to be moved, then a move that moves multiple pieces closer to their final destination would be more beneficial than a move that only moves one piece closer.
 

1. What is a search heuristic?

A search heuristic is a problem-solving technique that involves using a set of rules or guidelines to guide the search for a solution. It is typically used in situations where a complete search of all possible solutions is not feasible or practical.

2. What is a symmetric number-board game?

A symmetric number-board game is a type of game that involves a board with numbered squares and a set of rules for moving pieces or tokens on the board. The goal of the game is usually to reach a specific number or pattern on the board, and the game is considered symmetric if both players have the same starting positions and moves available to them.

3. Why is improving a search heuristic important for symmetric number-board games?

Improving a search heuristic for symmetric number-board games is important because it can help players find better and more efficient solutions to win the game. It can also help to make the game more challenging and enjoyable, as players will have to think more strategically and creatively to win.

4. What are some common techniques for improving a search heuristic?

Some common techniques for improving a search heuristic include pruning, which involves eliminating certain branches of the search tree that are unlikely to lead to a solution; alpha-beta pruning, which is a more advanced form of pruning that takes into account the values of different moves; and heuristic evaluation, which involves assigning values to different board positions to guide the search.

5. How can a search heuristic be evaluated for effectiveness?

A search heuristic can be evaluated for effectiveness by comparing its performance to other search heuristics on the same problem, or by comparing it to a known optimal solution. Other factors that can be considered include the time and memory required to find a solution, as well as the quality of the solution found. It is also important to consider the complexity of the problem and the resources available when evaluating the effectiveness of a search heuristic.

Similar threads

  • Calculus and Beyond Homework Help
Replies
29
Views
1K
  • Calculus and Beyond Homework Help
Replies
10
Views
447
Replies
9
Views
716
  • Calculus and Beyond Homework Help
Replies
2
Views
391
  • Calculus and Beyond Homework Help
Replies
3
Views
287
  • Calculus and Beyond Homework Help
Replies
2
Views
1K
  • Calculus and Beyond Homework Help
Replies
2
Views
1K
  • Calculus and Beyond Homework Help
Replies
5
Views
698
  • Calculus and Beyond Homework Help
Replies
1
Views
259
  • Calculus and Beyond Homework Help
Replies
12
Views
785
Back
Top