Crate tetrs [] [src]

The tetrs library provides a number of low-level tasks for required for tetris gameplay. This library aims to be correct and provide easy extension for new frontends/rotation-systems etc.

Intra-module dependencies are reduced as much as possible. If a component does not require knowledge of another component, then it is likely not present. Some helper functions which do not adhere to this philosophy can be located in the utility module.

Finally, a fairly general high-level abstraction over these is provided with the engine module.

Examples

use tetrs::import::*;

let field = Field::new();
let mut block = Block::new(block::Id::I, &field);

block.rotate(&field, Rotation::R90);
block.shift_extend(&field, Direction::Down);

Modules

block

Defines a single tetrimino and actions for modifying it.

controller

An abstract controller for specifying actions.

engine

Implements a high-level engine which composes all the components into one abstract structure.

field

A tetris playfield.

history

Module which provides history management tools.

import

Convenience module providing default imports.

randomizer

Implements a randomizer.

rotation_system

This modules provides an interface for dealing with different block offsets.

schema

Methods for converting to and from a textual field representation.

statistics

Stores statistics about an individual game.

utility

Contains helper methods which expose more specific functions for particular primitives.

wallkick

A module for specifying wallkick tests.

Macros

schema_assert_eq!

Tests if two schema are equal.