Skip to content

Commit 6a768eb

Browse files
committed
use time slightly more aggressively
1 parent 81a79c5 commit 6a768eb

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
Cinder is an independent chess engine written in Rust from scratch.
1111
With a playing strength that is far superior to what humans are capable of,
1212
Cinder is primarily developed to play against other engines. It is regularly tested
13-
at the extremely short time control of 3s+25ms per game. The shorter the time control,
13+
at the extremely short time control of 1s+10ms per game. The shorter the time control,
1414
the stronger Cinder tends to play.
1515

1616
## Usage

lib/search/engine.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,8 @@ impl<'a> Search<'a> {
201201
ply: Ply,
202202
) -> Result<Pv<N>, Interrupted> {
203203
self.ctrl.interrupted()?;
204+
205+
(ply > 0).assume();
204206
let (alpha, beta) = match pos.outcome() {
205207
None => self.mdp(ply, &bounds),
206208
Some(o) if o.is_draw() => return Ok(Pv::empty(Score::new(0))),
@@ -514,7 +516,7 @@ impl Engine {
514516
};
515517

516518
let time_left = clock.saturating_sub(*inc);
517-
let moves_left = 280 / pos.fullmoves().get().min(40);
519+
let moves_left = 256 / pos.fullmoves().get().min(64);
518520
let time_per_move = inc.saturating_add(time_left / moves_left);
519521
time_per_move / 2..time_per_move
520522
}
@@ -544,7 +546,6 @@ impl Engine {
544546
#[cfg(test)]
545547
mod tests {
546548
use super::*;
547-
use crate::chess::Outcome;
548549
use proptest::{prop_assume, sample::Selector};
549550
use test_strategy::proptest;
550551

@@ -563,7 +564,7 @@ mod tests {
563564
#[filter(#pos.outcome().is_none())] pos: Evaluator,
564565
#[filter((Value::lower()..Value::upper()).contains(&#b))] b: Score,
565566
d: Depth,
566-
#[filter(#p >= 0)] p: Ply,
567+
#[filter(#p > 0)] p: Ply,
567568
#[filter(#s.mate().is_none() && #s >= #b)] s: Score,
568569
#[map(|s: Selector| s.select(#pos.moves().flatten()))] m: Move,
569570
) {
@@ -581,7 +582,7 @@ mod tests {
581582
#[filter(#pos.outcome().is_none())] pos: Evaluator,
582583
#[filter((Value::lower()..Value::upper()).contains(&#b))] b: Score,
583584
d: Depth,
584-
#[filter(#p >= 0)] p: Ply,
585+
#[filter(#p > 0)] p: Ply,
585586
#[filter(#s.mate().is_none() && #s < #b)] s: Score,
586587
#[map(|s: Selector| s.select(#pos.moves().flatten()))] m: Move,
587588
) {
@@ -599,7 +600,7 @@ mod tests {
599600
#[filter(#pos.outcome().is_none())] pos: Evaluator,
600601
#[filter((Value::lower()..Value::upper()).contains(&#b))] b: Score,
601602
d: Depth,
602-
#[filter(#p >= 0)] p: Ply,
603+
#[filter(#p > 0)] p: Ply,
603604
#[filter(#s.mate().is_none())] s: Score,
604605
#[map(|s: Selector| s.select(#pos.moves().flatten()))] m: Move,
605606
) {
@@ -678,7 +679,7 @@ mod tests {
678679
#[filter(#pos.outcome().is_some_and(|o| o.is_draw()))] pos: Evaluator,
679680
#[filter(!#b.is_empty())] b: Range<Score>,
680681
d: Depth,
681-
#[filter(#p > 0 || #pos.outcome() != Some(Outcome::DrawByThreefoldRepetition))] p: Ply,
682+
#[filter(#p > 0)] p: Ply,
682683
) {
683684
let mut search = Search::new(&e, Control::Unlimited);
684685

0 commit comments

Comments
 (0)