Open daniel2644 opened 1 year ago
Hi, this code was actually written to be used on either https://tetris.com/play-tetris (with play.py) or jstris (with play.jstris.py). Both these examples work by checking if each cell is pure black or not to check if there is a tetromino in that cell. Since you're trying this with a different Tetris game where empty cells are not black, the code thinks every space is filled which might be causing the error. There might be other problems but that seems the most obvious one to me right now. You will probably need to modify some of the functions to get it to work for your version of Tetris.
I would really like it to work in my version, but I don't know what exactly to modify because there are different colors rgb
in this version, what you gave me also does not work, error:
Traceback (most recent call last):
File "C:\Users\Daniel\Desktop\Nowy folder\phbot tetris2\tetris-ai-9000-master\main.py", line 75, in
Hi there, after taking a look at the code again it looks like it's currently using the game runner for the Jstris version of Tetris instead of for the one on https://tetris.com/play-tetris, which is still buggy. Try going to genetic_algorithm.py and commenting out line 2 and uncomment line 1. And just to make sure, Don't forget to also run the display_config.py script to properly configure the AI to read from your specific device and make sure the display_config.txt file has been rewritten with the results you saw in the terminal. Hopefully, that will at least get it to work for https://tetris.com/play-tetris, though it's important to note that this was coded up on a Mac and there may be other bugs with trying to run it on Windows. ALSO it is important when running this AI on https://tetris.com/play-tetris that you set the game to start at level 20, the AI is going to play poorly if it starts at a lower level due to how it processes the information from the screenshots.
If the above instructions can at least get it to run then modifications can start being made to make it work for your specific version of Tetris. Hope that helps!
how to fix error?: = RESTART: C:\Users\Daniel\Desktop\Nowy folder\python tetris bot\tetris-ai-9000-master\main.py Traceback (most recent call last): File "C:\Users\Daniel\Desktop\Nowy folder\python tetris bot\tetris-ai-9000-master\main.py", line 75, in
play()
File "C:\Users\Daniel\Desktop\Nowy folder\python tetris bot\tetris-ai-9000-master\main.py", line 67, in play
run_game(weights, play_mode=True, display=terminal_view)
File "C:\Users\Daniel\Desktop\Nowy folder\python tetris bot\tetris-ai-9000-master\play_jstris.py", line 28, in run_game
game_data = get_raw_data()
File "C:\Users\Daniel\Desktop\Nowy folder\python tetris bot\tetris-ai-9000-master\functions.py", line 37, in get_raw_data
if (img_data[game_coords] == EMPTY_SPACE).all():
IndexError: index 319 is out of bounds for axis 1 with size 291
full screen tetris: https://gyazo.com/1fe6a76dfeed53480fae09bc572bf42f