Git Product home page Git Product logo

tetrisai's Introduction

Tetris AI

GitHub Workflow Status (with event) GitHub top language GitHub language count License: MIT Project Version

Cogito Image

Description

This project is our attempt at making an AI that can play Tetris. First of all we made the environment (the game itself) and then we started working on multiple AI's that can play the game. The AI's are based on different algorithms and strategies. We have implmented:

  • Random agent
  • Heuristic agent with set weights
  • Genetic algorithm to find the best weights for the heuristic agent

The game is playable/viable both in the terminal and in a GUI. The GUI is made with Pygame.

How to run and install

  • Have python installed (tested with 3.10+ but should work on older versions as well)
  • Have pip installed
  • Clone the repository
  • Set up a virtual environment (optional but recommended) see here for a guide
  • Install the required packages with pip
pip install -r requirements.txt
  • Done! You are now ready to run the game

Usage

To play the game yourself, run the following command:

python main.py play

To let the agent play the game, run the following command:

python main.py agent <agent>

where <agent> is the agent you want to use. The available agents are: random, heuristic, genetic

To train the genetic agent, run the following command:

python main.py train

Testing

To run the test suite, run the following command from the root directory of the project:

python -m pytest

Team

The team behind this project is a group of students at NTNU in Trondheim, Norway, developed during the spring semester of 2024. The team consists of:

Eduard-Prokhorikhin
Eduard Prokhorikhin
henrinha
Henrik Haaland
HFossdal
Håvard Fossdal
JonBergland
Jon Bergland
maiahi
Maia Austigard
oystkva
Øystein Kvandal
SindreFossdal
Sindre Fossdal

Group picture

tetrisai's People

Contributors

eduard-prokhorikhin avatar henrinha avatar hfossdal avatar jonbergland avatar maiahi avatar oystkva avatar sfossdal avatar sindrefossdal avatar sverrenystad avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

tetrisai's Issues

Test

Vi prøver ut issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.