From cc5582bdbccd6395e1982f5f553b4d994e9ca04c Mon Sep 17 00:00:00 2001 From: Peter Osterlund Date: Sun, 8 Apr 2012 16:42:21 +0000 Subject: [PATCH] DroidFish: If setting strength to 0% when stockfish engine is used, show a hint that using the CuckooChess engine gives even lower strength. --- DroidFish/res/values/strings.xml | 1 + DroidFish/src/org/petero/droidfish/DroidFish.java | 8 +++++--- .../src/org/petero/droidfish/SeekBarPreference.java | 13 +++++++++++++ 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/DroidFish/res/values/strings.xml b/DroidFish/res/values/strings.xml index 80f17ca..34391dd 100644 --- a/DroidFish/res/values/strings.xml +++ b/DroidFish/res/values/strings.xml @@ -329,6 +329,7 @@ you are not actively using the program.\ Engine terminated UCI protocol error Start New Game? + Use the CuckooChess engine for even lower strength. Too few spaces Invalid piece diff --git a/DroidFish/src/org/petero/droidfish/DroidFish.java b/DroidFish/src/org/petero/droidfish/DroidFish.java index fc02571..862506e 100644 --- a/DroidFish/src/org/petero/droidfish/DroidFish.java +++ b/DroidFish/src/org/petero/droidfish/DroidFish.java @@ -132,13 +132,15 @@ public class DroidFish extends Activity implements GUIInterface { // FIXME!!! Show extended book info. (Win percent, number of games, performance rating, etc.) // FIXME!!! Green color for "main move". Red color for "don't play in tournaments" moves. - - // FIXME!!! Add anti-lamer test: 8/8/8/8/8/8/3R3r/k3K2R w K - 0 1 bm O-O - // FIXME!!! Add anti-lamer test: 4kr2/8/8/4PpN1/8/8/4Q3/3RK3 w - f6 0 2 bm exf6 + // FIXME!!! ECO opening codes // FIXME!!! Remember multi-PV analysis setting when program restarted. // FIXME!!! Use high-res buttons from Scid on the go. + // FIXME!!! Option to display coordinates in border outside chess board. + // FIXME!!! Hard to understand how to undo a single half-move. + // FIXME!!! Hard to understand how "save game" works. + // FIXME!!! Better behavior if engine is terminated. How exactly? // FIXME!!! Handle PGN intents with more than one game. // FIXME!!! Make engine hash size configurable. diff --git a/DroidFish/src/org/petero/droidfish/SeekBarPreference.java b/DroidFish/src/org/petero/droidfish/SeekBarPreference.java index 53217a9..2b98466 100644 --- a/DroidFish/src/org/petero/droidfish/SeekBarPreference.java +++ b/DroidFish/src/org/petero/droidfish/SeekBarPreference.java @@ -26,6 +26,7 @@ import android.content.SharedPreferences; import android.content.res.TypedArray; import android.graphics.Typeface; import android.preference.Preference; +import android.preference.PreferenceManager; import android.util.AttributeSet; import android.view.Gravity; import android.view.KeyEvent; @@ -38,6 +39,7 @@ import android.widget.LinearLayout; import android.widget.SeekBar; import android.widget.TextView; import android.widget.SeekBar.OnSeekBarChangeListener; +import android.widget.Toast; /** Lets user enter a percentage value using a seek bar. */ public class SeekBarPreference extends Preference @@ -46,6 +48,7 @@ public class SeekBarPreference extends Preference private final static int DEFAULT_VALUE = 1000; private int currVal = DEFAULT_VALUE; private TextView currValBox; + private boolean showStrengthHint = true; public SeekBarPreference(Context context) { super(context); @@ -187,6 +190,16 @@ public class SeekBarPreference extends Preference SharedPreferences.Editor editor = getEditor(); editor.putInt(getKey(), progress); editor.commit(); + if ((progress == 0) && showStrengthHint) { + SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(getContext()); + String engine = settings.getString("engine", "stockfish"); + if ("stockfish".equals(engine)) { + showStrengthHint = false; + if (getKey().equals("strength")) + Toast.makeText(getContext(), R.string.strength_cuckoo_hint, + Toast.LENGTH_LONG).show(); + } + } } @Override public void onStartTrackingTouch(SeekBar seekBar) {