author | zecke <zecke> | 2004-04-30 13:27:34 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-04-30 13:27:34 (UTC) |
commit | b313bfcc63e972b1dfe059d91fe364d535478c7c (patch) (unidiff) | |
tree | 36c52526da889598133698cb7c914fbe134c9594 | |
parent | 7829ac6b0577bf2398110f327a4b5e40435c105b (diff) | |
download | opie-b313bfcc63e972b1dfe059d91fe364d535478c7c.zip opie-b313bfcc63e972b1dfe059d91fe364d535478c7c.tar.gz opie-b313bfcc63e972b1dfe059d91fe364d535478c7c.tar.bz2 |
some long outstanding 'freeze' bug..
having a function pause(){} conflicts with linux version of pause. So instead
of doing nothing... we were forced to pause(2)
-rw-r--r-- | noncore/games/go/goplayutils.c | 2 | ||||
-rw-r--r-- | noncore/games/go/killable.c | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/noncore/games/go/goplayutils.c b/noncore/games/go/goplayutils.c index 9e2ce4c..91c6db2 100644 --- a/noncore/games/go/goplayutils.c +++ b/noncore/games/go/goplayutils.c | |||
@@ -855,129 +855,129 @@ short gx, gy, *savex, *savey; | |||
855 | { | 855 | { |
856 | spanGroup(gList[aList.v[i]].lx, gList[aList.v[i]].ly, | 856 | spanGroup(gList[aList.v[i]].lx, gList[aList.v[i]].ly, |
857 | &pList1); /* find it's liberty */ | 857 | &pList1); /* find it's liberty */ |
858 | plist3.indx = plist3.indx + 1; | 858 | plist3.indx = plist3.indx + 1; |
859 | plist3.p[plist3.indx].px = pList1.p[1].px; | 859 | plist3.p[plist3.indx].px = pList1.p[1].px; |
860 | plist3.p[plist3.indx].py = pList1.p[1].py; | 860 | plist3.p[plist3.indx].py = pList1.p[1].py; |
861 | } | 861 | } |
862 | } | 862 | } |
863 | for (i = 1; i <= maxSPoint; i++) | 863 | for (i = 1; i <= maxSPoint; i++) |
864 | libList[i] = -1; | 864 | libList[i] = -1; |
865 | if ((utilPlayLevel > 4) && | 865 | if ((utilPlayLevel > 4) && |
866 | (gList[gMap[groupIDs[gx][gy]]].libC > 1)) /* account for diags */ | 866 | (gList[gMap[groupIDs[gx][gy]]].libC > 1)) /* account for diags */ |
867 | { | 867 | { |
868 | listDiags(gx, gy, &dList); | 868 | listDiags(gx, gy, &dList); |
869 | j = 0; | 869 | j = 0; |
870 | i = plist3.indx; | 870 | i = plist3.indx; |
871 | while ((j < dList.indx) && | 871 | while ((j < dList.indx) && |
872 | (i < maxSPoint)) | 872 | (i < maxSPoint)) |
873 | { | 873 | { |
874 | j = j + 1; | 874 | j = j + 1; |
875 | i = i + 1; | 875 | i = i + 1; |
876 | libList[i] = 100; | 876 | libList[i] = 100; |
877 | plist3.p[i].px = dList.p[j].px; | 877 | plist3.p[i].px = dList.p[j].px; |
878 | plist3.p[i].py = dList.p[j].py; | 878 | plist3.p[i].py = dList.p[j].py; |
879 | } | 879 | } |
880 | plist3.indx = i; | 880 | plist3.indx = i; |
881 | } | 881 | } |
882 | if (plist3.indx > 1) /* sort by decreasing lib count */ | 882 | if (plist3.indx > 1) /* sort by decreasing lib count */ |
883 | { | 883 | { |
884 | for (i = 1; i <= plist3.indx; i++) | 884 | for (i = 1; i <= plist3.indx; i++) |
885 | if (libList[i] != 100) | 885 | if (libList[i] != 100) |
886 | { | 886 | { |
887 | mark2 = playMark; | 887 | mark2 = playMark; |
888 | tryPlay(plist3.p[i].px, plist3.p[i].py, me); | 888 | tryPlay(plist3.p[i].px, plist3.p[i].py, me); |
889 | libList[i] = gList[gMap[groupIDs[gx][gy]]].libC; | 889 | libList[i] = gList[gMap[groupIDs[gx][gy]]].libC; |
890 | if (libList[i] > treeLibLim) /* i'm safe */ | 890 | if (libList[i] > treeLibLim) /* i'm safe */ |
891 | { | 891 | { |
892 | *savex = plist3.p[i].px; | 892 | *savex = plist3.p[i].px; |
893 | *savey = plist3.p[i].py; | 893 | *savey = plist3.p[i].py; |
894 | result = TRUE; | 894 | result = TRUE; |
895 | goto one; | 895 | goto one; |
896 | } | 896 | } |
897 | undoTo(mark2); | 897 | undoTo(mark2); |
898 | } | 898 | } |
899 | for (i = 1; i <= plist3.indx - 1; i++) | 899 | for (i = 1; i <= plist3.indx - 1; i++) |
900 | for (j = i + 1; j <= plist3.indx; j++) | 900 | for (j = i + 1; j <= plist3.indx; j++) |
901 | if (libList[i] < libList[j]) | 901 | if (libList[i] < libList[j]) |
902 | { | 902 | { |
903 | tl = libList[i]; | 903 | tl = libList[i]; |
904 | libList[i] = libList[j]; | 904 | libList[i] = libList[j]; |
905 | libList[j] = tl; | 905 | libList[j] = tl; |
906 | tp = plist3.p[i]; | 906 | tp = plist3.p[i]; |
907 | plist3.p[i] = plist3.p[j]; | 907 | plist3.p[i] = plist3.p[j]; |
908 | plist3.p[j] = tp; | 908 | plist3.p[j] = tp; |
909 | } | 909 | } |
910 | } | 910 | } |
911 | for (i = 1; i <= plist3.indx; i++) | 911 | for (i = 1; i <= plist3.indx; i++) |
912 | { | 912 | { |
913 | *savex = plist3.p[i].px; | 913 | *savex = plist3.p[i].px; |
914 | *savey = plist3.p[i].py; | 914 | *savey = plist3.p[i].py; |
915 | if (legal[*savex][*savey]) | 915 | if (legal[*savex][*savey]) |
916 | { | 916 | { |
917 | smark = playMark; | 917 | smark = playMark; |
918 | tryPlay(*savex, *savey, me); | 918 | tryPlay(*savex, *savey, me); |
919 | pause(); | 919 | //pause(); |
920 | if (gList[gMap[groupIDs[*savex][*savey]]].libC > 1) | 920 | if (gList[gMap[groupIDs[*savex][*savey]]].libC > 1) |
921 | if (gList[gMap[groupIDs[gx][gy]]].libC > treeLibLim) | 921 | if (gList[gMap[groupIDs[gx][gy]]].libC > treeLibLim) |
922 | { | 922 | { |
923 | restoreState(); | 923 | restoreState(); |
924 | /* sClearChar(sChar, rXor); */ | 924 | /* sClearChar(sChar, rXor); */ |
925 | return TRUE; | 925 | return TRUE; |
926 | } | 926 | } |
927 | else if (gList[gMap[groupIDs[gx][gy]]].libC > 1) | 927 | else if (gList[gMap[groupIDs[gx][gy]]].libC > 1) |
928 | if (! killable(gx, gy, &gx1, &gx2)) | 928 | if (! killable(gx, gy, &gx1, &gx2)) |
929 | { | 929 | { |
930 | restoreState(); | 930 | restoreState(); |
931 | /* sClearChar(sChar, rXor); */ | 931 | /* sClearChar(sChar, rXor); */ |
932 | return TRUE; | 932 | return TRUE; |
933 | } | 933 | } |
934 | undoTo(smark); | 934 | undoTo(smark); |
935 | } | 935 | } |
936 | } | 936 | } |
937 | result = FALSE; | 937 | result = FALSE; |
938 | one: | 938 | one: |
939 | restoreState(); | 939 | restoreState(); |
940 | /* sClearChar(sChar, rXor); */ | 940 | /* sClearChar(sChar, rXor); */ |
941 | return result; | 941 | return result; |
942 | } /* saveable */ | 942 | } /* saveable */ |
943 | 943 | ||
944 | /* | 944 | /* |
945 | marks unsavable groups as dead | 945 | marks unsavable groups as dead |
946 | */ | 946 | */ |
947 | markDead() | 947 | markDead() |
948 | { /* markDead */ | 948 | { /* markDead */ |
949 | short i, j, gx, gy, result; | 949 | short i, j, gx, gy, result; |
950 | #ifdef DEBUG | 950 | #ifdef DEBUG |
951 | printf( "markDead\n" ); | 951 | printf( "markDead\n" ); |
952 | #endif | 952 | #endif |
953 | for (i = 1; i <= maxGroupID; i++) | 953 | for (i = 1; i <= maxGroupID; i++) |
954 | if (killable(gList[i].lx, gList[i].ly, &gx, &gy)) | 954 | if (killable(gList[i].lx, gList[i].ly, &gx, &gy)) |
955 | result = ! saveable(gList[i].lx, gList[i].ly, &gx, &gy); | 955 | result = ! saveable(gList[i].lx, gList[i].ly, &gx, &gy); |
956 | else | 956 | else |
957 | result = FALSE; | 957 | result = FALSE; |
958 | for (i = 0; i <= maxPoint; i++) | 958 | for (i = 0; i <= maxPoint; i++) |
959 | for (j = 0; j <= maxPoint; j++) | 959 | for (j = 0; j <= maxPoint; j++) |
960 | if (bord[i][j] == 0) | 960 | if (bord[i][j] == 0) |
961 | ndbord[i][j] = 0; | 961 | ndbord[i][j] = 0; |
962 | else if (gList[groupIDs[i][j]].isDead) | 962 | else if (gList[groupIDs[i][j]].isDead) |
963 | ndbord[i][j] = 0; | 963 | ndbord[i][j] = 0; |
964 | else | 964 | else |
965 | ndbord[i][j] = bord[i][j]; | 965 | ndbord[i][j] = bord[i][j]; |
966 | } /* markDead */ | 966 | } /* markDead */ |
967 | 967 | ||
968 | /* | 968 | /* |
969 | marks groups with two eyes as live | 969 | marks groups with two eyes as live |
970 | */ | 970 | */ |
971 | MLspan(x, y, saw1, sawm1, size, sMark) | 971 | MLspan(x, y, saw1, sawm1, size, sMark) |
972 | short x, y, *saw1, *sawm1, *size, sMark; | 972 | short x, y, *saw1, *sawm1, *size, sMark; |
973 | { /* span */ | 973 | { /* span */ |
974 | if (ndbord[x][y] == 1) | 974 | if (ndbord[x][y] == 1) |
975 | *saw1 = TRUE; | 975 | *saw1 = TRUE; |
976 | else if (ndbord[x][y] == -1) | 976 | else if (ndbord[x][y] == -1) |
977 | *sawm1 = TRUE; | 977 | *sawm1 = TRUE; |
978 | else if (sGroups[x][y] == 0) | 978 | else if (sGroups[x][y] == 0) |
979 | { | 979 | { |
980 | sGroups[x][y] = sMark; | 980 | sGroups[x][y] = sMark; |
981 | *size = *size + 1; | 981 | *size = *size + 1; |
982 | if (x > 0) | 982 | if (x > 0) |
983 | MLspan(x - 1, y, saw1, sawm1, size, sMark); | 983 | MLspan(x - 1, y, saw1, sawm1, size, sMark); |
diff --git a/noncore/games/go/killable.c b/noncore/games/go/killable.c index 3ed2d2e..23a133d 100644 --- a/noncore/games/go/killable.c +++ b/noncore/games/go/killable.c | |||
@@ -1,219 +1,219 @@ | |||
1 | /* By Stoney Ballard */ | 1 | /* By Stoney Ballard */ |
2 | /* Ported from Pascal to C by Todd R. Johnson */ | 2 | /* Ported from Pascal to C by Todd R. Johnson */ |
3 | 3 | ||
4 | #include "go.h" | 4 | #include "go.h" |
5 | #include "goplayutils.h" | 5 | #include "goplayutils.h" |
6 | #include "amigo.h" | 6 | #include "amigo.h" |
7 | 7 | ||
8 | extern intBoard bord, groupIDs; | 8 | extern intBoard bord, groupIDs; |
9 | extern boolBoard legal; | 9 | extern boolBoard legal; |
10 | extern groupRec gList[maxGroup]; | 10 | extern groupRec gList[maxGroup]; |
11 | extern short gMap[maxGroup], adjInAtari, adj2Libs, playMark, treeLibLim, | 11 | extern short gMap[maxGroup], adjInAtari, adj2Libs, playMark, treeLibLim, |
12 | utilPlayLevel, killFlag, depthLimit, dbStop, showTrees; | 12 | utilPlayLevel, killFlag, depthLimit, dbStop, showTrees; |
13 | extern pointList plist2; | 13 | extern pointList plist2; |
14 | 14 | ||
15 | /* | 15 | /* |
16 | returns true if the group (at x, y) is killable. | 16 | returns true if the group (at x, y) is killable. |
17 | if so, returns the point to play at in killx, killy. | 17 | if so, returns the point to play at in killx, killy. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | short me, him, depth, i, j, tryCount, tl, topMark, tkMark, mark2; | 20 | short me, him, depth, i, j, tryCount, tl, topMark, tkMark, mark2; |
21 | char sChar; | 21 | char sChar; |
22 | sPointList lList, dList; | 22 | sPointList lList, dList; |
23 | point tp; | 23 | point tp; |
24 | short libList[maxSPoint+1]; | 24 | short libList[maxSPoint+1]; |
25 | short esc; | 25 | short esc; |
26 | 26 | ||
27 | short mtNbrs(x, y) | 27 | short mtNbrs(x, y) |
28 | short x, y; | 28 | short x, y; |
29 | { /* mtNbrs */ | 29 | { /* mtNbrs */ |
30 | short n = 0; | 30 | short n = 0; |
31 | if ((x > 0) && (bord[x - 1][y] == 0)) | 31 | if ((x > 0) && (bord[x - 1][y] == 0)) |
32 | n = n + 1; | 32 | n = n + 1; |
33 | if ((x < maxPoint) && (bord[x + 1][y] == 0)) | 33 | if ((x < maxPoint) && (bord[x + 1][y] == 0)) |
34 | n = n + 1; | 34 | n = n + 1; |
35 | if ((y > 0) && (bord[x][y - 1] == 0)) | 35 | if ((y > 0) && (bord[x][y - 1] == 0)) |
36 | n = n + 1; | 36 | n = n + 1; |
37 | if ((y < maxPoint) && (bord[x][y + 1] == 0)) | 37 | if ((y < maxPoint) && (bord[x][y + 1] == 0)) |
38 | n = n + 1; | 38 | n = n + 1; |
39 | return n; | 39 | return n; |
40 | } /* mtNbrs */ | 40 | } /* mtNbrs */ |
41 | 41 | ||
42 | short killTree(tx, ty, gx, gy, escape, tkMark) | 42 | short killTree(tx, ty, gx, gy, escape, tkMark) |
43 | short tx, ty, gx, gy, *escape, tkMark; | 43 | short tx, ty, gx, gy, *escape, tkMark; |
44 | { /* killTree */ | 44 | { /* killTree */ |
45 | short curMark, mark2, mark3, i, j, k, tl, dStart, result; | 45 | short curMark, mark2, mark3, i, j, k, tl, dStart, result; |
46 | sPointList lList1, lList2; | 46 | sPointList lList1, lList2; |
47 | short libList[maxSPoint+1]; | 47 | short libList[maxSPoint+1]; |
48 | point tp; | 48 | point tp; |
49 | short esc = FALSE; | 49 | short esc = FALSE; |
50 | tryCount = tryCount + 1; | 50 | tryCount = tryCount + 1; |
51 | if (tryCount > tryLimit) | 51 | if (tryCount > tryLimit) |
52 | { | 52 | { |
53 | undoTo(tkMark); | 53 | undoTo(tkMark); |
54 | /* for (i = 1; i <= depth - 1; i++) | 54 | /* for (i = 1; i <= depth - 1; i++) |
55 | { | 55 | { |
56 | sClearChar(sChar, rXor); | 56 | sClearChar(sChar, rXor); |
57 | } */ | 57 | } */ |
58 | depth = 1; | 58 | depth = 1; |
59 | return FALSE; | 59 | return FALSE; |
60 | } | 60 | } |
61 | /* write(sChar); */ | 61 | /* write(sChar); */ |
62 | depth = depth + 1; | 62 | depth = depth + 1; |
63 | curMark = playMark; | 63 | curMark = playMark; |
64 | tryPlay(tx, ty, me); /* try my move */ | 64 | tryPlay(tx, ty, me); /* try my move */ |
65 | pause(); | 65 | // pause(); |
66 | if (gList[gMap[groupIDs[tx][ty]]].libC == 0) /* I'm dead */ | 66 | if (gList[gMap[groupIDs[tx][ty]]].libC == 0) /* I'm dead */ |
67 | { | 67 | { |
68 | result = FALSE; | 68 | result = FALSE; |
69 | goto one; | 69 | goto one; |
70 | } | 70 | } |
71 | else if (killFlag) /* I killed something of his */ | 71 | else if (killFlag) /* I killed something of his */ |
72 | { | 72 | { |
73 | result = TRUE; | 73 | result = TRUE; |
74 | goto one; | 74 | goto one; |
75 | } | 75 | } |
76 | else if (gList[gMap[groupIDs[gx][gy]]].libC > treeLibLim) /* safe */ | 76 | else if (gList[gMap[groupIDs[gx][gy]]].libC > treeLibLim) /* safe */ |
77 | { | 77 | { |
78 | result = FALSE; | 78 | result = FALSE; |
79 | goto one; | 79 | goto one; |
80 | } | 80 | } |
81 | else | 81 | else |
82 | { | 82 | { |
83 | sSpanGroup(gx, gy, &lList1); /* find his liberties */ | 83 | sSpanGroup(gx, gy, &lList1); /* find his liberties */ |
84 | if (gList[gMap[groupIDs[tx][ty]]].libC == 1) /* he can kill me */ | 84 | if (gList[gMap[groupIDs[tx][ty]]].libC == 1) /* he can kill me */ |
85 | { | 85 | { |
86 | if (lList1.indx < maxSPoint) /* add that option to his list */ | 86 | if (lList1.indx < maxSPoint) /* add that option to his list */ |
87 | { | 87 | { |
88 | lList1.indx = lList1.indx + 1; | 88 | lList1.indx = lList1.indx + 1; |
89 | spanGroup(tx, ty, &plist2); /* find my liberty */ | 89 | spanGroup(tx, ty, &plist2); /* find my liberty */ |
90 | lList1.p[lList1.indx].px = plist2.p[1].px; | 90 | lList1.p[lList1.indx].px = plist2.p[1].px; |
91 | lList1.p[lList1.indx].py = plist2.p[1].py; | 91 | lList1.p[lList1.indx].py = plist2.p[1].py; |
92 | } | 92 | } |
93 | else | 93 | else |
94 | { | 94 | { |
95 | result = FALSE; | 95 | result = FALSE; |
96 | goto one; | 96 | goto one; |
97 | } | 97 | } |
98 | } | 98 | } |
99 | for (i = 1; i <= maxSPoint; i++) /* init liblist so diags can be marked */ | 99 | for (i = 1; i <= maxSPoint; i++) /* init liblist so diags can be marked */ |
100 | libList[i] = -1; | 100 | libList[i] = -1; |
101 | if ((utilPlayLevel > 4) && | 101 | if ((utilPlayLevel > 4) && |
102 | (lList1.indx > 1) && | 102 | (lList1.indx > 1) && |
103 | (gList[gMap[groupIDs[gx][gy]]].libC > 1)) /* try diags */ | 103 | (gList[gMap[groupIDs[gx][gy]]].libC > 1)) /* try diags */ |
104 | { | 104 | { |
105 | listDiags(gx, gy, &dList); | 105 | listDiags(gx, gy, &dList); |
106 | j = 0; | 106 | j = 0; |
107 | i = lList1.indx; | 107 | i = lList1.indx; |
108 | while ((j < dList.indx) && | 108 | while ((j < dList.indx) && |
109 | (i < maxSPoint)) | 109 | (i < maxSPoint)) |
110 | { | 110 | { |
111 | j = j + 1; | 111 | j = j + 1; |
112 | i = i + 1; | 112 | i = i + 1; |
113 | libList[i] = 0; /* mark this as a diag */ | 113 | libList[i] = 0; /* mark this as a diag */ |
114 | lList1.p[i].px = dList.p[j].px; | 114 | lList1.p[i].px = dList.p[j].px; |
115 | lList1.p[i].py = dList.p[j].py; | 115 | lList1.p[i].py = dList.p[j].py; |
116 | } | 116 | } |
117 | lList1.indx = i; | 117 | lList1.indx = i; |
118 | } | 118 | } |
119 | if (lList1.indx > 1) /* sort by decreasing lib count */ | 119 | if (lList1.indx > 1) /* sort by decreasing lib count */ |
120 | { | 120 | { |
121 | for (i = 1; i <= lList1.indx; i++) | 121 | for (i = 1; i <= lList1.indx; i++) |
122 | if (libList[i] != 0) /* diags are tried last */ | 122 | if (libList[i] != 0) /* diags are tried last */ |
123 | { | 123 | { |
124 | mark2 = playMark; | 124 | mark2 = playMark; |
125 | tryPlay(lList1.p[i].px, lList1.p[i].py, him); | 125 | tryPlay(lList1.p[i].px, lList1.p[i].py, him); |
126 | libList[i] = gList[gMap[groupIDs[gx][gy]]].libC; | 126 | libList[i] = gList[gMap[groupIDs[gx][gy]]].libC; |
127 | if ((libList[i] > treeLibLim) || | 127 | if ((libList[i] > treeLibLim) || |
128 | ((libList[i] > (depthLimit - depth)) && | 128 | ((libList[i] > (depthLimit - depth)) && |
129 | (libList[i] > 2))) | 129 | (libList[i] > 2))) |
130 | { | 130 | { |
131 | *escape = TRUE; | 131 | *escape = TRUE; |
132 | result = FALSE; | 132 | result = FALSE; |
133 | goto one; | 133 | goto one; |
134 | } | 134 | } |
135 | undoTo(mark2); | 135 | undoTo(mark2); |
136 | } | 136 | } |
137 | for (i = 1; i <= lList1.indx - 1; i++) | 137 | for (i = 1; i <= lList1.indx - 1; i++) |
138 | for (j = i + 1; j <= lList1.indx; j++) | 138 | for (j = i + 1; j <= lList1.indx; j++) |
139 | if (libList[i] < libList[j]) | 139 | if (libList[i] < libList[j]) |
140 | { | 140 | { |
141 | tl = libList[i]; | 141 | tl = libList[i]; |
142 | libList[i] = libList[j]; | 142 | libList[i] = libList[j]; |
143 | libList[j] = tl; | 143 | libList[j] = tl; |
144 | tp = lList1.p[i]; | 144 | tp = lList1.p[i]; |
145 | lList1.p[i] = lList1.p[j]; | 145 | lList1.p[i] = lList1.p[j]; |
146 | lList1.p[j] = tp; | 146 | lList1.p[j] = tp; |
147 | } | 147 | } |
148 | } | 148 | } |
149 | for (i = 1; i <= lList1.indx + 1; i++) /* try his responses */ | 149 | for (i = 1; i <= lList1.indx + 1; i++) /* try his responses */ |
150 | { | 150 | { |
151 | mark2 = playMark; | 151 | mark2 = playMark; |
152 | if (i <= lList1.indx) /* try his move */ | 152 | if (i <= lList1.indx) /* try his move */ |
153 | { | 153 | { |
154 | tryPlay(lList1.p[i].px, lList1.p[i].py, him); /* play his response */ | 154 | tryPlay(lList1.p[i].px, lList1.p[i].py, him); /* play his response */ |
155 | pause(); | 155 | // pause(); |
156 | if (gList[gMap[groupIDs[lList1.p[i].px] | 156 | if (gList[gMap[groupIDs[lList1.p[i].px] |
157 | [lList1.p[i].py]]].libC < 2) | 157 | [lList1.p[i].py]]].libC < 2) |
158 | goto two; /* a bogus move */ | 158 | goto two; /* a bogus move */ |
159 | } | 159 | } |
160 | else if (gList[gMap[groupIDs[gx][gy]]].libC <= 1) | 160 | else if (gList[gMap[groupIDs[gx][gy]]].libC <= 1) |
161 | { | 161 | { |
162 | result = TRUE; | 162 | result = TRUE; |
163 | goto one; | 163 | goto one; |
164 | } | 164 | } |
165 | if (gList[gMap[groupIDs[gx][gy]]].libC > treeLibLim) | 165 | if (gList[gMap[groupIDs[gx][gy]]].libC > treeLibLim) |
166 | { | 166 | { |
167 | *escape = TRUE; | 167 | *escape = TRUE; |
168 | result = FALSE; | 168 | result = FALSE; |
169 | goto one; | 169 | goto one; |
170 | } | 170 | } |
171 | if (gList[gMap[groupIDs[gx][gy]]].libC > 1) | 171 | if (gList[gMap[groupIDs[gx][gy]]].libC > 1) |
172 | { /* look at my responses */ | 172 | { /* look at my responses */ |
173 | sSpanGroup(gx, gy, &lList2); /* list his liberties */ | 173 | sSpanGroup(gx, gy, &lList2); /* list his liberties */ |
174 | dStart = lList2.indx + 1; | 174 | dStart = lList2.indx + 1; |
175 | if (adjInAtari) /* he wins */ | 175 | if (adjInAtari) /* he wins */ |
176 | { | 176 | { |
177 | result = FALSE; | 177 | result = FALSE; |
178 | goto one; | 178 | goto one; |
179 | } | 179 | } |
180 | if ((lList2.indx > 2) && adj2Libs) /* he wins */ | 180 | if ((lList2.indx > 2) && adj2Libs) /* he wins */ |
181 | { | 181 | { |
182 | result = FALSE; | 182 | result = FALSE; |
183 | goto one; | 183 | goto one; |
184 | } | 184 | } |
185 | for (k = 1; k <= maxSPoint; k++) | 185 | for (k = 1; k <= maxSPoint; k++) |
186 | libList[k] = -1; | 186 | libList[k] = -1; |
187 | if (utilPlayLevel > 4) /* account for diagonal moves */ | 187 | if (utilPlayLevel > 4) /* account for diagonal moves */ |
188 | { | 188 | { |
189 | listDiags(gx, gy, &dList); | 189 | listDiags(gx, gy, &dList); |
190 | j = 0; | 190 | j = 0; |
191 | k = lList2.indx; | 191 | k = lList2.indx; |
192 | while ((j < dList.indx) && | 192 | while ((j < dList.indx) && |
193 | (k < maxSPoint)) | 193 | (k < maxSPoint)) |
194 | { | 194 | { |
195 | j = j + 1; | 195 | j = j + 1; |
196 | k = k + 1; | 196 | k = k + 1; |
197 | libList[k] = 100; | 197 | libList[k] = 100; |
198 | lList2.p[k].px = dList.p[j].px; | 198 | lList2.p[k].px = dList.p[j].px; |
199 | lList2.p[k].py = dList.p[j].py; | 199 | lList2.p[k].py = dList.p[j].py; |
200 | } | 200 | } |
201 | lList2.indx = k; | 201 | lList2.indx = k; |
202 | } | 202 | } |
203 | if (lList2.indx > 1) /* sort by increasing lib count */ | 203 | if (lList2.indx > 1) /* sort by increasing lib count */ |
204 | { | 204 | { |
205 | for (k = 1; k <= lList2.indx; k++) | 205 | for (k = 1; k <= lList2.indx; k++) |
206 | if (libList[k] != 100) /* diags go last */ | 206 | if (libList[k] != 100) /* diags go last */ |
207 | { | 207 | { |
208 | mark3 = playMark; | 208 | mark3 = playMark; |
209 | tryPlay(lList2.p[k].px, lList2.p[k].py, me); | 209 | tryPlay(lList2.p[k].px, lList2.p[k].py, me); |
210 | libList[k] = gList[gMap[groupIDs[gx][gy]]].libC; | 210 | libList[k] = gList[gMap[groupIDs[gx][gy]]].libC; |
211 | undoTo(mark3); | 211 | undoTo(mark3); |
212 | } | 212 | } |
213 | for (k = 1; k <= lList2.indx - 1; k++) | 213 | for (k = 1; k <= lList2.indx - 1; k++) |
214 | for (j = k + 1; j <= lList2.indx; j++) | 214 | for (j = k + 1; j <= lList2.indx; j++) |
215 | if (libList[k] > libList[j]) | 215 | if (libList[k] > libList[j]) |
216 | { | 216 | { |
217 | tl = libList[k]; | 217 | tl = libList[k]; |
218 | libList[k] = libList[j]; | 218 | libList[k] = libList[j]; |
219 | libList[j] = tl; | 219 | libList[j] = tl; |