Skip to content

Instantly share code, notes, and snippets.

@sireliah
Created February 9, 2019 12:50
Show Gist options
  • Select an option

  • Save sireliah/fe5fac19b508c14567bd8bae77e9dd90 to your computer and use it in GitHub Desktop.

Select an option

Save sireliah/fe5fac19b508c14567bd8bae77e9dd90 to your computer and use it in GitHub Desktop.
let directions = &["down", "left", "up", "right"];
while !stop {
for direction in directions {
turn += 1;
for _ in 0..times {
if counter < numbers_len {
stop = self.move_cursor(&mut x, &mut y, direction);
if numbers[counter] == 1 {
img.put_pixel(x, y, pixel)
}
counter += 1;
}
}
if turn == 2 {
times += 1;
turn = 0;
}
}
if (counter >= numbers_len) | (x <= 2) {
stop = true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment