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

📰 Medium · AI

Solve the 8-puzzle problem using a basic AI algorithm and understand the rules and techniques involved

intermediate Published 1 May 2026
Action Steps
  1. Define the 8-puzzle problem and its rules
  2. Understand the concept of heuristic search and its application to the 8-puzzle problem
  3. Implement a basic AI algorithm such as Breadth-First Search (BFS) or Depth-First Search (DFS) to solve the 8-puzzle problem
  4. Use a heuristic function to guide the search and improve the efficiency of the algorithm
  5. Test and evaluate the performance of the algorithm using different initial states and goal states
Who Needs to Know This

This micro-lesson is beneficial for AI engineers, data scientists, and software engineers who want to learn about basic AI algorithms and problem-solving techniques. It can be applied to various projects that involve puzzle-solving or pathfinding

Key Insight

💡 Heuristic search is a powerful technique for solving complex problems like the 8-puzzle, and using a basic AI algorithm like BFS or DFS can provide an efficient solution

Share This
Solve the 8-puzzle problem using a basic AI algorithm! Learn about heuristic search and implement BFS or DFS to find the solution #AI #PuzzleSolving #HeuristicSearch

Key Takeaways

Solve the 8-puzzle problem using a basic AI algorithm and understand the rules and techniques involved

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