Android: Rodent IV as a second opponent, with its characters and famous players
The play sheet chooses Maia or Rodent IV, and Rodent's character in a full-screen list (docs/design/android-rodent.md, docs/decisions.md «Rodent IV на телефоне»). The engine is built from its authors' sources by androidApp/scripts/rodent4.sh (patches: no wordexp.h on bionic; the search thread took its parameter by reference, which clang builds read after it was gone) and ships in both APKs; the opening books are one checked download. Rodent's tables, its book manifest and its opponent loop move from the desktop into crates/play, shared by both apps; uci's EngineConfig takes an environment (RODENT4HOME). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
3dac4a185b
commit
b3774d1651
42 changed files with 4098 additions and 951 deletions
|
|
@ -81,6 +81,9 @@ pub struct EngineConfig {
|
|||
/// Added to the engine's nice value on Unix (0 = as the app): a phone keeps its
|
||||
/// interface smooth while the engine thinks. Every thread of the engine has it.
|
||||
pub nice: i32,
|
||||
/// Variables added to the engine's environment (Rodent IV on Android finds its
|
||||
/// personalities and books by `RODENT4HOME`).
|
||||
pub env: Vec<(OsString, OsString)>,
|
||||
}
|
||||
|
||||
impl EngineConfig {
|
||||
|
|
@ -91,6 +94,7 @@ impl EngineConfig {
|
|||
working_dir: None,
|
||||
timeouts: Timeouts::default(),
|
||||
nice: 0,
|
||||
env: Vec::new(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -389,6 +393,7 @@ fn spawn_impl(cfg: EngineConfig, waker: Waker) -> Result<EngineHandle, EngineErr
|
|||
let mut command = Command::new(&path);
|
||||
command
|
||||
.args(&cfg.args)
|
||||
.envs(cfg.env.iter().map(|(k, v)| (k, v)))
|
||||
.stdin(Stdio::piped())
|
||||
.stdout(Stdio::piped())
|
||||
.stderr(Stdio::piped());
|
||||
|
|
|
|||
|
|
@ -676,3 +676,25 @@ fn an_engine_can_run_below_the_app() {
|
|||
calm.quit();
|
||||
plain.quit();
|
||||
}
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
#[test]
|
||||
fn an_engine_gets_the_variables_given() {
|
||||
let engine = Engine::spawn_with(
|
||||
EngineConfig {
|
||||
env: vec![("CP_TEST_HOME".into(), "/some/where".into())],
|
||||
..config(&[])
|
||||
},
|
||||
Box::new(|| {}),
|
||||
)
|
||||
.expect("spawn");
|
||||
let environ = std::fs::read(format!("/proc/{}/environ", engine.pid())).expect("environ");
|
||||
assert!(
|
||||
environ
|
||||
.split(|&b| b == 0)
|
||||
.any(|v| v == b"CP_TEST_HOME=/some/where")
|
||||
);
|
||||
// The app's own environment goes on as well.
|
||||
assert!(environ.split(|&b| b == 0).any(|v| v.starts_with(b"PATH=")));
|
||||
engine.quit();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue