Re: A89: question about connect-4


[Prev][Next][Index][Thread]

Re: A89: question about connect-4




>And do I keep doing this about 200 times or do i break it into sections?
For
>example only check a certain category according to where the chip was placed 
>ie:
>if chip is placed in column 1 then check columns 1-4
>if chip is placed in column 2 then check columns 1-5
>if chip is placed in column 3 then check columns 1-6
>if chip is placed in column 4 then check columns 1-7
>if chip is placed in column 5 then check columns 2-8
>if chip is placed in column 6 then check columns 3-8
>if chip is placed in column 7 then check columns 4-8
>if chip is placed in column 8 then check columns 5-8
>
>but does it really matter if i check everything all at once rather than
>checking only certain columns???  Would it take less mem to check different
>column rather than checking everything???   I know it would be faster
checking
>the columns but does it really need to be FAST???  Wouldn't it still be
PLENTY
>fast if i just check everything...i mean it won't slow everything down
>right???

Here is what I would do:

After each piece is dropped, check how many pieces of the same color lie on
either side of it, below it, above it, and two all four diagonals.  I would
make functions to check each.  Then add the two directions together (up +
down, left + right...) and if any of those sums are greater then three then
the game is over.  Checking every possible row will be slow, it also will
make a large program that is hard to debug.

	--Nate


References: