pub fn flip(board: &mut [[Option<Card>; 5]; 4], neighbours: [Option<Position>; 4]) {
        for i in 0..4 {
            if let Some(neighbour) = neighbours[i] {
                let n = board[neighbour.0][neighbour.1].as_mut().unwrap();
                match i {
                    // top & bottom
                    0 | 2 => swap(&mut n.top, &mut n.bottom),
                    // left & right
                    1 | 3 => swap(&mut n.right, &mut n.left),
                    _ => {}
                }
            }
        }
    }
// flip the facing value with the value of the other end
flip the facing value with the value of the other end
flip the facing value with the value of the other end
pub fn flip(board: &mut [[Option<Card>; 5]; 4], neighbours: [Option<Position>; 4]) {
        for i in 0..4 {
            if let Some(neighbour) = neighbours[i] {
                let n = board[neighbour.0][neighbour.1].as_mut().unwrap();
                match i {
                    // top & bottom
                    0 | 2 => swap(&mut n.top, &mut n.bottom),
                    // left & right
                    1 | 3 => swap(&mut n.right, &mut n.left),
                    _ => {}
                }
            }
        }
    }
pub fn flip ( board : & mut [ [ Option < Card > ; 5 ] ; 4 ] , neighbours : [ Option < Position > ; 4 ] ) { for i in 0 .. 4 { if let Some ( neighbour ) = neighbours [ i ] { let n = board [ neighbour . 0 ] [ neighbour . 1 ] . as_mut ( ) . unwrap ( ) ; match i { // top & bottom 0 | 2 => swap ( & mut n . top , & mut n . bottom ) , // left & right 1 | 3 => swap ( & mut n . right , & mut n . left ) , _ => { } } } } }
flip the facing value with the value of the other end
flip the facing value with the value of the other end
board
&mut [[Option<Card>; 5]; 4]
neighbours
[Option<Position>; 4]