Skip to content

๐Ÿ•น๏ธ Welcome to Game-Optimization, a repository dedicated to exploring and implementing various optimization algorithms to solve complex games. This project initially focuses on solving the classic game Sokoban using the Q-learning algorithm, with plans to extend to genetic algorithms and other optimization techniques in the future.

Notifications You must be signed in to change notification settings

Mhijazi16/Game-Optimization

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

70 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

AI-GameOptimization

๐Ÿ“‹ Table of Contents

๐Ÿ•น๏ธ Introduction

Welcome to the AI-GameOptimization repository! This project explores the use of optimization algorithms to solve complex games. Currently, it focuses on solving the Sokoban game using Q-learning, with plans to extend to genetic algorithms and other optimization techniques in the future.

๐Ÿซ Showcase

Player Mode

player

Training

train3

Solving

level2

level3

โœจ Features

Q-Learning Implementation: An AI agent that learns to solve Sokoban puzzles through reinforcement learning. State Management: Efficient representation and management of game states. Deadlock Detection: Mechanisms to detect and avoid deadlocks in the game. Training and Evaluation: Tools to train the AI agent and evaluate its performance.

๐Ÿ’ป Installation

To get started, clone the repository and compile the code using a C++ compiler.

git clone https://github.com/Mhijazi16/AI-GameOptimization.git
cd AI-GameOptimization

Make sure you have a C++ compiler installed. You can use g++ for compilation:

g++ -o game main.cpp

๐Ÿš€ Usage

Initialize the Game: Run the compiled executable to start the game.

./game

Select Level: Enter the level number you wish to play when prompted.

Train the AI: Enter the number of episodes to train the AI agent.

Solve the Game: The AI agent will attempt to solve the game using the trained Q-table. Follow the prompts to see the AI's progress.

๐Ÿ“ Project Structure

main.cpp: The main entry point for the application. Point.h: Defines the Point structure and related operations. Context.h: Contains constants and configurations for the game. State.h: Defines the State structure and methods for managing game states. Helper.h: Includes helper functions for initializing the game, applying moves, generating child states, and implementing the Q-learning algorithm.

๐Ÿ—บ๏ธ Game Levels

Level 1
Episodes to solve : 5
๐Ÿชต๐Ÿชต๐Ÿชต๐Ÿชต๐Ÿชต๐Ÿชต
๐Ÿชต        ๐Ÿชต
๐Ÿชต        ๐Ÿชต
๐Ÿชต      ๐Ÿงบ๐Ÿชต
๐Ÿชต๐Ÿชต๐Ÿชต๐Ÿชต  ๐Ÿชต
๐Ÿชต๐Ÿ—      ๐Ÿชต
๐Ÿชต๐Ÿงบ      ๐Ÿชต
๐Ÿชต      ๐Ÿ—๐Ÿชต
๐Ÿชต๐Ÿชต๐Ÿชต๐Ÿชต๐Ÿชต๐Ÿชต
Level 2
Episodes to solve : 40
โ›บโ›บโ›บโ›บโ›บโ›บโ›บโ›บโ›บโ›บโ›บโ›บโ›บโ›บโ›บ
โ›บ              ๐ŸŽช    ๐ŸŽช    โ›บ
โ›บ          ๐Ÿซ™     ๐Ÿ– ๐ŸŽช    โ›บ
โ›บ  ๐Ÿซ™๐ŸŽช        ๐ŸŽช    ๐ŸŽช    โ›บ
โ›บ  ๐Ÿ–๐ŸŽช        ๐ŸŽช          โ›บ
โ›บ    ๐ŸŽช              ๐Ÿซ™    โ›บ
โ›บ    ๐ŸŽช        ๐ŸŽช    ๐ŸŽช  ๐Ÿ–โ›บ
โ›บโ›บโ›บโ›บโ›บโ›บโ›บโ›บโ›บโ›บโ›บโ›บโ›บโ›บโ›บ
Level 3
Episodes to solve : 110
                  ๐Ÿ—ฟ๐Ÿ—ฟ๐Ÿ—ฟ        
๐Ÿ—ฟ๐Ÿ—ฟ๐Ÿ—ฟ๐Ÿ—ฟ๐Ÿ—ฟ๐Ÿ—ฟ    ๐Ÿ—ฟ๐Ÿ—ฟ  ๐Ÿ—ฟ๐Ÿ—ฟ๐Ÿ—ฟ๐Ÿ—ฟ๐Ÿ—ฟ
๐Ÿ—ฟ        ๐Ÿ—ฟ๐Ÿ—ฟ๐Ÿ—ฟ๐Ÿ—ฟ          ๐Ÿฅฉ๐Ÿ—ฟ
๐Ÿ—ฟ    ๐Ÿ›’  ๐Ÿฅฉ          ๐Ÿ—ฟ๐Ÿ—ฟ๐Ÿ—ฟ๐Ÿ—ฟ๐Ÿ—ฟ
๐Ÿ—ฟ  ๐Ÿ—ฟ    ๐Ÿ—ฟ๐Ÿ—ฟ๐Ÿ—ฟ    ๐Ÿ›’๐Ÿ—ฟ        
๐Ÿ—ฟ  ๐Ÿ—ฟ๐Ÿ—ฟ  ๐Ÿ—ฟ  ๐Ÿ—ฟ      ๐Ÿ—ฟ        
๐Ÿ—ฟ๐Ÿ›’      ๐Ÿ—ฟ๐Ÿ—ฟ๐Ÿ—ฟ      ๐Ÿ—ฟ๐Ÿ—ฟ๐Ÿ—ฟ    
๐Ÿ—ฟ๐Ÿฅฉ          ๐Ÿ›’        ๐Ÿฅฉ๐Ÿ—ฟ    
๐Ÿ—ฟ๐Ÿ—ฟ๐Ÿ—ฟ๐Ÿ—ฟ๐Ÿ—ฟ๐Ÿ—ฟ๐Ÿ—ฟ๐Ÿ—ฟ๐Ÿ—ฟ๐Ÿ—ฟ๐Ÿ—ฟ๐Ÿ—ฟ๐Ÿ—ฟ๐Ÿ—ฟ   

๐Ÿค Contributing

Contributions are welcome! If you have suggestions for improvements or new features, please create an issue or submit a pull request. Follow these steps to contribute:

Fork the repository. Create a new branch (git checkout -b feature-branch). Make your changes. Commit your changes (git commit -m 'Add some feature'). Push to the branch (git push origin feature-branch). Open a pull request.

About

๐Ÿ•น๏ธ Welcome to Game-Optimization, a repository dedicated to exploring and implementing various optimization algorithms to solve complex games. This project initially focuses on solving the classic game Sokoban using the Q-learning algorithm, with plans to extend to genetic algorithms and other optimization techniques in the future.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published