LearnProgramming / percival

An IRC bot designed to help the LPMCers track quotes, log channels, and all sorts of things
22 stars 8 forks source link

Connect Four game #18

Open colwem opened 12 years ago

colwem commented 12 years ago

I was inspired by LPMC's tic tac toe game and created a connect four game.

repo

It's not really connected to the bot yet. But you can play against the machine by runing irb and

ruby require './connect_four.rb' cf = ConnectFour.new cf.next_step([column number indexed from zero of the move you want to make])



It is slow as hell.  It does a depth first search of all possible boards 4 moves away and does a board evaluation.  that's 7^4 or 2401 board evaluations and it doesn't do a good job either.  lots of room for improvement.
yash3ahuja commented 12 years ago

I don't think you committed anything. Additionally, are you using minimax? I don't imagine minimax would take so long that you would describe it as "slow as hell." It's slow, but not that slow.

colwem commented 12 years ago

Yeah I think that's what you call it. And no it shouldn't be that slow. Yet it is very slow so I'm messing something up. I'm pretty sure I know of a few places where I can improve it I'm just not that great at ruby so it would be nice if someone took a look.

Yeah I guess I didn't commit it. It's committed now

colwem commented 12 years ago

Well it's working pretty well now. Only missing feature is the tope of the game. there is no checking for hitting the top of the board. There are also no tests. But I don't think they make any sense anymore since I don't envision future development on it and I don't really know how to test that an AI plays well other than to play against it (It kicks my but right now).