TetrisAI - Tetris AI Bot using computer vision to play game automatically

Overview

Tetris AI

Tetris AI Bot using computer vision to play game automatically

  • bot.py - main application.
  • criteria.py - AI part, includes fitness function and attributes.
  • recognition.py - Computer Vision part.
  • tetromino.py - some information about tetrominoes (shape, color, start position).

Watch the video

click on the picture to see demo

Computer Vision

How it works?

When bot started he try to find game aplication and wait until game is started. When game is started bot detectes the board, the tetrominoes in the game using Opencv. Grabs the images in realtime and transfroms board to bollean matrix (0 - empty cell , 1 - occupied cell) and identify current tetromino...

AI algorithm

When all information about the board is known, AI determines all possible positions of the current tetromino on the board. Choose the best possible position via fitness function and transmits all the necessary moves by emulating keystrokes on the keyboard.

Fitness function parameters:

  • Height - maximum height of the grid.
  • Aggregate Height - the sum of the height of each column.
  • Number of lines cleared - the number of complete lines in the grid.
  • Number of holes - empty space such that there is at least one tile in the same column above.
  • Bumpiness - sum of the difference between heights of adjacent pairs of columns.

How to try

Work only on Windows OS

alt text

  • Download bot.exe from dist folder
  • Configurate game options

alt text

  • Run bot.exe
  • Start new Game
  • Enjoy:)

alt text

You might also like...
Bingo game now in python play as much you want :) no need to give me credit it's open as fuck
Bingo game now in python play as much you want :) no need to give me credit it's open as fuck

Bingo-py-game A game coded with Python Introduction This is a Terminal-based game currently in its initial stage. I am working on adding more efficien

A python-based multi-player online educational game for students to play in a class or club setting.
A python-based multi-player online educational game for students to play in a class or club setting.

Kurono (codename: aimmo) Code for Life has been developed by Ocado Technology as a free, open-source project to inspire the next generation of compute

Easy and fun game to play a bit. Written in python
Easy and fun game to play a bit. Written in python

NumGuesser Easy and fun game to play a bit. Written in python

Average Clicker Game (AVG) is a Python made game using tkinter

Average-Clicker-Game Average Clicker Game (AVG) is a Python clicker game not made with pygame but with tkinter, it has worker, worker upgrades, times

Adventure-Game - Adventure Game which is created using Python

Adventure Game 🌇 This is a Adventure Game which is created using Python. Featur

Scalable computer implemented in the game of life.

scalable-gol-computer This is a computer built in Conway’s game of life. It supports variable sizes of 8, 16 and 32 bit. Maximum program size: 256 lin

Lucky Balls is gambling game where user try to guess 6 numbers from 1 to 48 that computer has picked.
Lucky Balls is gambling game where user try to guess 6 numbers from 1 to 48 that computer has picked.

LUCKY BALLS Lucky Balls is gambling game where user try to guess 6 numbers from 1 to 48 that computer has picked. INSTRUCTIONS User input his bet, tha

SnailJumper - A game that is developed as an assignment for Computer Intelligence course
SnailJumper - A game that is developed as an assignment for Computer Intelligence course

Snail jumper Neuroevolution game assignment. Fall 2021 - Computer Intelligence.

A rhythm-based game that automatically generates obstacles based on a song's features.
A rhythm-based game that automatically generates obstacles based on a song's features.

DISCLAIMER: This is my first coding project, created in December 2019. The game may not be optimized, and looking back on it, there are a lot of chang

Owner
null
The original Tetris tile-matching game as adopted by IBM PC.

??️ Tetris Game The original Tetris tile-matching game as adopted by IBM PC. Game developed purely on python using the Dear PyGui Framework. ?? Instru

null 14 Nov 12, 2022
A Tetris Game for programming education

Tetris Game プログラミング学習を目的とした、ブロックを操作してスコアを競うゲームです。 FAQはこちら。 tutorialはこちら。 実行環境準備 Mac環境 Finder→Application→Utility→Terminalから、ターミナルを起動して以下コマンドを実行する。 # i

null 11 Dec 1, 2022
Play a game of Phazed with a bot or with other players or watch bots play with each other

Phazed Game and Player play a game of Phazed with a bot or with other players or watch bots play with each other Live Demo hosted on repl.it (makes su

Xin Yu 0 Aug 28, 2021
Creating Tetris with Pygame

Tetris ?? Contributing Contributions, issues and feature requests are welcome! Feel free to check issues page. Show your support Give a ⭐️ if this pro

Gavin Capriola 0 Mar 1, 2022
A Gomoku game GUI using pygame where the user can choose to play against another player or an AI using minimax with alpha-beta pruning

Gomoku A GUI based Gomoku game using pygame where the user can choose to play against another player or an AI using minimax with alpha-beta pruning. R

Mingyu Liu 1 Oct 30, 2021
An automation bot to play Myuu Discord game

Auto selfbot Myuu is a self Discordbot, meaning it will use your TOKEN to logged as your account and take commands from yourself to play the game.

null 6 Dec 15, 2022
Blender Game Engine Game Type Templates Logic Bricks (and Python script) based Game Templates for Blender

Blender-Game-Engine-Templates Blender Game Engine Game Type Templates Logic Bric

null 3 Oct 25, 2022
Simple program to play Metamon automatically

Getting Started Radio Caca Important disclaimer This software is intended for use by individuals familiar with Python programming language. It uses se

Metamon Island 35 Dec 28, 2022
This is a simple telegram bot for the game Pyal, a word guessing game inspired by Wordle

Pyal Telegram Bot This is a simple telegram bot for the game Pyal, a word guessing game inspired by Wordle. How does it work? Differently from the ori

Rafael Omiya 4 Oct 6, 2022
Use different orders of N-gram model to play Hangman game.

Hangman game The Hangman game is a game whereby one person thinks of a word, which is kept secret from another person, who tries to guess the word one

ZavierYang 4 Oct 11, 2022