Jump to content

Minimax algorithm AI connect 4

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
5 replies to this topic

#1
farzher

farzher

    Newbie

  • Members
  • Pip
  • 8 posts
I can't figure out how to implement this in java, i'm using a 2D array to store the board state. Can someone write some code on how to implement this with variable depth search and maybe alpha beta pruning.

I'm confused on how to write the max and min functions o_o

#2
farzher

farzher

    Newbie

  • Members
  • Pip
  • 8 posts
bump, any kind of connect 4 AI would be great. minimax just seemed to be the most popular. halp!

#3
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
Any move that leads to a forced loss would be a good option for pruning.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#4
farzher

farzher

    Newbie

  • Members
  • Pip
  • 8 posts
I gotta implement the basic algorithm before I can start pruning D:

#5
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
We aren't going to write code for you. You may have to post some of your code for comment. Recursion is pretty common for this type of thing.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#6
farzher

farzher

    Newbie

  • Members
  • Pip
  • 8 posts
I don't have any code to show, I have the heuristic function that returns the value of the board for the given player, and i'm storing the board as a 2D array. But besides that I have no AI code.