[][src]Struct pleco::board::RandBoard

pub struct RandBoard { /* fields omitted */ }

Random Board generator. Creates either one or many random boards with optional parameters.

Examples

Create one Board with at least 5 moves played that is created in a pseudo-random fashion.

use pleco::board::{Board,RandBoard};

let rand_boards: Board = RandBoard::new()
    .pseudo_random(12455)
    .min_moves(5)
    .one();

Create a Vec of 10 random Boards that are guaranteed to not be in check.

use pleco::board::{Board,RandBoard};

let rand_boards: Vec<Board> = RandBoard::new()
    .pseudo_random(12455)
    .no_check()
    .many(10);

Methods

impl RandBoard[src]

pub fn new() -> Self[src]

Create a new RandBoard object.

pub fn many(self, size: usize) -> Vec<Board>[src]

Creates a Vec<Board> full of Boards containing random positions. The Vec will be of size 'size'.

pub fn one(self) -> Board[src]

Creates a singular Board with a random position.

pub fn pseudo_random(self, seed: u64) -> Self[src]

Turns PseudoRandom generation on. This allows for the same random Boards to be created from the same seed.

pub fn min_moves(self, moves: u16) -> Self[src]

Sets the minimum moves a randomly generated Board must contain.

pub fn in_check(self) -> Self[src]

Guarantees that the boards returned are only in check,

pub fn no_check(self) -> Self[src]

Guarantees that the boards returned are not in check.

pub fn from_start_pos(self) -> Self[src]

Generates Random Boards from the start position only

Trait Implementations

impl Default for RandBoard[src]

Auto Trait Implementations

impl Send for RandBoard

impl Sync for RandBoard

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.