diff --git a/xwords4/android/XWords4/res/layout/game_config.xml b/xwords4/android/XWords4/res/layout/game_config.xml
index 6a4d6d1a6..002639460 100644
--- a/xwords4/android/XWords4/res/layout/game_config.xml
+++ b/xwords4/android/XWords4/res/layout/game_config.xml
@@ -199,11 +199,13 @@
/>
-
+
@string/phonies_disallow
+
+ - @string/robot_smartest
+ - @string/robot_smarter
+ - @string/robot_smart
+
+
- @string/connect_thirty_seconds
- @string/connect_five_mins
diff --git a/xwords4/android/XWords4/res/values/strings.xml b/xwords4/android/XWords4/res/values/strings.xml
index 2372855d6..0a1686b15 100644
--- a/xwords4/android/XWords4/res/values/strings.xml
+++ b/xwords4/android/XWords4/res/values/strings.xml
@@ -177,8 +177,6 @@
Other settings
Minutes per player
- Smart robot
-
Download more...
Confirm save
@@ -230,6 +228,11 @@
Ignore phonies
Warn if phonies
Disallow phonies
+ How smart is the robot player?
+ Smart robot
+ Smarter robot
+ Smartest robot
+
Settings
Dictionaries
Restore all
@@ -257,7 +260,8 @@
Game dictionary
Handle phonies
- Handle phonies (words not in dictionary)
+ How to handle \"phonies\"
+ (words not in dictionary)
Board size
Use game timer
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameConfig.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameConfig.java
index 8ac5d6205..20d272066 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameConfig.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameConfig.java
@@ -91,6 +91,7 @@ public class GameConfig extends XWActivity
// private Spinner m_connectSpinner;
private Spinner m_phoniesSpinner;
private Spinner m_dictSpinner;
+ private Spinner m_smartnessSpinner;
private String[] m_dictItems;
private String[] m_dicts;
private int m_browsePosition;
@@ -443,6 +444,9 @@ public class GameConfig extends XWActivity
m_phoniesSpinner = (Spinner)findViewById( R.id.phonies_spinner );
m_phoniesSpinner.setSelection( m_gi.phoniesAction.ordinal() );
+ m_smartnessSpinner = (Spinner)findViewById( R.id.smart_robot );
+ setSmartnessSpinner();
+
Utils.setChecked( this, R.id.hints_allowed, !m_gi.hintsNotAllowed );
Utils.setInt( this, R.id.timer_minutes_edit,
m_gi.gameSeconds/60/m_gi.nPlayers );
@@ -459,8 +463,6 @@ public class GameConfig extends XWActivity
check.setOnCheckedChangeListener( lstnr );
Utils.setChecked( this, R.id.use_timer, m_gi.timerEnabled );
- Utils.setChecked( this, R.id.smart_robot, m_gi.getRobotsAreSmart() );
-
String fmt = getString( m_notNetworkedGame ?
R.string.title_game_configf
: R.string.title_gamenet_configf );
@@ -665,6 +667,28 @@ public class GameConfig extends XWActivity
});
}
+ private void setSmartnessSpinner()
+ {
+ int setting = -1;
+ switch ( m_gi.getRobotSmartness() ) {
+ case 1:
+ setting = 0;
+ break;
+ case 50:
+ setting = 1;
+ break;
+ case 99:
+ case 100:
+ setting = 2;
+ break;
+ default:
+ Utils.logf( "setSmartnessSpinner got %d from getRobotSmartness()",
+ m_gi.getRobotSmartness() );
+ Assert.fail();
+ }
+ m_smartnessSpinner.setSelection( setting );
+ }
+
// private void configConnectSpinner()
// {
// m_connectSpinner = (Spinner)findViewById( R.id.connect_spinner );
@@ -831,11 +855,13 @@ public class GameConfig extends XWActivity
m_gi.timerEnabled = Utils.getChecked( this, R.id.use_timer );
m_gi.gameSeconds = 60 * m_gi.nPlayers *
Utils.getInt( this, R.id.timer_minutes_edit );
- m_gi.setRobotsAreSmart( Utils.getChecked( this, R.id.smart_robot ) );
int position = m_phoniesSpinner.getSelectedItemPosition();
m_gi.phoniesAction = CurGameInfo.XWPhoniesChoice.values()[position];
+ position = m_smartnessSpinner.getSelectedItemPosition();
+ m_gi.setRobotSmartness(position * 49 + 1);
+
if ( !m_notNetworkedGame ) {
m_car.ip_relay_seeksPublicRoom = m_joinPublicCheck.isChecked();
Utils.logf( "ip_relay_seeksPublicRoom: %s",
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/CurGameInfo.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/CurGameInfo.java
index 903df21c7..00e1ff795 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/CurGameInfo.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/CurGameInfo.java
@@ -55,7 +55,7 @@ public class CurGameInfo {
// private int[] m_visiblePlayers;
// private int m_nVisiblePlayers;
private boolean m_inProgress;
- private boolean m_smart;
+ private int m_smartness;
public CurGameInfo( Context context )
{
@@ -79,6 +79,7 @@ public class CurGameInfo {
timerEnabled = CommonPrefs.getDefaultTimerEnabled( context );
allowPickTiles = false;
allowHintRect = false;
+ m_smartness = 0; // needs to be set from players
// Always create MAX_NUM_PLAYERS so jni code doesn't ever have
// to cons up a LocalPlayer instance.
@@ -89,7 +90,7 @@ public class CurGameInfo {
if ( isNetworked ) {
players[1].isLocal = false;
} else {
- players[0].setIsRobot( 1 );
+ players[0].setRobotSmartness( 1 );
}
}
@@ -131,17 +132,26 @@ public class CurGameInfo {
m_inProgress = inProgress;
}
- public boolean getRobotsAreSmart()
+ public int getRobotSmartness()
{
- return m_smart;
+ if ( m_smartness == 0 ) {
+ m_smartness = 1; // default if no robots
+ for ( int ii = 0; ii < nPlayers; ++ii ) {
+ if ( players[ii].isRobot() ) {
+ m_smartness = players[ii].robotIQ;
+ break; // should all be the same
+ }
+ }
+ }
+ return m_smartness;
}
- public void setRobotsAreSmart( boolean smart )
+ public void setRobotSmartness( int smartness )
{
- m_smart = smart;
+ m_smartness = smartness;
for ( int ii = 0; ii < nPlayers; ++ii ) {
if ( players[ii].isRobot() ) {
- players[ii].setIsRobot( smart ? 1 : 100 );
+ players[ii].robotIQ = smartness;
}
}
}
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/LocalPlayer.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/LocalPlayer.java
index 8c63966c9..9dce35871 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/LocalPlayer.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/LocalPlayer.java
@@ -63,7 +63,7 @@ public class LocalPlayer {
robotIQ = isRobot ? 1 : 0;
}
- public void setIsRobot( int iq )
+ public void setRobotSmartness( int iq )
{
Assert.assertTrue( iq > 0 );
robotIQ = iq;