This project is an implementation of AI-based agents
- VaccuumBot - A simple reflex agent
- NimBot - A rational agent utilizing minimax algorithm
The environment consists of 2 blocks: A and B which can hold the status of Clean or Dirty.
The agent is a vacuum bot which decides its action based on the status of the location:
- If the location is Dirty, the agent cleans the location
- If the location is Clean, the agent moves randomly in any direction
If the bot hits a wall, it remains in the same location, else it moves to the other block.
Each action is considered as a time step. A performance measure of the agent, the number of cleaned locations is measured upon each time step.
After a lifetime of 1000 timesteps, the agent is terminated and the performance is measured.
This simulation is repeated on all possible configurations to understand the performance of the agent.
The state space graph is shown below:
![State Space Graph](./images/q1_statespacegraph.png "State Space Graph")
Configurations from the simulation run are shown below:
![Configurations](./images/ss_q1_output.png "Configurations")
Run the script using python .\q1_simplex_reflex_agent_simulation.py
The simulations will run and report will be generated for the test runs
The simulation call can also be modified to accomodate changes to lifetime and to show action report for each timestep
The game space consists of 2 piles of stones, each having a equal number of stones initially.
The game rules are as follows:
- A player can remove any number of stones from any pile.
- The player who has to remove the last stone loses the game
The agent is a Nim bot which decides its action based on the number of stones in the piles using the minimax algorithm.
An evaluation score is decided based on who won the game.
A map is computed from the game that the bot plays with another bot, created using the minimax algorithm with the initial evaluation score on the leaf nodes.
The bot is then able to play the game against the humans or other bots using the map.
The winning map after training over the minimax is as follows:
The output of the bot vs bot game played is shown below:
The output of the Human vs bot game 1 played is shown below:
The output of the bot vs bot game 2 played is shown below:
Run the script using python .\q2.py_nim_minimax.py
Decide if a human wants to play with the bot or not
A game will be initiated and a coin toss decides who goes first
A sequence of inputs for pile no. and number of stones will be requested on the console for input
The game tree will be displayed after every move
Winning will be declared when the stack reaches [0, 0] or if the bot concedes(No giving up for the user!!)