Skip to content

ivankozlovcodes/filler

Repository files navigation

filler

TOC

What is it about?

Creator: 42 staff. Task description

Filler is a game, where two players / algorithm are fighting on a map.

A virtual machine organizes the game :

calls the players alternatively give each a random piece

On each turn, the current player have to put his piece on the map, and try to bother the enemy. To put a piece, the player have to write its coordinates in the "Y X\n" format on the standard input (stdin).

The game appears on the standard input.

The aim of the game is to put more pieces on the map than the enemy.

The purpose is to make the smallest possible "square" (which can contain holes) with a given list of tetriminos(tetris pieces), but the disposition must be as such that it returns the first possible solution when placing them recursively from the top left.

Usage

Download and compile repo:

    git clone https://github.com/IvanKozlov95/filler
    cd filler
    make

Player ikozlov.filler will be created.

Examples

In order to see what does player do we need to make him fight! From cloned directory:

    cd resources
    ./filler_vm -f maps/map01 -p1 ../ikozlov.filler -p2 players/abanlin.filler
    * see the result in terminal output *

There are several maps available in resources/maps folder. Also several bots for testing in /resources/players.
You can make my bot fight against other peoples bots. Try this one.

Visualizer

On big maps it's difficult to see what is really happening. That's why I've also create a visualizer using python's tkinter library.
In order to see it working simply pipe the virtual machine output to visualizer.

    ./filler_vm -f maps/map01 -p1 ../ikozlov.filler -p2 players/abanlin.filler | python3 ../visualizer/visualizer.py

Author

This project was developed by Ivan Kozlov @ivankozlov95.

License

This project is licensed under the GNU General Public License 3.