Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

commits #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified BIN +0 Bytes (100%) .DS_Store
Binary file not shown.
21 changes: 21 additions & 0 deletions 21 LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 RahulShagri

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
11 changes: 2 additions & 9 deletions 11 README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
# Sudoku Game In Python
# Tetris Game In Python


### run:

* python gui.py

### Mac

* python3 gui.py
<img src="resources/tetris.png">
31 changes: 31 additions & 0 deletions 31 block_speeds_data.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
level,speed
0,15.974
1,14.31
2,12.646
3,10.982
4,9.318
5,7.654
6,5.99
7,4.326
8,2.662
9,1.997
10,1.664
11,1.664
12,1.664
13,1.331
14,1.331
15,1.331
16,0.998
17,0.998
18,0.998
19,0.666
20,0.666
21,0.666
22,0.666
23,0.666
24,0.666
25,0.666
26,0.666
27,0.666
28,0.666
29,0.333
77 changes: 77 additions & 0 deletions 77 config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Sets up all important config variables
import dearpygui.dearpygui as dpg

# Set up all IDs required by items in Dear PyGui
item_id = {
"windows": {
"main_window": dpg.generate_uuid(),
"score_window": dpg.generate_uuid(),
"tetris_board": dpg.generate_uuid(),
"next_block_board": dpg.generate_uuid(),
"statistics_window": dpg.generate_uuid(),
},
"displays": {
"enter_level": dpg.generate_uuid(),
"level_text": dpg.generate_uuid(),
"full_line_text": dpg.generate_uuid(),
"score_text": dpg.generate_uuid(),
"I_block_stat": dpg.generate_uuid(),
"J_block_stat": dpg.generate_uuid(),
"L_block_stat": dpg.generate_uuid(),
"O_block_stat": dpg.generate_uuid(),
"S_block_stat": dpg.generate_uuid(),
"T_block_stat": dpg.generate_uuid(),
"Z_block_stat": dpg.generate_uuid(),
"Total_block_stat": dpg.generate_uuid(),
},
"registries": {
"texture_registry": dpg.generate_uuid(),
"key_release_handler": dpg.generate_uuid(),
"mouse_release_handler": dpg.generate_uuid(),
},
"buttons": {
"play_button": dpg.generate_uuid(),
},
"block_texture": {
"I_block": dpg.generate_uuid(),
"J_block": dpg.generate_uuid(),
"L_block": dpg.generate_uuid(),
"O_block": dpg.generate_uuid(),
"S_block": dpg.generate_uuid(),
"T_block": dpg.generate_uuid(),
"Z_block": dpg.generate_uuid(),
},
"blocks": {
},
}

# Names of all blocks
block_names = ["I", "J", "L", "O", "S", "T", "Z"]

# Set up lists to track walls and cells occupied
cell_boundary1 = [[n, -1] for n in range(10)] # Bottom Wall
cell_boundary2 = [[10, n] for n in range(20)] # Right Wall
cell_boundary3 = [[n, 20] for n in range(10)] # Top Wall
cell_boundary4 = [[-1, n] for n in range(20)] # Left Wall

cell_boundary = cell_boundary1 + cell_boundary2 + cell_boundary3 + cell_boundary4 # All points in all walls combined
cells_occupied = [] # List of all cells occupied by tetris blocks

# List of all block numbers active on the tetris board
block_numbers = []

# Count of blocks created
block_count = 0

# Flag to check if the last block is moving or not. 0=Stationary, 1-7=Corresponding type of block in motion
block_moving_flag = 0

# Keep track of level and corresponding speed
level = 0
speed = 0

# Keep track of full lines completed
full_lines = 0

