Struct num_huarongdao::num_hrd::NumHrd [−][src]
fifteen puzzle game lib 数字华容道
Usage :
use num_huarongdao::num_hrd::NumHrd; // 生成一个3 x 3的游戏 let mut num_hrd = NumHrd::new(&3); num_hrd.move_num(1usize);
Implementations
impl NumHrd
[src]
pub fn new(s: &u8) -> Self
[src]
create a num huarongdao s: side num
pub fn as_2d_vec(&self) -> Vec<Vec<usize>>
[src]
返回2维坐标数组
pub fn exchange(
&mut self,
one_index: &usize,
other_index: &usize
) -> Result<(), ErrorKind>
[src]
&mut self,
one_index: &usize,
other_index: &usize
) -> Result<(), ErrorKind>
交换两个块的位置
pub fn is_neighbouring(&self, one: &usize, other: &usize) -> bool
[src]
两个块是否相邻
pub fn num_by_index(&self, n: &usize) -> Option<&Num>
[src]
get Num ref object by index of nums
pub fn num_by_point(&self, p: (u8, u8)) -> Option<&Num>
[src]
get Num ref object by point(row_index, col_index) of nums
pub fn data(&self) -> &Vec<Num>
[src]
pub fn index_by_point(&self, p: (u8, u8)) -> usize
[src]
pub fn size(&self) -> &u8
[src]
pub fn index_by_n(&self, n: &usize) -> Option<usize>
[src]
得到某个数字的索引
pub fn is_win(&self) -> bool
[src]
判断是否成功
pub fn len(&self) -> usize
[src]
pub fn zero_move(&mut self, d: &Direction) -> Result<bool, ErrorKind>
[src]
移动空格所在的位置 d: direction 空格想移动的方向
pub fn move_num(&mut self, index: usize) -> bool
[src]
移动指定索引的块
pub fn move_num_by_point(&mut self, point: (u8, u8)) -> bool
[src]
Trait Implementations
impl Clone for NumHrd
[src]
impl Debug for NumHrd
[src]
impl PartialEq<NumHrd> for NumHrd
[src]
impl StructuralPartialEq for NumHrd
[src]
Auto Trait Implementations
impl RefUnwindSafe for NumHrd
impl Send for NumHrd
impl Sync for NumHrd
impl Unpin for NumHrd
impl UnwindSafe for NumHrd
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> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
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>,