Package: pytetris
PyTetrisTable of ContentsPyTetrisTable of ContentsOverviewScreenshotsPlay the GameInstallStartHow to PlayPierre DellacherieLanding HeightEroded Piece Cells MetricBoard Row TransitionsBoard Column TransitionsBoard Buried HolesBoard WellsTotalPriorityResult PreviewProject Development SetupOverviewSimple tetris game made by pygameInspired byreact-tetrisAI algorithm: Pierre Dellacherie (El-Tetris)ScreenshotsPlay the GameInstallpip3installpytetrisStartRun the following command in the environment which you installed the pytetris package or under the project folder:python-mpytetrisor you can run the project in the project folder bypoetryrungameHow to PlayIn the home page, you can use←→or click the button to change to start level and use↑↓to change the start random line number.↑: Rotate the piece←→: Move the piece left or right↓: Speed up the pieceSPACE: Drop down the pieceP: Pause the gameS: Mute controlR: Reset the game (will loss current score)A: Make AI on or offPierre DellacheriePierre Dellacherie is a one-piece algorithm.Six main features:Landing HeightThe height where the piece is put. Top or center of the piece is both ok.Example::white_large_square::white_large_square::white_large_square::white_large_square::white_large_square::blue_square::white_large_square::white_large_square::white_large_square::white_large_square::white_large_square::white_large_square::black_large_square::black_large_square::blue_square::blue_square::black_large_square::black_large_square::white_large_square::white_large_square::black_large_square::black_large_square::black_large_square::black_large_square::blue_square::black_large_square::black_large_square::black_large_square::black_large_square::black_large_square::black_large_square::white_large_square::white_large_square::black_large_square::black_large_square::black_large_square::black_large_square::black_large_square::black_large_square::black_large_square:Height:4or3Eroded Piece Cells MetricThe number of rows eliminated × The number of the squares the piece contributedExample::white_large_square::white_large_square::white_large_square::white_large_square::white_large_square::blue_square::white_large_square::white_large_square::white_large_square::white_large_square::white_large_square::white_large_square::black_large_square::black_large_square::blue_square::blue_square::black_large_square::black_large_square::white_large_square::white_large_square::black_large_square::black_large_square::black_large_square::black_large_square::blue_square::black_large_square::black_large_square::black_large_square::black_large_square::black_large_square::black_large_square::white_large_square::white_large_square::black_large_square::black_large_square::black_large_square::black_large_square::black_large_square::black_large_square::black_large_square:Eliminated lines:1Contribute:1Eroded Piece Cells Metric:1 × 1 = 1Board Row TransitionsThe total number of row transitions. A row transition occurs when an empty cell is adjacent to a filled cell on the same row and vice versa.Tips:Both sides of the wall is concerned as filled.Example::negative_squared_cross_mark::white_large_square::white_large_square::black_large_square::black_large_square::white_large_square::white_large_square::black_large_square::black_large_square::white_large_square::white_large_square::negative_squared_cross_mark:Single Row Transitions:6Board Column TransitionsThe total number of column transitions. A column transition occurs when an empty cell is adjacent to a filled cell on the same column and vice versa.Tips:Both sides of the wall is concerned as filled.Example::negative_squared_cross_mark::white_large_square::black_large_square::black_large_square::white_large_square::black_large_square::negative_squared_cross_mark:Single Column Transitions:4Board Buried HolesThe total number of column holes. A hole is an empty cell that has at least one filled cell above it in the same column.Example::white_large_square::black_large_square::black_large_square::white_large_square::black_large_square:Single Column Holes:1Board WellsThe total number of column wells. A well is a succession of empty cells such that their left cells and right cells are both filled.Tips:As long as there are filled cells on both sides, the empty cell is concerned as well.Example::white_large_square::white_large_square::black_large_square::black_large_square::white_large_square::black_large_square::black_large_square::black_large_square::black_large_square::black_large_square::white_large_square::black_large_square::black_large_square::white_large_square::black_large_square:Wells:(1) + (1+2) = 4TotalThe evaluation function is a linear sum of all the above features. Bigger value will be better.FeatureWeightLanding Height-4.500158825082766Eroded Piece Cells Metric3.4181268101392694Board Row Transitions-3.2178882868487753Board Column Transitions-3.2178882868487753Board Buried Holes-7.899265427351652Board Wells-3.3855972247263626Prioritypriority = 100 * moving_steps + rotation_timesWe choose the action which priority is lower if there are two or more same evaluation actions.Result PreviewProject Development SetupClone the repository then install dependencies.poetryinstall--no-rootor you can install the dependencies using pip:pip3installpygamenumpy