ai: enable using hold if it is initially empty
This commit is contained in:
parent
89f64aa8d8
commit
a40d336911
|
@ -205,7 +205,12 @@ struct Queue {
|
|||
}
|
||||
|
||||
impl Queue {
|
||||
fn alloc(arena: &Bump, previews: &[PieceType], hold: Option<PieceType>) -> Self {
|
||||
fn alloc(arena: &Bump, mut previews: &[PieceType], mut hold: Option<PieceType>) -> Self {
|
||||
if hold.is_none() && !previews.is_empty() {
|
||||
hold = Some(previews[0]);
|
||||
previews = &previews[1..];
|
||||
}
|
||||
|
||||
Queue {
|
||||
next: arena.alloc_slice_copy(previews),
|
||||
held: hold,
|
||||
|
|
Loading…
Reference in New Issue