The MDP Game is an interactive implementation of a grid-based Markov Decision Process (MDP). MDPs are widely used in Artificial Intelligence, especially in decision-making and reinforcement learning, making them a cornerstone concept in AI research and applications.. The game enables users to create a custom grid, assign rewards to specific cells, and visualize the optimal path determined by the value iteration algorithm. This project is built using HTML, CSS, and JavaScript.
- Dynamic Grid Creation: Customize the grid dimensions (rows and columns).
- Adjustable Parameters:
- Discount Factor (γ): Controls the weight of future rewards.
- Transition Probability: Specifies the likelihood of the intended action being executed.
- Value Iteration Algorithm: Computes optimal policies and value functions.
- Interactive Reward Editing: Modify rewards for specific cells directly on the grid.
- Visualization:
- Display cell values and optimal policies.
- Track iterations with a history table.
- Clone the repository:
git clone https://github.com/yourusername/mdp-game.git
- Navigate to the project directory:
cd mdp-game - Open
index.htmlin any modern web browser to run the game.
Open this link: https://prateekg93.github.io/MDP-Game/
No additional dependencies or installations are required. Just ensure a browser supports modern HTML5 and JavaScript features.
- Open the game in a browser.
- Set the grid dimensions (rows and columns) using the controls.
- Adjust the discount factor (γ) and transition probability sliders as needed.
- Click Create Grid to generate the grid.
- Modify rewards:
- Click on any cell to open the reward editor.
- Enter a new reward value and save.
- Click Start Value Iteration to begin the algorithm:
- Observe the values and policies updating in real-time.
- Track the history of iterations in the table below the grid.
- Reset values or restart the process anytime using the provided buttons.
- Start Cell: The starting point of the agent is indicated with the label "START" and a black background.
- Rewards:
- Positive values represent rewards (e.g., goals).
- Negative values represent penalties (e.g., obstacles).
- Zero values represent neutral states.
- Optimal Policy: Displayed with directional arrows (→, ←, ↑, ↓) indicating the best action for each cell.
- index.html: The main HTML structure.
- style.css: Styling and visual design.
- script.js: Core logic for grid generation, value iteration, and user interactions.
Contributions are welcome! Feel free to fork the repository and submit pull requests.
This project is licensed under the MIT License. See the LICENSE file for details.
Prateek Goswami
Here are examples of the game in action:

