You are browsing as a guest. Sign up (or log in) to start making projects!

Open comments for this post

2h 32m 3s logged

Implementation of Minimax:

Hey everyone, As you know i was trying to build computer vs player,

i tried to build the algorithm minimax but failed miserably last time so prepared myself and built the computer vs player so lets talk about what problems i faced during the build.

What Bugs i Faced ?

  • The Rage-Quitting AI: Once the AI stopped cheating, it started giving up entirely. I had a bug where I forgot to tell the Minimax algorithm what a “Draw” was. Because it didn’t know how to return a 0 for a tie, it assumed a full board was the worst possible outcome in the universe. If I trapped the AI in a fork where it knew it couldn’t win, it would literally skip its turn and refuse to play! I had to build a fallback block to force it to accept its fate.
  • Over writing issue: there was a time where i made a system where a player couldn’t overwrite ai but AI could and when i saw that it broke me and even after fixing the bug the same error kept coming cause it was stupit of me who didn’t save the new edition.
  • The Silent Fails: At one point, I tried to implement Player vs. Player mode, but when it was Player 2’s turn, the game would just print the board twice and loop back to Player 1. I had completely forgotten to write the scanf input logic for the second player! The code was just reaching that block.
  • Over powered AI: Now one mistake i made and don’t want anyone to repeat is to put a controller over AI so that you can realistically beat AI or u will be lost everytime and even if u try hard it will be draw at max.

What to fix

  • THE Controller for AI: as i said before i want to implement a difficulty system to reduce the power of AI.
  • Improving the interface: i want to improve the interface to make it more fun.
    Thanks for Reading,
    Happy coding :)
0

Comments 0

No comments yet. Be the first!