English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Without checking every square in the board matrix?

2006-12-28 02:51:16 · 3 answers · asked by Anonymous in Computers & Internet Programming & Design

3 answers

A win will occur after a player has made a move (dropped a checker). Check the last dropped checker and determine if it causes a win (four in a row). Do this after each turn and you will never need to check the entire board matrix.

2006-12-28 03:34:40 · answer #1 · answered by bayou64 4 · 0 0

you can keep track of each person's selections in two seperate matrices where each slot is 0 or 1 depending on whether it has a chip in it....keep a running sum of each column and row as chips are placed, i.e. if a chip was placed at 1, 3 then row 1 and column 3 would both be incremented by one...whenever a row or column equals four you can check to see if they are consecutive...technically that counts as not checking the entire matrix.....if that doesn't work for you then maybe some kind of Matrix transformation math will do the trick....

2006-12-28 12:01:40 · answer #2 · answered by Anonymous · 0 0

To see four of the same color in a row...it shouldn't be that hard to spot with a glance at the board.

2006-12-28 02:54:02 · answer #3 · answered by gnomus12 6 · 0 1

fedest.com, questions and answers