[][src]Struct wasm_terminal_2048::tile::Board

pub struct Board { /* fields omitted */ }

Board includes 16 tile values and a random generator for a new tile gneration. Also, it includes methods for the tile movement and how to display a board with internal tiles.

Implementations

impl Board[src]

pub fn new(val: Vec<u16>) -> Self[src]

Create a new Board object with the given tile values

Arguments

  • values 16 tile values

pub fn get_values(&self) -> &Vec<u16>[src]

Get tile values

pub fn move_up(&mut self)[src]

Move up all tiles

pub fn move_down(&mut self)[src]

Move down all tiles

pub fn move_left(&mut self)[src]

Move left all tiles

pub fn move_right(&mut self)[src]

Move right all tiles

pub fn generate_new_tile(&mut self) -> bool[src]

Find an empty tile and set the tile by a random value

pub fn reset(&mut self)[src]

Reset all tile values to 0

pub fn draw(&self, f: &mut Formatter<'_>) -> Result<(), Error>[src]

Used for Display trait, that returns a drawn board

Trait Implementations

impl Default for Board[src]

impl Display for Board[src]

Auto Trait Implementations

Blanket Implementations

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

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

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

impl<T> From<T> for T[src]

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

impl<T> ToString for T where
    T: Display + ?Sized
[src]

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,