PDA

View Full Version : Othello game ......with bugs...

Pal3rm02k
03-31-2003, 02:22 PM
I have this code for my game ,called Othello, but it doesn't work.
So i have 100 clips named: clip1,clip2....clip100.
Every clip has 3 frames:
1->normal
2->simbol 'x'
3->simbol '0'
A player finishes the game when it has 5 simbols in a row(ex 5 * 'x' ), up down, left ,right or diagonal.
I made a function to check if the game is finished but it doesn't seem to work and i can't understand why.

function neterminat (a, b) {
// sus jos
k = 0;
x = a;
y = b;
l = (a-1)*10+b;

var name2 = "clip"+l;
pc = this[""+name2].info;

while ((x>0) && (this[""+name2].info == pc)) {

k++;
x--;
l = (x-1)*10+y;
name2 = "clip"+l;

}
x = a+1;
l = (x-1)*10+y;
name2 = "clip"+l;
while ((x<11) && (this[""+name2].info == pc)) {

k++;
x++;
l = (x-1)*10+y;
name2 = "clip"+l;

}
x = a;

if (k == 5) {
return 0;
}
Note: this is just for up & down,but if i know what doesn't work , i'll finish all the function.
The function must return 0 if the game is finished ,or 1 else.
Every clip has 3 variables: pozx,pozy,info(for simbols 'x' or '0')

C`ya!!!

I hope someone knows what did i do wrong!!!