This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from random import randint | |
import pygame | |
from pygame.locals import * | |
import time | |
W = 10 | |
PLAYER = 20 | |
ROBOT = 30 | |
DEAD_ROBOT = 35 | |
HAZARD = 40 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class State: | |
state_handlers = { | |
's_open': ('h_open', 'h_num'), | |
's_close': ('h_close', 'h_op'), | |
's_num': ('h_num'), | |
's_op': ('h_op') | |
} | |
state_map = { | |
'h_open': 's_open', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def read_chunk(dst, src, chunk_size, pos, len_src): | |
while chunk_size > 0 and pos < len_src: | |
dst.append(src[pos]) | |
pos += 1 | |
chunk_size -= 1 | |
return pos | |
def get_bingo_size(pos, chunk_size, len_src): | |
if pos + chunk_size > len_src: | |
return len_src - pos |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate sdl2; | |
use sdl2::rect::Rect; | |
use sdl2::pixels::Color; | |
use sdl2::render::WindowCanvas; | |
use std::time::Duration; | |
trait Renderer { | |
fn render( | |
& self, canvas: & mut WindowCanvas, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$infile = $argv[1]; // font image file name | |
$w = $argv[2]; // font char width | |
$h = $argv[3]; // font char height | |
$color_x = $argv[4] ?? 0; // x coordinate of font color sample | |
$color_y = $argv[5] ?? 0; // y coordinate of font color sample | |
$img = imagecreatefrompng($infile); | |
$img_w = imagesx($img); | |
$img_h = imagesy($img); |