Skip to content

Commit

Permalink
minor refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
raydac committed Mar 25, 2021
1 parent d53d4dd commit 3db7098
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.igormaznitsa.battleships.opponent.FirstMoveOrderProvider;
import com.igormaznitsa.battleships.opponent.GameEventType;
import com.igormaznitsa.battleships.utils.Utils;

import java.time.Duration;
import java.util.HashMap;
import java.util.Map;
Expand Down Expand Up @@ -139,13 +140,7 @@ private void checkPlayersReady() {
firstMoveOrderProvider = (FirstMoveOrderProvider) this.playerB;
} else {
LOGGER.info("Using internal dice to choose first turn player");
firstMoveOrderProvider = new FirstMoveOrderProvider() {
@Override
public BattleshipsPlayer findFirstTurnPlayer(final BattleshipsPlayer playerA,
final BattleshipsPlayer playerB) {
return Utils.RND.nextBoolean() ? playerA : playerB;
}
};
firstMoveOrderProvider = (playerA, playerB) -> Utils.RND.nextBoolean() ? playerA : playerB;
}

final BattleshipsPlayer firstTurnPlayer = Objects
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public OpeningDialog(final StartOptions startOptions) {
this.buttonGo.addActionListener(e -> {
int hostPort = -1;
try {
hostPort = Integer.parseInt(this.textFieldPort.getText().toString().trim());
hostPort = Integer.parseInt(this.textFieldPort.getText().trim());
} catch (Exception ex) {
// ignoring
}
Expand Down

0 comments on commit 3db7098

Please sign in to comment.