mirror of
https://github.com/2OOP/pism.git
synced 2026-02-04 10:54:51 +00:00
Merge remote-tracking branch 'origin/Demo3' into Demo3
This commit is contained in:
@@ -230,9 +230,7 @@ public final class TicTacToeGame {
|
|||||||
} catch (InterruptedException _) {}
|
} catch (InterruptedException _) {}
|
||||||
} else {
|
} else {
|
||||||
final Game.Move move;
|
final Game.Move move;
|
||||||
IO.println(information.players[0].name + " " + information.players[1].name);
|
|
||||||
if (information.players[1].name.equalsIgnoreCase("pism")) {
|
if (information.players[1].name.equalsIgnoreCase("pism")) {
|
||||||
IO.println("got worst move");
|
|
||||||
move = ai.findWorstMove(game,9);
|
move = ai.findWorstMove(game,9);
|
||||||
}else{
|
}else{
|
||||||
move = ai.findBestMove(game, information.players[0].computerDifficulty);
|
move = ai.findBestMove(game, information.players[0].computerDifficulty);
|
||||||
|
|||||||
@@ -56,7 +56,6 @@ public final class SendChallengeView extends View {
|
|||||||
final Button cancelButton = button();
|
final Button cancelButton = button();
|
||||||
cancelButton.setText(AppContext.getString("cancel"));
|
cancelButton.setText(AppContext.getString("cancel"));
|
||||||
cancelButton.setOnAction(_ -> {
|
cancelButton.setOnAction(_ -> {
|
||||||
IO.println("tried to click cancel");
|
|
||||||
ViewStack.pop(); });
|
ViewStack.pop(); });
|
||||||
|
|
||||||
final List<Node> nodes = new ArrayList<>();
|
final List<Node> nodes = new ArrayList<>();
|
||||||
|
|||||||
@@ -142,7 +142,6 @@ public final class Reversi extends TurnBasedGame {
|
|||||||
Move[] moves = sortMovesFromCenter(getFlipsForPotentialMove(new Point(move.position()%columnSize,move.position()/rowSize), makeBoardAGrid(), move.value()),move);
|
Move[] moves = sortMovesFromCenter(getFlipsForPotentialMove(new Point(move.position()%columnSize,move.position()/rowSize), makeBoardAGrid(), move.value()),move);
|
||||||
mostRecentlyFlippedPieces = moves;
|
mostRecentlyFlippedPieces = moves;
|
||||||
board[move.position()] = move.value();
|
board[move.position()] = move.value();
|
||||||
IO.println(move.position() +" "+ move.value());
|
|
||||||
for (Move m : moves) {
|
for (Move m : moves) {
|
||||||
board[m.position()] = m.value();
|
board[m.position()] = m.value();
|
||||||
}
|
}
|
||||||
@@ -207,7 +206,6 @@ public final class Reversi extends TurnBasedGame {
|
|||||||
public Move[] sortMovesFromCenter(Move[] moves, Move center) {
|
public Move[] sortMovesFromCenter(Move[] moves, Move center) {
|
||||||
int centerX = center.position()%columnSize;
|
int centerX = center.position()%columnSize;
|
||||||
int centerY = center.position()/rowSize;
|
int centerY = center.position()/rowSize;
|
||||||
IO.println("pre "+Arrays.toString(moves));
|
|
||||||
Arrays.sort(moves, (a, b) -> {
|
Arrays.sort(moves, (a, b) -> {
|
||||||
int dxA = a.position()%columnSize - centerX;
|
int dxA = a.position()%columnSize - centerX;
|
||||||
int dyA = a.position()/rowSize - centerY;
|
int dyA = a.position()/rowSize - centerY;
|
||||||
@@ -219,7 +217,6 @@ public final class Reversi extends TurnBasedGame {
|
|||||||
|
|
||||||
return Integer.compare(distA, distB);
|
return Integer.compare(distA, distB);
|
||||||
});
|
});
|
||||||
IO.println("post "+Arrays.toString(moves));
|
|
||||||
return moves;
|
return moves;
|
||||||
}
|
}
|
||||||
public Move[] getMostRecentlyFlippedPieces() {
|
public Move[] getMostRecentlyFlippedPieces() {
|
||||||
|
|||||||
Reference in New Issue
Block a user