// check if the position of the snake is out of bounds
check if the position of the snake is out of bounds
check if the position of the snake is out of bounds
fn is_valid(&self, size: Size) -> bool {
        let x = self.position.x;
        let y = self.position.y;
        x >= 0
            && y >= 0
            && x <= (size.width / BLOCK_SIZE) as i32
            && y <= (size.height / BLOCK_SIZE) as i32
    }
fn is_valid ( & self , size : Size ) -> bool { let x = self . position . x ; let y = self . position . y ; x >= 0 && y >= 0 && x <= ( size . width / BLOCK_SIZE ) as i32 && y <= ( size . height / BLOCK_SIZE ) as i32 }
check if the position of the snake is out of bounds
check if the position of the snake is out of bounds
&self
size
Size