Need some help with a school project

Hey guys so i’m coding a Connect 4 game for a school project. (Last year of high school)

I would really love to implement some kind of AI so the computer can play with the player. I’ve already done an AI for a tictacto by just using if and else if for each possible combination. However i feel this would extremely too long to code for a 7*6 connect 4 game.

I found that the Minimax algorithm can be used for solving connect 4 :

But its in c++ and i only know BASIC with xojo.

If you guys could help me out i would appreciate it so much. I’m a visual person so if you could screenshot a piece of code it would really help me understand.

Thanks in advance!

Home work assignments are not something the volunteers usually do for someone… what we can/will do is help you with mistakes you may make… but this means making an effort to do your work on your own and show us that your at least tried.

And for the record… an If/Then/Else based AI is not the way to approach this problem.

yes i know, i’m not asking for someone to do it for me. I’m asking for some help understanding the minimax algorithm and how i could implement it.

I said if/else if is not the way to approach this problem there are way too many possibilities.

So, you know the alogrithm you want to use… show us how you attempted to implement it.
Its in “C”, and I would say “so what”… do some research, compare what you see in “C” to what you know in Xojo,
ask pointed questions… and above all else “Learn Things”… remember the Information Technology world is much broader than just Xojo, and the more you know, the more marketable you will be…

Okay, thanks for your advice Dave. I will do some more research on the algorithm and how to implement it.

One more question for you:

For the interface of the program I would like to make it all in one canvas. I looked online for some object oriented tutorials on xojo. I couldn’t find any that explained how to get started and they were all very dated. If you could point me in the right direction on how to draw the game area that would be greatly appreciated.

There’s a blog post about making a simple game in Xojo on a Canvas:

It covers object oriented drawing, and has some examples and videos (which are great for visual learners!)

Thanks so much Tim!

You can find also a lot of information on the following two links about AI :

Artificial Intelligence in Games Part 1

Artificial Intelligence in Games part 2

It isn’t Xojo but they cover everything you have to know about AI in games. Xojo is not really a game development tool, Construct is. That is the reason you will find more information at the Scirra forum than here.

If you visit the Scirra website, you will see what I mean. The example game Tim Parnell gave, is very very basic, too basic, not AI at all.

Hope this helps.