mirror of
https://github.com/peterosterlund2/droidfish.git
synced 2024-11-23 11:31:33 +01:00
DroidFish: Use Locale.US for all text formatting.
This commit is contained in:
parent
ca757cebd7
commit
a14a8250a1
|
@ -21,6 +21,7 @@ package chess;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -320,7 +321,7 @@ public class Game {
|
||||||
for (int i = 0; i < moveList.size(); i++) {
|
for (int i = 0; i < moveList.size(); i++) {
|
||||||
Move move = moveList.get(i);
|
Move move = moveList.get(i);
|
||||||
String strMove = TextIO.moveToString(pos, move, false);
|
String strMove = TextIO.moveToString(pos, move, false);
|
||||||
moves.append(String.format(" %s", strMove));
|
moves.append(String.format(Locale.US, " %s", strMove));
|
||||||
UndoInfo ui = new UndoInfo();
|
UndoInfo ui = new UndoInfo();
|
||||||
pos.makeMove(move, ui);
|
pos.makeMove(move, ui);
|
||||||
}
|
}
|
||||||
|
@ -364,10 +365,10 @@ public class Game {
|
||||||
whiteMove = "...";
|
whiteMove = "...";
|
||||||
}
|
}
|
||||||
if (compressed) {
|
if (compressed) {
|
||||||
ret.append(String.format("%d. %s %s ",
|
ret.append(String.format(Locale.US, "%d. %s %s ",
|
||||||
pos.fullMoveCounter, whiteMove, blackMove));
|
pos.fullMoveCounter, whiteMove, blackMove));
|
||||||
} else {
|
} else {
|
||||||
ret.append(String.format("%3d. %-10s %-10s%n",
|
ret.append(String.format(Locale.US, "%3d. %-10s %-10s%n",
|
||||||
pos.fullMoveCounter, whiteMove, blackMove));
|
pos.fullMoveCounter, whiteMove, blackMove));
|
||||||
}
|
}
|
||||||
whiteMove = "";
|
whiteMove = "";
|
||||||
|
@ -381,10 +382,10 @@ public class Game {
|
||||||
whiteMove = "...";
|
whiteMove = "...";
|
||||||
}
|
}
|
||||||
if (compressed) {
|
if (compressed) {
|
||||||
ret.append(String.format("%d. %s %s ",
|
ret.append(String.format(Locale.US, "%d. %s %s ",
|
||||||
pos.fullMoveCounter, whiteMove, blackMove));
|
pos.fullMoveCounter, whiteMove, blackMove));
|
||||||
} else {
|
} else {
|
||||||
ret.append(String.format("%3d. %-8s %-8s%n",
|
ret.append(String.format(Locale.US, "%3d. %-8s %-8s%n",
|
||||||
pos.fullMoveCounter, whiteMove, blackMove));
|
pos.fullMoveCounter, whiteMove, blackMove));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -393,7 +394,7 @@ public class Game {
|
||||||
if (compressed) {
|
if (compressed) {
|
||||||
ret.append(gameResult);
|
ret.append(gameResult);
|
||||||
} else {
|
} else {
|
||||||
ret.append(String.format("%s%n", gameResult));
|
ret.append(String.format(Locale.US, "%s%n", gameResult));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ret.toString();
|
return ret.toString();
|
||||||
|
|
|
@ -22,6 +22,7 @@ import java.io.BufferedReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A player that reads input from the keyboard.
|
* A player that reads input from the keyboard.
|
||||||
|
@ -39,7 +40,7 @@ public class HumanPlayer implements Player {
|
||||||
public String getCommand(Position pos, boolean drawOffer, List<Position> history) {
|
public String getCommand(Position pos, boolean drawOffer, List<Position> history) {
|
||||||
try {
|
try {
|
||||||
String color = pos.whiteMove ? "white" : "black";
|
String color = pos.whiteMove ? "white" : "black";
|
||||||
System.out.print(String.format("Enter move (%s):", color));
|
System.out.print(String.format(Locale.US, "Enter move (%s):", color));
|
||||||
String moveStr = in.readLine();
|
String moveStr = in.readLine();
|
||||||
if (moveStr == null)
|
if (moveStr == null)
|
||||||
return "quit";
|
return "quit";
|
||||||
|
|
|
@ -18,6 +18,8 @@
|
||||||
|
|
||||||
package chess;
|
package chess;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author petero
|
* @author petero
|
||||||
|
@ -560,7 +562,7 @@ public class TextIO {
|
||||||
*/
|
*/
|
||||||
public static final String asciiBoard(Position pos) {
|
public static final String asciiBoard(Position pos) {
|
||||||
StringBuilder ret = new StringBuilder(400);
|
StringBuilder ret = new StringBuilder(400);
|
||||||
String nl = String.format("%n");
|
String nl = String.format(Locale.US, "%n");
|
||||||
ret.append(" +----+----+----+----+----+----+----+----+"); ret.append(nl);
|
ret.append(" +----+----+----+----+----+----+----+----+"); ret.append(nl);
|
||||||
for (int y = 7; y >= 0; y--) {
|
for (int y = 7; y >= 0; y--) {
|
||||||
ret.append(" |");
|
ret.append(" |");
|
||||||
|
|
|
@ -36,6 +36,7 @@ import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.GregorianCalendar;
|
import java.util.GregorianCalendar;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Scanner;
|
import java.util.Scanner;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -71,20 +72,20 @@ public class ChessController {
|
||||||
|
|
||||||
private void setSearchInfo() {
|
private void setSearchInfo() {
|
||||||
StringBuilder buf = new StringBuilder();
|
StringBuilder buf = new StringBuilder();
|
||||||
buf.append(String.format("%n[%d] ", pvDepth));
|
buf.append(String.format(Locale.US, "%n[%d] ", pvDepth));
|
||||||
if (pvUpperBound) {
|
if (pvUpperBound) {
|
||||||
buf.append("<=");
|
buf.append("<=");
|
||||||
} else if (pvLowerBound) {
|
} else if (pvLowerBound) {
|
||||||
buf.append(">=");
|
buf.append(">=");
|
||||||
}
|
}
|
||||||
if (pvIsMate) {
|
if (pvIsMate) {
|
||||||
buf.append(String.format("m%d", pvScore));
|
buf.append(String.format(Locale.US, "m%d", pvScore));
|
||||||
} else {
|
} else {
|
||||||
buf.append(String.format("%.2f", pvScore / 100.0));
|
buf.append(String.format(Locale.US, "%.2f", pvScore / 100.0));
|
||||||
}
|
}
|
||||||
buf.append(pvStr);
|
buf.append(pvStr);
|
||||||
buf.append(String.format("%n"));
|
buf.append(String.format(Locale.US, "%n"));
|
||||||
buf.append(String.format("d:%d %d:%s t:%.2f n:%d nps:%d", currDepth,
|
buf.append(String.format(Locale.US, "d:%d %d:%s t:%.2f n:%d nps:%d", currDepth,
|
||||||
currMoveNr, currMove, currTime / 1000.0, currNodes, currNps));
|
currMoveNr, currMove, currTime / 1000.0, currNodes, currNps));
|
||||||
final String newPV = buf.toString();
|
final String newPV = buf.toString();
|
||||||
gui.runOnUIThread(new Runnable() {
|
gui.runOnUIThread(new Runnable() {
|
||||||
|
@ -121,7 +122,7 @@ public class ChessController {
|
||||||
Position pos = new Position(game.pos);
|
Position pos = new Position(game.pos);
|
||||||
UndoInfo ui = new UndoInfo();
|
UndoInfo ui = new UndoInfo();
|
||||||
for (Move m : pv) {
|
for (Move m : pv) {
|
||||||
buf.append(String.format(" %s", TextIO.moveToString(pos, m, false)));
|
buf.append(String.format(Locale.US, " %s", TextIO.moveToString(pos, m, false)));
|
||||||
pos.makeMove(m, ui);
|
pos.makeMove(m, ui);
|
||||||
}
|
}
|
||||||
pvStr = buf.toString();
|
pvStr = buf.toString();
|
||||||
|
@ -211,17 +212,17 @@ public class ChessController {
|
||||||
month = now.get(Calendar.MONTH) + 1;
|
month = now.get(Calendar.MONTH) + 1;
|
||||||
day = now.get(Calendar.DAY_OF_MONTH);
|
day = now.get(Calendar.DAY_OF_MONTH);
|
||||||
}
|
}
|
||||||
pgn.append(String.format("[Date \"%04d.%02d.%02d\"]%n", year, month, day));
|
pgn.append(String.format(Locale.US, "[Date \"%04d.%02d.%02d\"]%n", year, month, day));
|
||||||
String white = "Player";
|
String white = "Player";
|
||||||
String black = ComputerPlayer.engineName;
|
String black = ComputerPlayer.engineName;
|
||||||
if (!humanIsWhite) {
|
if (!humanIsWhite) {
|
||||||
String tmp = white; white = black; black = tmp;
|
String tmp = white; white = black; black = tmp;
|
||||||
}
|
}
|
||||||
pgn.append(String.format("[White \"%s\"]%n", white));
|
pgn.append(String.format(Locale.US, "[White \"%s\"]%n", white));
|
||||||
pgn.append(String.format("[Black \"%s\"]%n", black));
|
pgn.append(String.format(Locale.US, "[Black \"%s\"]%n", black));
|
||||||
pgn.append(String.format("[Result \"%s\"]%n", game.getPGNResultString()));
|
pgn.append(String.format(Locale.US, "[Result \"%s\"]%n", game.getPGNResultString()));
|
||||||
if (!fen.equals(TextIO.startPosFEN)) {
|
if (!fen.equals(TextIO.startPosFEN)) {
|
||||||
pgn.append(String.format("[FEN \"%s\"]%n", fen));
|
pgn.append(String.format(Locale.US, "[FEN \"%s\"]%n", fen));
|
||||||
pgn.append("[SetUp \"1\"]\n");
|
pgn.append("[SetUp \"1\"]\n");
|
||||||
}
|
}
|
||||||
pgn.append("\n");
|
pgn.append("\n");
|
||||||
|
|
|
@ -859,7 +859,7 @@ public class DroidFish extends Activity implements GUIInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
private final int getIntSetting(String settingName, int defaultValue) {
|
private final int getIntSetting(String settingName, int defaultValue) {
|
||||||
String tmp = settings.getString(settingName, String.format("%d", defaultValue));
|
String tmp = settings.getString(settingName, String.format(Locale.US, "%d", defaultValue));
|
||||||
int value = Integer.parseInt(tmp);
|
int value = Integer.parseInt(tmp);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
@ -1085,7 +1085,7 @@ public class DroidFish extends Activity implements GUIInterface {
|
||||||
R.string.stockfish_engine);
|
R.string.stockfish_engine);
|
||||||
boolean analysis = (ctrl != null) && ctrl.analysisMode();
|
boolean analysis = (ctrl != null) && ctrl.analysisMode();
|
||||||
if ((strength < 1000) && !analysis) {
|
if ((strength < 1000) && !analysis) {
|
||||||
engineTitleText.setText(String.format("%s: %d%%", eName, strength / 10));
|
engineTitleText.setText(String.format(Locale.US, "%s: %d%%", eName, strength / 10));
|
||||||
} else {
|
} else {
|
||||||
engineTitleText.setText(eName);
|
engineTitleText.setText(eName);
|
||||||
}
|
}
|
||||||
|
@ -3107,7 +3107,7 @@ public class DroidFish extends Activity implements GUIInterface {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void reportInvalidMove(Move m) {
|
public void reportInvalidMove(Move m) {
|
||||||
String msg = String.format("%s %s-%s",
|
String msg = String.format(Locale.US, "%s %s-%s",
|
||||||
getString(R.string.invalid_move),
|
getString(R.string.invalid_move),
|
||||||
TextIO.squareToString(m.from), TextIO.squareToString(m.to));
|
TextIO.squareToString(m.from), TextIO.squareToString(m.to));
|
||||||
Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_SHORT).show();
|
Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_SHORT).show();
|
||||||
|
@ -3115,14 +3115,14 @@ public class DroidFish extends Activity implements GUIInterface {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void reportEngineName(String engine) {
|
public void reportEngineName(String engine) {
|
||||||
String msg = String.format("%s: %s",
|
String msg = String.format(Locale.US, "%s: %s",
|
||||||
getString(R.string.engine), engine);
|
getString(R.string.engine), engine);
|
||||||
Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_SHORT).show();
|
Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void reportEngineError(String errMsg) {
|
public void reportEngineError(String errMsg) {
|
||||||
String msg = String.format("%s: %s",
|
String msg = String.format(Locale.US, "%s: %s",
|
||||||
getString(R.string.engine_error), errMsg);
|
getString(R.string.engine_error), errMsg);
|
||||||
Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_LONG).show();
|
Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@ package org.petero.droidfish.activities;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import org.petero.droidfish.ChessBoard;
|
import org.petero.droidfish.ChessBoard;
|
||||||
import org.petero.droidfish.DroidFish;
|
import org.petero.droidfish.DroidFish;
|
||||||
|
@ -549,8 +550,8 @@ public class EditBoard extends Activity {
|
||||||
builder.setTitle(R.string.edit_move_counters);
|
builder.setTitle(R.string.edit_move_counters);
|
||||||
final EditText halfMoveClock = (EditText)content.findViewById(R.id.ed_cnt_halfmove);
|
final EditText halfMoveClock = (EditText)content.findViewById(R.id.ed_cnt_halfmove);
|
||||||
final EditText fullMoveCounter = (EditText)content.findViewById(R.id.ed_cnt_fullmove);
|
final EditText fullMoveCounter = (EditText)content.findViewById(R.id.ed_cnt_fullmove);
|
||||||
halfMoveClock.setText(String.format("%d", cb.pos.halfMoveClock));
|
halfMoveClock.setText(String.format(Locale.US, "%d", cb.pos.halfMoveClock));
|
||||||
fullMoveCounter.setText(String.format("%d", cb.pos.fullMoveCounter));
|
fullMoveCounter.setText(String.format(Locale.US, "%d", cb.pos.fullMoveCounter));
|
||||||
final Runnable setCounters = new Runnable() {
|
final Runnable setCounters = new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -20,6 +20,7 @@ package org.petero.droidfish.activities;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import org.petero.droidfish.ColorTheme;
|
import org.petero.droidfish.ColorTheme;
|
||||||
import org.petero.droidfish.R;
|
import org.petero.droidfish.R;
|
||||||
|
@ -382,7 +383,7 @@ public class EditPGN extends ListActivity {
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||||
builder.setTitle(R.string.delete_file_question);
|
builder.setTitle(R.string.delete_file_question);
|
||||||
String name = new File(pgnFile.getName()).getName();
|
String name = new File(pgnFile.getName()).getName();
|
||||||
String msg = String.format(getString(R.string.delete_named_file), name);
|
String msg = String.format(Locale.US, getString(R.string.delete_named_file), name);
|
||||||
builder.setMessage(msg);
|
builder.setMessage(msg);
|
||||||
builder.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
|
builder.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
|
||||||
public void onClick(DialogInterface dialog, int id) {
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
|
|
|
@ -555,13 +555,13 @@ public class DroidComputerPlayer {
|
||||||
if (sr.wTime < 1) sr.wTime = 1;
|
if (sr.wTime < 1) sr.wTime = 1;
|
||||||
if (sr.bTime < 1) sr.bTime = 1;
|
if (sr.bTime < 1) sr.bTime = 1;
|
||||||
StringBuilder goStr = new StringBuilder(96);
|
StringBuilder goStr = new StringBuilder(96);
|
||||||
goStr.append(String.format("go wtime %d btime %d", sr.wTime, sr.bTime));
|
goStr.append(String.format(Locale.US, "go wtime %d btime %d", sr.wTime, sr.bTime));
|
||||||
if (sr.wInc > 0)
|
if (sr.wInc > 0)
|
||||||
goStr.append(String.format(" winc %d", sr.wInc));
|
goStr.append(String.format(Locale.US, " winc %d", sr.wInc));
|
||||||
if (sr.bInc > 0)
|
if (sr.bInc > 0)
|
||||||
goStr.append(String.format(" binc %d", sr.bInc));
|
goStr.append(String.format(Locale.US, " binc %d", sr.bInc));
|
||||||
if (sr.movesToGo > 0)
|
if (sr.movesToGo > 0)
|
||||||
goStr.append(String.format(" movestogo %d", sr.movesToGo));
|
goStr.append(String.format(Locale.US, " movestogo %d", sr.movesToGo));
|
||||||
if (sr.ponderMove != null)
|
if (sr.ponderMove != null)
|
||||||
goStr.append(" ponder");
|
goStr.append(" ponder");
|
||||||
if (sr.searchMoves != null) {
|
if (sr.searchMoves != null) {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package org.petero.droidfish.engine;
|
package org.petero.droidfish.engine;
|
||||||
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
/** Implements line-based text communication between threads. */
|
/** Implements line-based text communication between threads. */
|
||||||
public class LocalPipe {
|
public class LocalPipe {
|
||||||
|
@ -9,13 +10,13 @@ public class LocalPipe {
|
||||||
|
|
||||||
/** Write a line to the pipe. */
|
/** Write a line to the pipe. */
|
||||||
public final synchronized void printLine(String format) {
|
public final synchronized void printLine(String format) {
|
||||||
String s = String.format(format, new Object[]{});
|
String s = String.format(Locale.US, format, new Object[]{});
|
||||||
addLine(s);
|
addLine(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Write a line to the pipe. */
|
/** Write a line to the pipe. */
|
||||||
public final synchronized void printLine(String format, Object ... args) {
|
public final synchronized void printLine(String format, Object ... args) {
|
||||||
String s = String.format(format, args);
|
String s = String.format(Locale.US, format, args);
|
||||||
addLine(s);
|
addLine(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -111,7 +111,7 @@ public abstract class UCIEngineBase implements UCIEngine {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setOption(String name, int value) {
|
public void setOption(String name, int value) {
|
||||||
setOption(name, String.format("%d", value));
|
setOption(name, String.format(Locale.US, "%d", value));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -127,7 +127,7 @@ public abstract class UCIEngineBase implements UCIEngine {
|
||||||
String currVal = currOptions.get(lcName);
|
String currVal = currOptions.get(lcName);
|
||||||
if (value.equals(currVal))
|
if (value.equals(currVal))
|
||||||
return;
|
return;
|
||||||
writeLineToEngine(String.format("setoption name %s value %s", name, value));
|
writeLineToEngine(String.format(Locale.US, "setoption name %s value %s", name, value));
|
||||||
currOptions.put(lcName, value);
|
currOptions.put(lcName, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -628,7 +628,7 @@ public class DroidChessController {
|
||||||
continue;
|
continue;
|
||||||
if (i > 0)
|
if (i > 0)
|
||||||
buf.append('\n');
|
buf.append('\n');
|
||||||
buf.append(String.format("[%d] ", pvi.depth));
|
buf.append(String.format(Locale.US, "[%d] ", pvi.depth));
|
||||||
boolean negateScore = !whiteMove && gui.whiteBasedScores();
|
boolean negateScore = !whiteMove && gui.whiteBasedScores();
|
||||||
if (pvi.upperBound || pvi.lowerBound) {
|
if (pvi.upperBound || pvi.lowerBound) {
|
||||||
boolean upper = pvi.upperBound ^ negateScore;
|
boolean upper = pvi.upperBound ^ negateScore;
|
||||||
|
@ -636,9 +636,9 @@ public class DroidChessController {
|
||||||
}
|
}
|
||||||
int score = negateScore ? -pvi.score : pvi.score;
|
int score = negateScore ? -pvi.score : pvi.score;
|
||||||
if (pvi.isMate) {
|
if (pvi.isMate) {
|
||||||
buf.append(String.format("m%d", score));
|
buf.append(String.format(Locale.US, "m%d", score));
|
||||||
} else {
|
} else {
|
||||||
buf.append(String.format("%.2f", score / 100.0));
|
buf.append(String.format(Locale.US, "%.2f", score / 100.0));
|
||||||
}
|
}
|
||||||
|
|
||||||
buf.append(pvi.pvStr);
|
buf.append(pvi.pvStr);
|
||||||
|
@ -715,7 +715,7 @@ public class DroidChessController {
|
||||||
UndoInfo ui = new UndoInfo();
|
UndoInfo ui = new UndoInfo();
|
||||||
if (ponderMove != null) {
|
if (ponderMove != null) {
|
||||||
String moveStr = TextIO.moveToString(tmpPos, ponderMove, false, localPt());
|
String moveStr = TextIO.moveToString(tmpPos, ponderMove, false, localPt());
|
||||||
buf.append(String.format(" [%s]", moveStr));
|
buf.append(String.format(Locale.US, " [%s]", moveStr));
|
||||||
tmpPos.makeMove(ponderMove, ui);
|
tmpPos.makeMove(ponderMove, ui);
|
||||||
}
|
}
|
||||||
for (Move m : pv.pv) {
|
for (Move m : pv.pv) {
|
||||||
|
@ -724,7 +724,7 @@ public class DroidChessController {
|
||||||
if (!TextIO.isValid(tmpPos, m))
|
if (!TextIO.isValid(tmpPos, m))
|
||||||
break;
|
break;
|
||||||
String moveStr = TextIO.moveToString(tmpPos, m, false, localPt());
|
String moveStr = TextIO.moveToString(tmpPos, m, false, localPt());
|
||||||
buf.append(String.format(" %s", moveStr));
|
buf.append(String.format(Locale.US, " %s", moveStr));
|
||||||
tmpPos.makeMove(m, ui);
|
tmpPos.makeMove(m, ui);
|
||||||
}
|
}
|
||||||
pv.pvStr = buf.toString();
|
pv.pvStr = buf.toString();
|
||||||
|
@ -897,7 +897,7 @@ public class DroidChessController {
|
||||||
if (computerPlayer != null) {
|
if (computerPlayer != null) {
|
||||||
engine = computerPlayer.getEngineName();
|
engine = computerPlayer.getEngineName();
|
||||||
if (strength < 1000)
|
if (strength < 1000)
|
||||||
engine += String.format(" (%.1f%%)", strength * 0.1);
|
engine += String.format(Locale.US, " (%.1f%%)", strength * 0.1);
|
||||||
}
|
}
|
||||||
String player = gui.playerName();
|
String player = gui.playerName();
|
||||||
String white = gameMode.playerWhite() ? player : engine;
|
String white = gameMode.playerWhite() ? player : engine;
|
||||||
|
@ -909,7 +909,7 @@ public class DroidChessController {
|
||||||
private final synchronized void updatePlayerNames(String engineName) {
|
private final synchronized void updatePlayerNames(String engineName) {
|
||||||
if (game != null) {
|
if (game != null) {
|
||||||
if (strength < 1000)
|
if (strength < 1000)
|
||||||
engineName += String.format(" (%.1f%%)", strength * 0.1);
|
engineName += String.format(Locale.US, " (%.1f%%)", strength * 0.1);
|
||||||
String white = gameMode.playerWhite() ? game.tree.white : engineName;
|
String white = gameMode.playerWhite() ? game.tree.white : engineName;
|
||||||
String black = gameMode.playerBlack() ? game.tree.black : engineName;
|
String black = gameMode.playerBlack() ? game.tree.black : engineName;
|
||||||
game.tree.setPlayerNames(white, black);
|
game.tree.setPlayerNames(white, black);
|
||||||
|
|
|
@ -83,7 +83,7 @@ public class GameTree {
|
||||||
int year = now.get(Calendar.YEAR);
|
int year = now.get(Calendar.YEAR);
|
||||||
int month = now.get(Calendar.MONTH) + 1;
|
int month = now.get(Calendar.MONTH) + 1;
|
||||||
int day = now.get(Calendar.DAY_OF_MONTH);
|
int day = now.get(Calendar.DAY_OF_MONTH);
|
||||||
date = String.format("%04d.%02d.%02d", year, month, day);
|
date = String.format(Locale.US, "%04d.%02d.%02d", year, month, day);
|
||||||
}
|
}
|
||||||
round = "?";
|
round = "?";
|
||||||
white = "?";
|
white = "?";
|
||||||
|
|
|
@ -20,6 +20,7 @@ package org.petero.droidfish.gamelogic;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import org.petero.droidfish.PGNOptions;
|
import org.petero.droidfish.PGNOptions;
|
||||||
import org.petero.droidfish.R;
|
import org.petero.droidfish.R;
|
||||||
|
@ -703,7 +704,7 @@ public class TextIO {
|
||||||
*/
|
*/
|
||||||
public static final String asciiBoard(Position pos) {
|
public static final String asciiBoard(Position pos) {
|
||||||
StringBuilder ret = new StringBuilder(400);
|
StringBuilder ret = new StringBuilder(400);
|
||||||
String nl = String.format("%n");
|
String nl = String.format(Locale.US, "%n");
|
||||||
ret.append(" +----+----+----+----+----+----+----+----+"); ret.append(nl);
|
ret.append(" +----+----+----+----+----+----+----+----+"); ret.append(nl);
|
||||||
for (int y = 7; y >= 0; y--) {
|
for (int y = 7; y >= 0; y--) {
|
||||||
ret.append(" |");
|
ret.append(" |");
|
||||||
|
|
Loading…
Reference in New Issue
Block a user