Skip to content

Commit 03765bb

Browse files
author
hasnat163
committed
general improvements
1 parent 68c589c commit 03765bb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+152
-16
lines changed

out/production/Tetris-in-Java/.idea/.gitignore

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

out/production/Tetris-in-Java/.idea/libraries/Tetris_Game.xml

+9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

out/production/Tetris-in-Java/.idea/misc.xml

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

out/production/Tetris-in-Java/.idea/modules.xml

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

out/production/Tetris-in-Java/.idea/vcs.xml

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Tetris is one of the most iconic and enduring puzzle video games in the history of gaming. Conceived and programmed by Russian software engineer Alexey Pajitnov in 1984, it was released on June 6, 1984. Pajitnov created Tetris while working at the Dorodnitsyn Computing Centre of the Academy of Science of the USSR in Moscow, with the game's name deriving from the Greek numerical prefix "tetra-" (all of the game's pieces contain four segments) and tennis, Pajitnov's favorite sport.
2+
3+
The game is deceptively simple yet addictive. It involves different geometric shapes, called "tetriminos," which fall from the top of the screen at a steady pace. Players must rotate and place these tetriminos to form complete rows, which then disappear, awarding points to the player and freeing up space for more pieces. The game ends when the stack of tetriminos reaches the top of the playing field and no new pieces can enter. The challenge and thrill come from managing the space effectively and dealing with the increasing speed of falling tetriminos.
4+
5+
Tetris gained immense popularity after it was ported to a wide variety of platforms, most notably the Game Boy in 1989. This version, in particular, is credited with contributing significantly to the handheld's success, turning it into a must-have accessory and bringing Tetris into mainstream culture.
6+
7+
Over the years, Tetris has seen countless variations and has been released on nearly every gaming platform, from PCs and consoles to mobile phones and online platforms. Its universal appeal lies in its simplicity, making it accessible to players of all ages and skill levels, while the challenge of beating personal high scores provides endless replayability.
8+
9+
The game has also been studied for its psychological effects, with some researchers suggesting that playing Tetris can reduce the occurrence of traumatic memories and improve spatial skills. It's a testament to the game's design that it can be both a form of entertainment and a tool for cognitive research.
10+
11+
Tetris remains a beloved and influential game in the gaming community, symbolizing the power of simple, brilliant game design to capture the imagination of players around the world.
+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<module type="JAVA_MODULE" version="4">
3+
<component name="NewModuleRootManager" inherit-compiler-output="true">
4+
<exclude-output />
5+
<content url="file://$MODULE_DIR$">
6+
<sourceFolder url="file://$MODULE_DIR$" isTestSource="false" />
7+
</content>
8+
<orderEntry type="inheritedJdk" />
9+
<orderEntry type="sourceFolder" forTests="false" />
10+
</component>
11+
</module>
16.8 MB
Binary file not shown.
16.6 MB
Binary file not shown.
706 Bytes
Binary file not shown.
4.58 KB
Binary file not shown.
Binary file not shown.
1.79 KB
Binary file not shown.
1.79 KB
Binary file not shown.
1010 Bytes
Binary file not shown.
1.77 KB
Binary file not shown.
1.44 KB
Binary file not shown.
1.44 KB
Binary file not shown.
126 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1.27 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
211 Bytes
Binary file not shown.
14.1 MB
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
6.66 MB
Binary file not shown.
Binary file not shown.
Binary file not shown.

tetris/GamePanel.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
import javax.swing.*;
44
import java.awt.*;
5-
import java.util.Timer;
6-
import java.util.TimerTask;
5+
76
public class GamePanel extends JPanel implements Runnable, PowerUpObserver {
87

98
public static final int WIDTH=1150;
@@ -154,7 +153,7 @@ public void PowerUpUpdate() {
154153
powerupInProgress = true;
155154
PowerupCounter = 0;
156155
}
157-
else if(powerupused){
156+
else {
158157
System.out.println("the power up is on cooldown");
159158
}
160159
}

tetris/MenuHandler.java

-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
package tetris;
22

3-
import mino.*;
43

54
import java.awt.*;
65
import java.awt.Graphics2D;
7-
import java.util.ArrayList;
8-
import java.util.Random;
96

107

118
public class MenuHandler {

tetris/PlayManager.java

+3-4
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
import java.awt.*;
1212
import java.awt.Graphics2D;
1313
import java.util.ArrayList;
14-
import java.util.Observable;
15-
import java.util.Observer;
14+
1615
import java.util.Random;
1716

1817
public class PlayManager {
@@ -160,8 +159,8 @@ private void checkDelete() {
160159
// so maximum number of blocks are 12 if one line got 12 blocks we can delete line
161160
while (x < right_x && y < bottom_y) {
162161

163-
for (int i = 0; i < PlayManager.staticBlocks.size(); i++) { // scanning
164-
if (staticBlocks.get(i).x == x && staticBlocks.get(i).y == y) {
162+
for (Block block : PlayManager.staticBlocks) { // scanning
163+
if (block.x == x && block.y == y) {
165164
// increase the count
166165
blockCount++;
167166

tetris/Sound.java

+3-6
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,9 @@ public void play(int i , boolean music){
2828
musicClip = clip;
2929
}
3030
clip.open(ais);
31-
clip.addLineListener(new LineListener() {
32-
@Override
33-
public void update(LineEvent event) {
34-
if(event.getType() == LineEvent.Type.STOP){
35-
clip.close();
36-
}
31+
clip.addLineListener(event -> {
32+
if(event.getType() == LineEvent.Type.STOP){
33+
clip.close();
3734
}
3835
});
3936
ais.close();

0 commit comments

Comments
 (0)