From a2848f0f4429924b2f74f65f0498a4eb7636b04d Mon Sep 17 00:00:00 2001 From: Rishabh Dixit <118468693+RishabhDixit1@users.noreply.github.com> Date: Mon, 13 Mar 2023 21:26:06 +0530 Subject: [PATCH 1/2] Some changes are made in the Panel and Window size to look Better --- src/Main.java | 2 +- src/Window.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Main.java b/src/Main.java index e2da510..00d8620 100644 --- a/src/Main.java +++ b/src/Main.java @@ -9,7 +9,7 @@ public static void main(String[] args) { //Setting up the window settings f1.setTitle("Snake"); - f1.setSize(300,300); + f1.setSize(100,200); f1.setVisible(true); f1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); diff --git a/src/Window.java b/src/Window.java index 518fa9e..0f4f0d2 100644 --- a/src/Window.java +++ b/src/Window.java @@ -8,8 +8,8 @@ class Window extends JFrame{ private static final long serialVersionUID = -2542001418764869760L; public static ArrayList> Grid; - public static int width = 20; - public static int height = 20; + public static int width = 30; + public static int height = 30; public Window(){ @@ -28,7 +28,7 @@ public Window(){ } // Setting up the layout of the panel - getContentPane().setLayout(new GridLayout(20,20,0,0)); + getContentPane().setLayout(new GridLayout(30,30,0,0)); // Start & pauses all threads, then adds every square of each thread to the panel for(int i=0;i Date: Tue, 14 Mar 2023 19:59:13 +0530 Subject: [PATCH 2/2] Some Changes are made in the file --- src/DataOfSquare.java | 6 +++--- src/ThreadsController.java | 4 ++-- src/Window.java | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/DataOfSquare.java b/src/DataOfSquare.java index f1ec760..d462eca 100644 --- a/src/DataOfSquare.java +++ b/src/DataOfSquare.java @@ -11,9 +11,9 @@ public class DataOfSquare { public DataOfSquare(int col){ //Lets add the color to the arrayList - C.add(Color.darkGray);//0 - C.add(Color.BLUE); //1 - C.add(Color.white); //2 + C.add(Color.BLACK);//0 + C.add(Color.GREEN); //1 + C.add(Color.YELLOW); //2 color=col; square = new SquarePanel(C.get(color)); } diff --git a/src/ThreadsController.java b/src/ThreadsController.java index 3df2d3d..bf9b4f2 100644 --- a/src/ThreadsController.java +++ b/src/ThreadsController.java @@ -5,8 +5,8 @@ public class ThreadsController extends Thread { ArrayList> Squares= new ArrayList>(); Tuple headSnakePos; - int sizeSnake=3; - long speed = 50; + int sizeSnake=2; + long speed = 70; public static int directionSnake ; ArrayList positions = new ArrayList(); diff --git a/src/Window.java b/src/Window.java index 0f4f0d2..518fa9e 100644 --- a/src/Window.java +++ b/src/Window.java @@ -8,8 +8,8 @@ class Window extends JFrame{ private static final long serialVersionUID = -2542001418764869760L; public static ArrayList> Grid; - public static int width = 30; - public static int height = 30; + public static int width = 20; + public static int height = 20; public Window(){ @@ -28,7 +28,7 @@ public Window(){ } // Setting up the layout of the panel - getContentPane().setLayout(new GridLayout(30,30,0,0)); + getContentPane().setLayout(new GridLayout(20,20,0,0)); // Start & pauses all threads, then adds every square of each thread to the panel for(int i=0;i