Created
November 6, 2010 15:30
-
-
Save onlyshk/665483 to your computer and use it in GitHub Desktop.
LOGIC
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
//*************************************************** | |
// x - down y right | |
//*************************************************** | |
// | |
int l3; | |
int l4; | |
l1 = 0; | |
l2 = 0; | |
l3 = 0; | |
l4 = 0; | |
x = 0; | |
y = 0; | |
s = 0; | |
x = (int)(e->y() / 40); | |
y = (int)(e->x() / 40); | |
if (x != 7 && y != 7) | |
{ | |
l1 = y; | |
l2 = y; | |
l3 = x; | |
l4 = x; | |
if (field[x][y] != field[x + 1][y + 1] && fields[x + 1][y + 1].checked) | |
{ | |
l1 = l1 + 1; | |
l3 = l3 + 1; | |
while (l1 != 8 && l3 != 8) | |
{ | |
if (field[l3][l1] == field[x][y]) | |
{ | |
s = l1; | |
break; | |
} | |
l1++; | |
l3++; | |
} | |
if (s != 0) | |
{ | |
while (l2 < s) | |
{ | |
l2++; | |
l4++; | |
field[l4][l2] = field[x][y]; | |
repaint(); | |
} | |
} | |
} | |
} | |
// | |
//*************************************************** | |
// x up - y left | |
//*************************************************** | |
// | |
l1 = 0; | |
l2 = 0; | |
l3 = 0; | |
l4 = 0; | |
x = 0; | |
y = 0; | |
s = 0; | |
x = (int)(e->y() / 40); | |
y = (int)(e->x() / 40); | |
if (x != 0 && y != 0) | |
{ | |
l1 = y; | |
l2 = y; | |
l3 = x; | |
l4 = x; | |
if (field[x][y] != field[x - 1][y - 1] && fields[x - 1][y - 1].checked) | |
{ | |
l1 = l1 - 1; | |
l3 = l3 - 1; | |
while (l1 != 0 && l3 != 0) | |
{ | |
if (field[l3][l1] == field[x][y]) | |
{ | |
s = l1 + 1; | |
break; | |
} | |
l1--; | |
l3--; | |
} | |
if (s != 0) | |
{ | |
while (l2 > s) | |
{ | |
l2--; | |
l4--; | |
field[l4][l2] = field[x][y]; | |
repaint(); | |
} | |
} | |
} | |
} | |
// | |
//*************************************************** | |
// x down - y left | |
//*************************************************** | |
// | |
l1 = 0; | |
l2 = 0; | |
l3 = 0; | |
l4 = 0; | |
x = 0; | |
y = 0; | |
s = 0; | |
x = (int)(e->y() / 40); | |
y = (int)(e->x() / 40); | |
if (x != 8 && y != 0) | |
{ | |
l1 = y; | |
l2 = y; | |
l3 = x; | |
l4 = x; | |
if (field[x][y] != field[x + 1][y - 1] && fields[x + 1][y - 1].checked) | |
{ | |
l1 = l1 - 1; | |
l3 = l3 + 1; | |
while (l1 != 0 && l3 < 8) | |
{ | |
if (field[l3][l1] == field[x][y]) | |
{ | |
s = l1 - 1; | |
break; | |
} | |
l1--; | |
l3++; | |
} | |
if (s != 0) | |
{ | |
while (l2 > s) | |
{ | |
l2--; | |
l4++; | |
field[l4][l2] = field[x][y]; | |
repaint(); | |
} | |
} | |
} | |
} | |
// // | |
// //*************************************************** | |
// // x up - y right | |
// //*************************************************** | |
// // | |
// l1 = 0; | |
// l2 = 0; | |
// l3 = 0; | |
// l4 = 0; | |
// x = 0; | |
// y = 0; | |
// s = 0; | |
// x = (int)(e->y() / 40); | |
// y = (int)(e->x() / 40); | |
// if (x != 0 && y != 7) | |
// { | |
// l1 = y; | |
// l2 = y; | |
// l3 = x; | |
// l4 = x; | |
// if (field[x][y] != field[x - 1][y + 1] && fields[x - 1][y + 1].checked) | |
// { | |
// l1 = l1 + 1; | |
// l3 = l3 - 1; | |
// while (l1 < 8 && l3 != 0) | |
// { | |
// if (field[l3][l1] == field[x][y]) | |
// { | |
// s = l1 - 1; | |
// break; | |
// } | |
// l1++; | |
// l3--; | |
// } | |
// if (s != 0) | |
// { | |
// while (l2 < s) | |
// { | |
// l2++; | |
// l4--; | |
// field[l4][l2] = field[x][y]; | |
// repaint(); | |
// } | |
// } | |
// } | |
// } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment