Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dzimiks/tetrisai
AI bot that can play Tetris. It was a seminary project for Intelligent systems course.
https://github.com/dzimiks/tetrisai
game java javaswing tetris
Last synced: 17 days ago
JSON representation
AI bot that can play Tetris. It was a seminary project for Intelligent systems course.
- Host: GitHub
- URL: https://github.com/dzimiks/tetrisai
- Owner: dzimiks
- Created: 2017-10-25T21:26:49.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2017-11-01T19:52:20.000Z (about 7 years ago)
- Last Synced: 2024-11-09T05:38:09.799Z (2 months ago)
- Topics: game, java, javaswing, tetris
- Language: Java
- Homepage:
- Size: 27.3 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# RAF TetrisAI
This is seminary work project written in Java. It represents basic Tetris simulation.
![](https://i.imgur.com/jjAlkL3.png)
## Getting Started
Here are explanation and instructions how to play a game.
To play as human, run Frame class (use arrow keys).
To see AI Bot in action, run TetrisBot class.
To test multiple games at once, run TetrisTester class with appropriate settings.### Frame
This extends JFrame and it is instantiated to draw a state.
The main function allows you to play a game manually using the arrow keys (UP, RIGHT, BOTTOM, LEFT).### Label
Drawing library.
### State
This simulates a whole game. It keeps track of the state and allows you to make moves.
Moves are defined by two numbers: the **SLOT**, the leftmost column of the piece and the **ORIENT**,
the orientation of the piece.
NextPiece (accessed by getNextPiece) contains the ID (0-6) of the piece you are about to play.
It also keeps track of the number of lines cleared - accessed by getRowsCleared().```
draw() - draws the board
drawNext() - draws the next piece above the board
clearNext() - clears the drawing of the next piece so it can be drawn in a different slot / orientation
```
### TetrisBotHere is implemented AI Bot player.
The main function plays a game automatically (with visualization).
You can set speed in main function.### TetrisTester
Class that tests one or multiple instances of the game.
```
TEST - number of tests (don't overstate)
DRAW - true or false, if true, be careful with number of tests
```Languages Used:
* JavaTools Used:
* Swing (for GUI)
* Eclipse (IDE)