-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8b134f0
commit aa746bc
Showing
5 changed files
with
78 additions
and
35 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
int situation; | ||
|
||
void turnAI() { | ||
boolean aiTurn = turn; | ||
int scoreMap[][] ={ | ||
{0, 1, 1, 0}, | ||
{1, 0, 0, 1}, | ||
{1, 0, 0, 1}, | ||
{0, 1, 1, 0}, | ||
}; | ||
|
||
|
||
int canPutCount=0; | ||
for (int i=0; i<8; i++) | ||
for (int j=0; j<8; j++) | ||
if (canPut(i, j, false))canPutCount++; | ||
canPutCount=(int)random(canPutCount)+1; | ||
for (int i=0; i<8; i++) | ||
for (int j=0; j<8; j++) { | ||
if (canPut(i, j, false))canPutCount--; | ||
if (canPutCount==0) { | ||
canPut(i, j, true); | ||
break; | ||
} | ||
} | ||
println(canPutCount); | ||
turn^=true; | ||
|
||
|
||
//switch(situation) { | ||
//case 0: //序盤(4×4内) | ||
// int canPutCount=0; | ||
// for (int i=0; i<4; i++) | ||
// for (int j=0; j<4; j++) | ||
// if (canPut(i+2, j+2, false))canPutCount++; | ||
|
||
// int maxScorePointCount=0; | ||
// for (int i=0; i<4; i++) | ||
// for (int j=0; j<4; j++) | ||
// if (canPut(i+2, j+2, false) && scoreMap[i][j]==1)maxScorePointCount++; | ||
|
||
// maxScorePointCount=(int)random(maxScorePointCount); | ||
// for (int i=0; i<4; i++) | ||
// for (int j=0; j<4; j++) { | ||
// if (canPut(i+2, j+2, false))maxScorePointCount--; | ||
// if (maxScorePointCount==0)canPut(i+2, j+2, true); | ||
// } | ||
// println(canPutCount); | ||
|
||
// if (canPutCount==0)situation++; //序盤終了 | ||
// else break; | ||
|
||
//case 1: //中盤 | ||
//} | ||
|
||
//turn^=true; | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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