# Keep track of score
score = 0
Binary file removed BIN -6 KB data/.DS_Store
Binary file not shown.
Empty file removed 0 data/Highscore.txt
Empty file.
Binary file removed BIN -6 KB data/audios/.DS_Store
Binary file not shown.
Binary file removed BIN -64.4 KB data/audios/Crash.mp3
Binary file not shown.
Binary file removed BIN -7.56 MB data/audios/game.mp3
Binary file not shown.
Binary file removed BIN -4.21 MB data/audios/rtn.mp3
Binary file not shown.
Binary file removed BIN -6 KB data/images/.DS_Store
Binary file not shown.
Binary file removed BIN -1.91 MB data/images/Background.png
Binary file not shown.
Binary file removed BIN -63.9 KB data/images/Car.png
Binary file not shown.
Binary file removed BIN -24.8 KB data/images/Coming Cars/CC1.png
Binary file not shown.
Binary file removed BIN -22.8 KB data/images/Coming Cars/CC2.png
Binary file not shown.
Binary file removed BIN -18.1 KB data/images/Coming Cars/CC3.png
Binary file not shown.
Binary file removed BIN -14 KB data/images/Coming Cars/CC4.png
Binary file not shown.
Binary file removed BIN -13.9 KB data/images/Coming Cars/CC5.png
Binary file not shown.
Binary file removed BIN -13.2 KB data/images/Coming Cars/CC6.png
Binary file not shown.
Binary file removed BIN -14.1 KB data/images/Coming Cars/CC7.png
Binary file not shown.
Binary file removed BIN -26.7 KB data/images/Coming Cars/CC8.png
Binary file not shown.
Binary file removed BIN -24.5 KB data/images/Coming Cars/CC9.png
Binary file not shown.
Binary file removed BIN -40.7 KB data/images/Explosion.png
Binary file not shown.
Binary file removed BIN -24.4 KB data/images/Fuel.png
Binary file not shown.
Binary file removed BIN -2.13 MB data/images/GameOver.png
Binary file not shown.
Binary file removed BIN -24.5 KB data/images/Going Cars/GC1.png
Binary file not shown.
Binary file removed BIN -22.2 KB data/images/Going Cars/GC2.png
Binary file not shown.
Binary file removed BIN -18.1 KB data/images/Going Cars/GC3.png
Binary file not shown.
Binary file removed BIN -14.2 KB data/images/Going Cars/GC4.png
Binary file not shown.
Binary file removed BIN -14.3 KB data/images/Going Cars/GC5.png
Binary file not shown.
Binary file removed BIN -13.2 KB data/images/Going Cars/GC6.png
Binary file not shown.
Binary file removed BIN -14.3 KB data/images/Going Cars/GC7.png
Binary file not shown.
Binary file removed BIN -26.2 KB data/images/Going Cars/GC8.png
Binary file not shown.
Binary file removed BIN -24.2 KB data/images/Going Cars/GC9.png
Binary file not shown.
Binary file removed BIN -13.7 KB data/images/LeftDisplay.png
Binary file not shown.
Binary file removed BIN -13 KB data/images/RightDisplay.png
Binary file not shown.
Binary file removed BIN -3.9 MB data/images/Road.png
Diff not rendered.
Binary file removed BIN -147 KB data/images/Sand.jpg
Diff not rendered.
Binary file removed BIN -282 Bytes data/images/Strip.png
Diff not rendered.
Binary file removed BIN -92.5 KB data/images/Tree.png
Diff not rendered.
Binary file added BIN +80.5 KB fonts/PressStart2P-vaV7.ttf
Binary file not shown.
3 changes: 3 additions & 0 deletions 3 requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dearpygui==1.0.2
pandas==1.3.4
playsound2==0.1
Binary file added BIN +216 KB resources/tetris.png
Binary file added BIN +14.7 KB sounds/clear.wav
Binary file not shown.
Binary file added BIN +7.6 KB sounds/fall.wav
Binary file not shown.
Binary file added BIN +94.2 KB sounds/gameover.wav
Binary file not shown.
Binary file added BIN +6.1 KB sounds/line.wav
Binary file not shown.
Binary file added BIN +14.2 KB sounds/selection.wav
Binary file not shown.
Binary file added BIN +37.4 KB sounds/success.wav
Binary file not shown.
Binary file added BIN +1.28 MB sounds/theme.mp3
Binary file not shown.
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.