<commit_before>use piston_window::*;
use piston_window::grid::Grid;

use colors::GREY;
use tetromino::*;
use settings::*;

enum GameState {
    Playing,
    Paused
}

#[derive(Clone, Copy)]
enum CellState {
    Empty,
    Block(types::Color)
}
impl CellState {
    fn draw(&self, x: u32, y: u32, context: Context, graphics: &mut G2d) {
        match *self {
            CellState::Block(color) => {
                let square = rectangle::square(
                    0.0, 0.0, BLOCK_SIZE - (2.0 * GRID_LINE_WIDTH)
                );
                let transform = context.transform
                    // Move the origin of the transform based on where the grid starts
                    .trans(GRID_X_OFFSET, GRID_Y_OFFSET)
                    // Move the square into the first grid cell (off of the bounding box)
                    .trans(GRID_LINE_WIDTH, GRID_LINE_WIDTH)
                    // Move the square into the proper grid cell based on x and y
                    .trans((x as f64)*BLOCK_SIZE, (y as f64)*BLOCK_SIZE);
                rectangle(color, square, transform, graphics);
            },
            CellState::Empty => {}
        }
    }
}

pub trait Game {
    fn on_input(&mut self, input: Input);
    fn on_update(&mut self, update_args: UpdateArgs);
    fn on_render(&mut self, render_args: RenderArgs, e: PistonWindow);
}

pub trait Renderer {
    fn render(&self, context: Context, graphics: &mut G2d);
}
<commit_msg>update the comments around the cell state transformations<commit_after>use piston_window::*;
use piston_window::grid::Grid;

use colors::GREY;
use tetromino::*;
use settings::*;

enum GameState {
    Playing,
    Paused
}

#[derive(Clone, Copy)]
enum CellState {
    Empty,
    Block(types::Color)
}
impl CellState {
    fn draw(&self, x: u32, y: u32, context: Context, graphics: &mut G2d) {
        match *self {
            CellState::Block(color) => {
                let square = rectangle::square(
                    0.0, 0.0, BLOCK_SIZE - (2.0 * GRID_LINE_WIDTH)
                );
                let transform = context.transform
                    // Translate the origin of the transform based on where the grid starts
                    .trans(GRID_X_OFFSET, GRID_Y_OFFSET)
                    // Translate the square into the first grid cell (off of the bounding box)
                    .trans(GRID_LINE_WIDTH, GRID_LINE_WIDTH)
                    // Translate the square into the proper grid cell based on the grid x and y position
                    .trans((x as f64)*BLOCK_SIZE, (y as f64)*BLOCK_SIZE);
                rectangle(color, square, transform, graphics);
            },
            CellState::Empty => {}
        }
    }
}

pub trait Game {
    fn on_input(&mut self, input: Input);
    fn on_update(&mut self, update_args: UpdateArgs);
    fn on_render(&mut self, render_args: RenderArgs, e: PistonWindow);
}

pub trait Renderer {
    fn render(&self, context: Context, graphics: &mut G2d);
}

{'fraction_non_alphanumeric': 0.10494450050454086, 'fraction_numerical': 0.010763538513286243, 'mean_word_length': 2.11413612565445, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2036499', 'n_tokens_mistral': 905, 'n_tokens_neox': 861, 'n_words': 270}