[−][src]Struct wasm_terminal_2048::tile::Board
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]
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
Auto Trait Implementations
impl !RefUnwindSafe for Board
[src]
impl !Send for Board
[src]
impl !Sync for Board
[src]
impl Unpin for Board
[src]
impl !UnwindSafe for Board
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,