game time!

Status
Not open for further replies.

AtlasDreams

Wise, Aged Ars Veteran
119
It's the end of the semester for my APCS AB class, and were having a connect 4 tournament! the person's code who r0x0rz the most opposing code is deemed the winner. Anyway...
I have this great idea. Im gonna make a binary tree structure, but it aint binary baby, its....septary? well its got 7 children instead of 2 (7 columns on the board). What i wanted to do is calculate every move possible, and find the best path. Im gonna make it so it doesnt have to search everywhere, but rather finds the best path, and reassigns the "root" node accordingly (so im not doing millions of calculations....20 moves, 7^20th i believe). Is this plausible? PLEASE NO SPOILERS! i want to do this on my own, i dont want ideas, i just want to know if it is plausible. Thanks!
-Atlas
 

Iconoplast

Ars Scholae Palatinae
1,040
Probably not the most plausible thing in the world. People tried doing trees for checkers and chess without much luck (the trees get really big) for computer AI. It turns out that's not how the best chess players do it anyway. It's mostly from experience and gaining a good understanding about which paths through the tree of all potential moves yield the best results. Definitely not a quick project you can throw together for CS class.
 
I know that you don't want any spoilers, but your aren't exploring anything entirely new. To me it sounds like you are doing a minimax search with some sort of alpha-beta pruning. You may be thinking of something slightly different, but very similar.

I know Iconoplast said that this type of search is very innefficent and they are correct. I recently (last week) hacked out some lisp code to play reversi/othello using the above stated algorithm and it was horribly slow (taking into account that interpreted or even compiled lisp on a 233 is going to suck anyhow). In my case I was only looking 3 moves ahead (ie my move, their move, my move). And I did this in approximately 20 hours of coding (for a language I'm unfamiliar with and I had to write the code to play the game too, no writing just the player), so it is certainly doable from that respect.

In any case I think your idea is just fine. You may not have the most efficient, or complicated ai, but it will certainly work given enough time (and assuming you have proper evaluation of board states and the algorithm is sound :)). Have fun with it!

gen
 

wb

Ars Legatus Legionis
25,208
Subscriptor
Is this plausible? PLEASE NO SPOILERS! i want to do this on my own, i dont want ideas, i just want to know if it is plausible. Thanks!

It is plausible, and a fairly common technique for that kind of game. Try the same thing for tic-tac-toe first, and you'll have an easier time understanding the implementation issues, and adapting your code to other games.
 
Status
Not open for further replies.