Skip to content

Commit 4ba53e7

Browse files
Merge pull request #166 from pleco-rs/fix-ci
👷 Fix CI
2 parents 6370f65 + f56e0e3 commit 4ba53e7

File tree

14 files changed

+45
-60
lines changed

14 files changed

+45
-60
lines changed

TODO.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Raise PR for other protocols to use pleco again
1414

1515
## Development
1616

17+
Fix CI
1718
Test engine in Arena: https://github.com/pleco-rs/Pleco/issues/132
1819
Port over Stockfish end of game table: https://github.com/pleco-rs/Pleco/issues/113
1920
Review unstable features and which ones we can add back: https://github.com/pleco-rs/Pleco/issues/77

pleco/src/board/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ pub struct Board {
205205
half_moves: u16, // Total moves played
206206
depth: u16, // Current depth since last shallow_copy
207207
piece_counts: [[u8; PIECE_TYPE_CNT]; PLAYER_CNT], // Count of each Piece
208-
piece_locations: PieceLocations, // Mapping Squares to Pieces and Plauers
208+
piece_locations: PieceLocations, // Mapping Squares to Pieces and Players
209209
zobrist_history: Vec<u64>, // Historic Zobrist keys of the board
210210
threefold_repetition: bool, // Whether the board has been repeated 3 times
211211

@@ -700,7 +700,7 @@ impl Board {
700700
let mut next_arc_state = UniqueArc::new(self.state.partial_clone());
701701

702702
// Separate Block to allow dereferencing the BoardState
703-
// As there is garunteed only one owner of the Arc, this is allowed
703+
// As there is guaranteed only one owner of the Arc, this is allowed
704704
{
705705
let new_state: &mut BoardState = &mut next_arc_state;
706706

@@ -1242,7 +1242,7 @@ impl Board {
12421242
fn apply_castling(
12431243
&mut self,
12441244
player: Player,
1245-
k_src: SQ, // from, king startng spot
1245+
k_src: SQ, // from, king starting spot
12461246
to_r_orig: &mut SQ, // originally
12471247
r_src: &mut SQ,
12481248
r_dst: &mut SQ,

pleco/src/board/movegen.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ impl Legality for PseudoLegal {
111111
}
112112
}
113113

114-
// Pieces to generate moves with inter-changably
114+
// Pieces to generate moves with interchangeably
115115
const STANDARD_PIECES: [PieceType; 4] = [PieceType::B, PieceType::N, PieceType::R, PieceType::Q];
116116
const DEFAULT_MOVES_LENGTH: usize = 32;
117117

pleco/src/bots/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ pub fn eval_board(board: &Board) -> ScoringMove {
120120
mod tests {
121121
use super::*;
122122

123-
// We test these, as both algorithms should give the same result no matter if paralleized
123+
// We test these, as both algorithms should give the same result no matter if parallelized
124124
// or not.
125125

126126
#[test]

pleco/src/core/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ impl Piece {
522522
///
523523
/// The following code snippet will give undefined behavior:
524524
///
525-
/// ```
525+
/// ```no_run
526526
/// use pleco::{Piece,PieceType,Player};
527527
///
528528
/// let illegal_piece = Piece::make_lossy(Player::Black, PieceType::All);

pleco/src/helper/prelude.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ pub fn z_ep(sq: SQ) -> u64 {
193193
zobrist::z_ep(sq)
194194
}
195195

196-
/// Returns the Zobrish hash for a castling right.
196+
/// Returns the Zobrist hash for a castling right.
197197
///
198198
/// Undefined behavior will occur if the bits are greater than 15.
199199
#[inline(always)]

pleco/src/tools/tt.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ use super::prefetch_write;
4343
use super::PreFetchable;
4444
use core::piece_move::BitMove;
4545

46-
// TODO: investigate potention for SIMD in key lookup
46+
// TODO: investigate potential for SIMD in key lookup
4747
// Currently, there is now way to do this right now in rust without it being extensive.
4848

4949
pub type Key = u64;
@@ -352,7 +352,7 @@ impl TranspositionTable {
352352
/// Returns the current number of cycles a TT has gone through. Cycles is simply the
353353
/// number of times refresh has been called.
354354
#[inline]
355-
pub fn time_age_cylces(&self) -> u8 {
355+
pub fn time_age_cycles(&self) -> u8 {
356356
unsafe { (*self.time_age.get()).wrapping_shr(2) }
357357
}
358358

@@ -363,6 +363,7 @@ impl TranspositionTable {
363363
/// the current search, e.g. has the shallowest depth or was found in a previous search.
364364
///
365365
/// If 'true' is returned, the Entry is guaranteed to have the correct time.
366+
#[allow(clippy::mut_from_ref)]
366367
pub fn probe(&self, key: Key) -> (bool, &mut Entry) {
367368
let partial_key: u16 = (key).wrapping_shr(48) as u16;
368369

pleco/tests/board_hash.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ impl HashCorrect for PawnHashCorrect {
6666
}
6767
}
6868

69-
// Testing that applying / undoing a move leads to the same zobriust hash
69+
// Testing that applying / undoing a move leads to the same zobrist hash
7070
#[test]
7171
fn zobrist_correctness() {
7272
for _x in 0..15 {

pleco_engine/src/consts.rs

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//! Constant values and static structures.
2-
use std::mem;
2+
use std::mem::MaybeUninit;
33
use std::ptr;
44
use std::sync::atomic::compiler_fence;
55
use std::sync::atomic::AtomicBool;
@@ -22,22 +22,15 @@ pub const DEFAULT_TT_SIZE: usize = 256;
2222
pub const PAWN_TABLE_SIZE: usize = 16384;
2323
pub const MATERIAL_TABLE_SIZE: usize = 8192;
2424

25-
const TT_ALLOC_SIZE: usize = mem::size_of::<TranspositionTable>();
26-
const TIMER_ALLOC_SIZE: usize = mem::size_of::<TimeManager>();
27-
28-
// A object that is the same size as a transposition table
29-
type DummyTranspositionTable = [u8; TT_ALLOC_SIZE];
30-
type DummyTimeManager = [u8; TIMER_ALLOC_SIZE];
31-
3225
pub static USE_STDOUT: AtomicBool = AtomicBool::new(true);
3326

3427
static INITIALIZED: Once = Once::new();
3528

3629
/// Global Transposition Table
37-
static mut TT_TABLE: DummyTranspositionTable = [0; TT_ALLOC_SIZE];
30+
static mut TT_TABLE: MaybeUninit<TranspositionTable> = MaybeUninit::uninit();
3831

3932
// Global Timer
40-
static mut TIMER: DummyTimeManager = [0; TIMER_ALLOC_SIZE];
33+
static mut TIMER: MaybeUninit<TimeManager> = MaybeUninit::uninit();
4134

4235
#[cold]
4336
pub fn init_globals() {
@@ -56,29 +49,30 @@ pub fn init_globals() {
5649
#[cold]
5750
fn init_tt() {
5851
unsafe {
59-
let tt = &mut TT_TABLE as *mut DummyTranspositionTable as *mut TranspositionTable;
60-
ptr::write(tt, TranspositionTable::new(DEFAULT_TT_SIZE));
52+
ptr::write(
53+
TT_TABLE.as_mut_ptr(),
54+
TranspositionTable::new(DEFAULT_TT_SIZE),
55+
);
6156
}
6257
}
6358

6459
// Initializes the global Timer
6560
#[cold]
6661
fn init_timer() {
6762
unsafe {
68-
let timer: *mut TimeManager = &mut TIMER as *mut DummyTimeManager as *mut TimeManager;
69-
ptr::write(timer, TimeManager::uninitialized());
63+
ptr::write(TIMER.as_mut_ptr(), TimeManager::uninitialized());
7064
}
7165
}
7266

7367
// Returns access to the global timer
7468
pub fn timer() -> &'static TimeManager {
75-
unsafe { &*(&TIMER as *const DummyTimeManager as *const TimeManager) }
69+
unsafe { &*TIMER.as_ptr() }
7670
}
7771

7872
/// Returns access to the global transposition table
7973
#[inline(always)]
8074
pub fn tt() -> &'static TranspositionTable {
81-
unsafe { &*(&TT_TABLE as *const DummyTranspositionTable as *const TranspositionTable) }
75+
unsafe { &*TT_TABLE.as_ptr() }
8276
}
8377

8478
pub trait PVNode {

pleco_engine/src/search/eval.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ const PAWNLESS_FLANK: Score = Score(20, 80);
266266
const THREAT_BY_SAFE_PAWN: Score = Score(192, 175);
267267
const THREAT_BY_RANK: Score = Score(16, 3);
268268
const HANGING: Score = Score(48, 27);
269-
const WEAK_UNOPOSSED_PAWN: Score = Score(5, 25);
269+
const WEAK_UNOPPOSED_PAWN: Score = Score(5, 25);
270270
const SLIDER_ON_QUEEN: Score = Score(42, 21);
271271
const THREAT_BY_PAWN_PUSH: Score = Score(38, 22);
272272
const THREAT_BY_ATTACK_ON_QUEEN: Score = Score(38, 22);
@@ -961,7 +961,7 @@ impl<'a, 'b, T: Tracing> EvaluationInner<'a, 'b, T> {
961961
.piece_two_bb(PieceType::R, PieceType::Q, us)
962962
.is_not_empty()
963963
{
964-
score += WEAK_UNOPOSSED_PAWN * self.pawn_entry.weak_unopposed(them);
964+
score += WEAK_UNOPPOSED_PAWN * self.pawn_entry.weak_unopposed(them);
965965
}
966966

967967
// Find squares where our pawns can push on the next move

0 commit comments

Comments
 (0)