Solving the ‘8-puzzle’ using a basic AI algorithm

📰 Medium · Deep Learning

Learn to solve the 8-puzzle problem using a basic AI algorithm and understand the rules and techniques of heuristic search

intermediate Published 1 May 2026
Action Steps
  1. Define the 8-puzzle problem and its goal state
  2. Understand the rules of the game, including the movement of the empty space
  3. Choose a heuristic search algorithm, such as A* or greedy search
  4. Implement the algorithm to find the shortest path to the goal state
  5. Test and evaluate the algorithm's performance
  6. Visualize the solution using a graphical representation
Who Needs to Know This

AI engineers and data scientists can benefit from this lesson to improve their problem-solving skills and understanding of AI algorithms

Key Insight

💡 Heuristic search algorithms can be used to solve complex problems like the 8-puzzle by finding the shortest path to the goal state

Share This
🤖 Solve the 8-puzzle problem using a basic AI algorithm! 📝 Learn how to apply heuristic search techniques to find the shortest path to the goal state. #AI #ProblemSolving

Key Takeaways

Learn to solve the 8-puzzle problem using a basic AI algorithm and understand the rules and techniques of heuristic search

Full Article

Title: Solving the ‘8-puzzle’ using a basic AI algorithm

URL Source: https://medium.com/@grigalashvili.r1999/solving-the-8-puzzle-using-a-basic-ai-algorithm-94eb3cb3826a?source=rss------deep_learning-5

Published Time: 2026-05-01T12:45:00Z

Markdown Content:
# Solving the ‘8-puzzle’ using a basic AI algorithm | by Roma Grigalashvili | May, 2026 | Medium

[Sitemap](https://medium.com/sitemap/sitemap.xml)

[Open in app](https://play.google.com/store/apps/details?id=com.medium.reader&referrer=utm_source%3DmobileNavBar&source=post_page---top_nav_layout_nav-----------------------------------------)

Sign up

[Sign in](https://medium.com/m/signin?operation=login&redirect=https%3A%2F%2Fmedium.com%2F%40grigalashvili.r1999%2Fsolving-the-8-puzzle-using-a-basic-ai-algorithm-94eb3cb3826a&source=post_page---top_nav_layout_nav-----------------------global_nav------------------)

[](https://medium.com/?source=post_page---top_nav_layout_nav-----------------------------------------)

Get app

[Write](https://medium.com/m/signin?operation=register&redirect=https%3A%2F%2Fmedium.com%2Fnew-story&source=---top_nav_layout_nav-----------------------new_post_topnav------------------)

[Search](https://medium.com/search?source=post_page---top_nav_layout_nav-----------------------------------------)

Sign up

[Sign in](https://medium.com/m/signin?operation=login&redirect=https%3A%2F%2Fmedium.com%2F%40grigalashvili.r1999%2Fsolving-the-8-puzzle-using-a-basic-ai-algorithm-94eb3cb3826a&source=post_page---top_nav_layout_nav-----------------------global_nav------------------)

![Image 1](https://miro.medium.com/v2/resize:fill:32:32/1*dmbNkD5D-u45r44go_cf0g.png)

# Solving the ‘8-puzzle’ using a basic AI algorithm

[![Image 2: Roma Grigalashvili](https://miro.medium.com/v2/resize:fill:32:32/1*lgthpUh7tp-jKJ6oRnb1EA.jpeg)](https://medium.com/@grigalashvili.r1999?source=post_page---byline--94eb3cb3826a---------------------------------------)

[Roma Grigalashvili](https://medium.com/@grigalashvili.r1999?source=post_page---byline--94eb3cb3826a---------------------------------------)

Follow

8 min read

·

Just now

[](https://medium.com/m/signin?actionUrl=https%3A%2F%2Fmedium.com%2F_%2Fvote%2Fp%2F94eb3cb3826a&operation=register&redirect=https%3A%2F%2Fmedium.com%2F%40grigalashvili.r1999%2Fsolving-the-8-puzzle-using-a-basic-ai-algorithm-94eb3cb3826a&user=Roma+Grigalashvili&userId=307366939ab7&source=---header_actions--94eb3cb3826a---------------------clap_footer------------------)

[](https://medium.com/m/signin?actionUrl=https%3A%2F%2Fmedium.com%2F_%2Fbookmark%2Fp%2F94eb3cb3826a&operation=register&redirect=https%3A%2F%2Fmedium.com%2F%40grigalashvili.r1999%2Fsolving-the-8-puzzle-using-a-basic-ai-algorithm-94eb3cb3826a&source=---header_actions--94eb3cb3826a---------------------bookmark_footer------------------)

Share

**რას გულისხმობს “8-puzzle” პრობლემა.**

საწყის მდგომარეობაში(Initial State) მყოფი ფილები შეიძლება გადაადგილდეს ცარიელ სივრცეში კონკრეტული თანმიმდევრობით და ამით მიაღწიოს მიზნის მდგომარეობას(Goal State).

![Image 3](https://miro.medium.com/v2/1*SZzolLb25W9jrdN_Sjp9Yg.png)

### “8-puzzle” ამოხსნის წესები.

ცარიელ სივრცეში ფილების გადაადგილების ნაცვლად, ჩვენ შეგვიძლია ვიზუალურად წარმოვიდგინოთ ცარიელი სივრცის გადაადგილება შევსებული ფილის ადგილზე. ცარიელ სივრცეს შეუძლია გადაადგილება მხოლოდ ოთხი მიმართულებით, ანუ,

* **_ზევით_**
* **_ქვემოთ_**
* **_მარჯვნივ ან_**
* **_მარცხნივ_**

ცარიელი სივრცე ვერ მოძრაობს დიაგონალურად და შეუძლია გადადგას მხოლოდ ერთი ნაბიჯი (ანუ ცარიელი სივრცის გადაადგილება თითო პოზიციაზე).

![Image 4](https://miro.medium.com/v2/1*f_fzPB5InNDwdPloGKY6fw.png)

**განვიხილოთ ევრისტიკული ძიება.**

ძირითადად, არსებობს ორი სახის ძიების ტექნიკა:

* **არაინფორმირებული ძიება**
* **ინფორმირებული ძიება**

შესაძლოა გსმენიათ წრფივი ძებნის, ორობითი ძებნის, სიღრმეში ძიების ან სიგანეში პირველი ძიების შესახებ. ეს ძიების ალგორითმები მიეკუთვნება **არაინფორმირებული ძიების** ტექნიკის კატეგორიას, ანუ ამ ალგორითმებმა არაფერი იციან იმის შესახებ, თუ
Read full article → ← Back to Reads