Trait tetrs::randomizer::Randomizer [] [src]

pub trait Randomizer {
    fn preview(&mut self, lookahead: usize) -> Vec<Id>;
    fn next(&mut self) -> Id;
}

A randomizer must implement an iterator, plus a preview function which returns a number of lookahead pieces.

Required Methods

fn preview(&mut self, lookahead: usize) -> Vec<Id>

Return a vector containing the next n pieces that will be retrieved by the iterator.

n must be < lookahead else a panic will be issued.

fn next(&mut self) -> Id

Return the next block value in this sequence.

All sequences should be infinite, and iterator use is limited so we use a custom function on this trait instead of implementing Iterator.

Implementors