<string name="app_name">Reversi</string>
<string name="hello_world">Hello world!</string>
- <string name="AIwon">YOU LOST!</string>
- <string name="Iwin">I WIN!</string>
+ <string name="player1WON">YOU LOST!</string>
+ <string name="player2WON">I WIN!</string>
<string name="menu_settings">Settings</string>
<string name="title_activity_reversi">ReversiActivity</string>
<string name="player1">Black: </string>
listAllowedPositions = board.allowedPositions(currentPlayer);
if (listAllowedPositions.isEmpty()) {
- final DialogFragment newFragment = ErrorDialogFragment.newInstance(R.string.Iwin);
+ int idString;
+ if (player1Score > player2Score) {
+ idString = R.string.player1WON;
+ } else {
+ idString = R.string.player2WON;
+ }
+ final DialogFragment newFragment = ErrorDialogFragment.newInstance(idString);
newFragment.show(((Activity)context).getFragmentManager(), "errorDialog");
}
mainLoop(ai.getBestMove(board));
}
else {
- final DialogFragment newFragment = ErrorDialogFragment.newInstance(R.string.AIwon);
+ int idString;
+ if (player1Score > player2Score) {
+ idString = R.string.player1WON;
+ } else {
+ idString = R.string.player2WON;
+ }
+ final DialogFragment newFragment = ErrorDialogFragment.newInstance(idString);
newFragment.show(((Activity)context).getFragmentManager(), "errorDialog");
}
}