Pandora’s Blocks wrapper

class pyboy.plugins.game_wrapper_pandoras_blocks.GameWrapperPandorasBlocks(*args, **kwargs)[source]

Bases: PyBoyGameWrapper

This class wraps Pandora’s Blocks and provides easy access to score, lines and level for AIs.

Pandora’s Blocks uses its level as the number of lines cleared, so lines and level have the same value. If you call print on an instance of this object, it will show an overview of everything this object provides.

mapping_compressed

Compressed mapping for pyboy.PyBoy.game_area_mapping

mapping_minimal

Minimal mapping for pyboy.PyBoy.game_area_mapping

score

The score provided by the game

level

The current level

lines

The number of cleared lines

start_game(timer_div=None)[source]

Call this function right after initializing PyBoy. This navigates through the intro and menu to start the game at the first playable state.

The title-screen state is saved, and using reset_game, you can get back to this point instantly.

Parameters:

timer_div (int) – Replace timer’s DIV register with this value.

reset_game(timer_div=None)[source]

After calling start_game, you can call this method at any time to reset the game.

Parameters:

timer_div (int) – Replace timer’s DIV register with this value.

game_area()[source]

Return the 10 by 18 playfield as a matrix of tile identifiers.

The score, lines cleared, and level are available as attributes of this class.

next_block()[source]

Return the next block to drop.

Returns:

str identifying the block: "I", "Z", "S", "J", "L", "O" or "T".

Return type:

shape

set_block(shape)[source]

Set the next block to drop.

Parameters:

shape (str) – One of "I", "Z", "S", "J", "L", "O" or "T".

game_over()[source]

Return whether the current game has reached a game-over state.