VasilisG / 8-puzzle-Python-bot

This is a Python bot that solves the 8 puzzle problems of the http://mypuzzle.org/sliding website.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

8-puzzle-Python-bot

This is a Python bot that solves the 8 puzzle problem using the A* algorithm. Specifically, it is designed to solve puzzles generated by the puzzle game of the mypuzzle.org website.

Before we start coding the bot, we must first get a screenshot of the game area. Once we get it, we convert it to black and white so that our bot will have a much smaller range of colors to compare between image tiles. Finally, we crop each tile representing a number of the puzzle and store it. That will help us in making comparisons among image tiles and creating a 2D array representing our problem.

After using the A* algorithm and finding a solution for our problem, we use automated mouse clicks to swap tiles in puzzle and achieve our final state.

The bot was created using version 3.4.2 of Python.

The specific Python bot uses:

  1. The Python Imaging Library (PIL) for screenshots, color conversions and image comparisons.
  2. The pyautogui module in order to simulate mouse clicks.

About

This is a Python bot that solves the 8 puzzle problems of the http://mypuzzle.org/sliding website.


Languages

Language:Python 100.0%