diff --git a/Chip$1.class b/Chip$1.class index 2374eda..2e84105 100644 Binary files a/Chip$1.class and b/Chip$1.class differ diff --git a/Chip.class b/Chip.class index 3590f97..4b6ad44 100644 Binary files a/Chip.class and b/Chip.class differ diff --git a/Chip.java b/Chip.java index 0d502c4..2980e82 100644 --- a/Chip.java +++ b/Chip.java @@ -28,7 +28,11 @@ public class Chip { public Circle circle; - public Chip(int relX, int relY,double absX, double absY, Color color, Game game) { + public int ring; + + public Chip(int ring, int relX, int relY,double absX, double absY, Color color, Game game) { + this.ring = ring; + relativeX = relX; relativeY = relY; diff --git a/Chip.~ava b/Chip.~ava index dee2eb1..aaa71a5 100644 --- a/Chip.~ava +++ b/Chip.~ava @@ -28,6 +28,8 @@ public class Chip { public Circle circle; + public int ring; + public Chip(int relX, int relY,double absX, double absY, Color color, Game game) { relativeX = relX; relativeY = relY; @@ -52,8 +54,8 @@ public class Chip { circle.setCenterX(absoluteX); } public void setPositionY(double Y) { - absoluteX = Y; - circle.setCenterX(absoluteY); + absoluteY = Y; + circle.setCenterY(absoluteY); } public Shape getShape() { return circle; diff --git a/Game.class b/Game.class index 0a88886..616b376 100644 Binary files a/Game.class and b/Game.class differ diff --git a/Game.java b/Game.java index 38ee3cc..f778dd4 100644 --- a/Game.java +++ b/Game.java @@ -42,13 +42,13 @@ public class Game { if (game_state == 0) { Chip newChip; if (currentTurnPlayer == "White") { - newChip = addChip(button.relativeX,button.relativeY,button.absoluteX,button.absoluteY,Color.WHITE); + newChip = addChip(button.ring,button.relativeX,button.relativeY,button.absoluteX,button.absoluteY,Color.WHITE); white_chips--; setChipCount(white_chips,"White"); } else { - newChip = addChip(button.relativeX,button.relativeY,button.absoluteX,button.absoluteY,Color.BLACK); + newChip = addChip(button.ring,button.relativeX,button.relativeY,button.absoluteX,button.absoluteY,Color.BLACK); black_chips--; setChipCount(white_chips,"Black"); } @@ -64,8 +64,8 @@ public class Game { } } - public Chip addChip(int relX, int relY,double absX, double absY, Color color) { - Chip chip = new Chip(relX,relY,absX,absY,color,this); + public Chip addChip(int ring,int relX, int relY,double absX, double absY, Color color) { + Chip chip = new Chip(ring,relX,relY,absX,absY,color,this); chips.add(chip); addShape(chip.getShape()); return chip; @@ -98,10 +98,10 @@ public class Game { LTop.setText(value); } public boolean checkCombo(Chip chip) { - return checkCombo(chip.relativeX, chip.relativeY); + return checkCombo(chip.relativeX, chip.relativeY, chip.ring); } - public boolean checkCombo(int relX, int relY) { - ArrayList hChips = getHorizontalCloseChips(relX,relY); + public boolean checkCombo(int relX, int relY, int ring) { + ArrayList hChips = getHorizontalCloseChips(relX,relY,ring); ArrayList vChips = getVerticalCloseChips(relX,relY); Chip start_chip = getChipByPos(relX,relY); @@ -119,8 +119,9 @@ public class Game { return false; } - public ArrayList getHorizontalCloseChips(int relX, int relY) { + public ArrayList getHorizontalCloseChips(int relX, int relY, int ring) { ArrayList result = new ArrayList(); + System.out.println("Target: " + ring); if (relX == 0) { result.add(getChipByPos(1,relY)); result.add(getChipByPos(2,relY)); diff --git a/Game.~ava b/Game.~ava index 989b478..a16df59 100644 --- a/Game.~ava +++ b/Game.~ava @@ -42,13 +42,13 @@ public class Game { if (game_state == 0) { Chip newChip; if (currentTurnPlayer == "White") { - newChip = addChip(button.relativeX,button.relativeY,button.absoluteX,button.absoluteY,Color.WHITE); + newChip = addChip(button.ring,button.relativeX,button.relativeY,button.absoluteX,button.absoluteY,Color.WHITE); white_chips--; setChipCount(white_chips,"White"); } else { - newChip = addChip(button.relativeX,button.relativeY,button.absoluteX,button.absoluteY,Color.BLACK); + newChip = addChip(button.ring,button.relativeX,button.relativeY,button.absoluteX,button.absoluteY,Color.BLACK); black_chips--; setChipCount(white_chips,"Black"); } @@ -64,8 +64,8 @@ public class Game { } } - public Chip addChip(int relX, int relY,double absX, double absY, Color color) { - Chip chip = new Chip(relX,relY,absX,absY,color,this); + public Chip addChip(int ring,int relX, int relY,double absX, double absY, Color color) { + Chip chip = new Chip(ring,relX,relY,absX,absY,color,this); chips.add(chip); addShape(chip.getShape()); return chip; @@ -98,10 +98,10 @@ public class Game { LTop.setText(value); } public boolean checkCombo(Chip chip) { - return checkCombo(chip.relativeX, chip.relativeY); + return checkCombo(chip.relativeX, chip.relativeY, chip.ring); } - public boolean checkCombo(int relX, int relY) { - ArrayList hChips = getHorizontalCloseChips(relX,relY); + public boolean checkCombo(int relX, int relY, int ring) { + ArrayList hChips = getHorizontalCloseChips(relX,relY,ring); ArrayList vChips = getVerticalCloseChips(relX,relY); Chip start_chip = getChipByPos(relX,relY); @@ -119,8 +119,9 @@ public class Game { return false; } - public ArrayList getHorizontalCloseChips(int relX, int relY) { + public ArrayList getHorizontalCloseChips(int relX, int relY, int ring) { ArrayList result = new ArrayList(); + System.out.println("Target: " + relY); if (relX == 0) { result.add(getChipByPos(1,relY)); result.add(getChipByPos(2,relY)); @@ -132,7 +133,8 @@ public class Game { else { result.add(getChipByPos(0,relY)); result.add(getChipByPos(1,relY)); - } // end of if-else + } // end of if-else + System.out.println("Result: " + result.toString()); return result; } public ArrayList getVerticalCloseChips(int relX, int relY) { diff --git a/Muehle.class b/Muehle.class index b24a464..0891b00 100644 Binary files a/Muehle.class and b/Muehle.class differ diff --git a/Muehle.java b/Muehle.java index 6fbad44..d8485a0 100644 --- a/Muehle.java +++ b/Muehle.java @@ -134,41 +134,42 @@ public class Muehle extends Application { Color button_color = Color.BLUE; for (int i = 0; i < 3; i++) { - MuehleButton button = new MuehleButton(0,i,topLeftX,topLeftY+ i*325,button_color,game); + MuehleButton button = new MuehleButton(0,0,i,topLeftX,topLeftY+ i*325,button_color,game); shapes.add(button.getShape()); } for (int i = 0; i < 3; i++) { - MuehleButton button = new MuehleButton(1,i,topRightX -230,topLeftY+ i*100,button_color,game); + MuehleButton button = new MuehleButton(i,1,i,topRightX -230,topLeftY+ i*100,button_color,game); shapes.add(button.getShape()); } for (int i = 0; i < 3; i++) { - MuehleButton button = new MuehleButton(2,i,topRightX + 140,topLeftY+ i*325,button_color,game); + MuehleButton button = new MuehleButton(0,2,i,topRightX + 140,topLeftY+ i*325,button_color,game); shapes.add(button.getShape()); } for (int i = 0; i < 3; i++) { - MuehleButton button = new MuehleButton(0,i,topLeftX + 100,topLeftY+ i*220 +100,button_color,game); + MuehleButton button = new MuehleButton(1,0,i,topLeftX + 100,topLeftY+ i*220 +100,button_color,game); shapes.add(button.getShape()); } for (int i = 0; i < 3; i++) { - MuehleButton button = new MuehleButton(2,i,topRightX +40,topLeftY+ i*220 +100,button_color,game); + MuehleButton button = new MuehleButton(1,2,i,topRightX +40,topLeftY+ i*220 +100,button_color,game); shapes.add(button.getShape()); } - for (int i = 0; i < 3; i++) { - MuehleButton button = new MuehleButton(1,i,topRightX -230,topLeftY+ i*100 +460,button_color,game); + for (int i = 2; i >=0; i--) { + MuehleButton button = new MuehleButton(i,1,i,topRightX -230,topLeftY+ i*100 + 360,button_color,game); shapes.add(button.getShape()); } for (int i = 0; i < 3; i++) { - MuehleButton button = new MuehleButton(0,i,topLeftX +200,topLeftY+ i*130 +200,button_color,game); + + MuehleButton button = new MuehleButton(2,0,i,topLeftX +200,topLeftY+ i*130 +200,button_color,game); shapes.add(button.getShape()); } for (int i = 0; i < 3; i++) { - MuehleButton button = new MuehleButton(2,i,topLeftX +540,topLeftY+ i*130 +200,button_color,game); + MuehleButton button = new MuehleButton(0,2,i,topLeftX +540,topLeftY+ i*130 +200,button_color,game); shapes.add(button.getShape()); } diff --git a/Muehle.~ava b/Muehle.~ava index d2e12c5..235302b 100644 --- a/Muehle.~ava +++ b/Muehle.~ava @@ -134,41 +134,43 @@ public class Muehle extends Application { Color button_color = Color.BLUE; for (int i = 0; i < 3; i++) { - MuehleButton button = new MuehleButton(0,i,topLeftX,topLeftY+ i*325,button_color,game); + MuehleButton button = new MuehleButton(0,0,i,topLeftX,topLeftY+ i*325,button_color,game); shapes.add(button.getShape()); } for (int i = 0; i < 3; i++) { - MuehleButton button = new MuehleButton(1,i,topRightX -230,topLeftY+ i*100,button_color,game); + MuehleButton button = new MuehleButton(i,1,i,topRightX -230,topLeftY+ i*100,button_color,game); shapes.add(button.getShape()); } for (int i = 0; i < 3; i++) { - MuehleButton button = new MuehleButton(2,i,topRightX + 140,topLeftY+ i*325,button_color,game); + MuehleButton button = new MuehleButton(0,2,i,topRightX + 140,topLeftY+ i*325,button_color,game); shapes.add(button.getShape()); } for (int i = 0; i < 3; i++) { - MuehleButton button = new MuehleButton(0,i,topLeftX + 100,topLeftY+ i*220 +100,button_color,game); + MuehleButton button = new MuehleButton(1,0,i,topLeftX + 100,topLeftY+ i*220 +100,button_color,game); shapes.add(button.getShape()); } for (int i = 0; i < 3; i++) { - MuehleButton button = new MuehleButton(2,i,topRightX +40,topLeftY+ i*220 +100,button_color,game); + MuehleButton button = new MuehleButton(1,2,i,topRightX +40,topLeftY+ i*220 +100,button_color,game); shapes.add(button.getShape()); } - for (int i = 0; i < 3; i++) { - MuehleButton button = new MuehleButton(1,i,topRightX -230,topLeftY+ i*100 +460,button_color,game); + for (int i = 2; i >=0; i--) { + System.out.println("Er" +( i*100 + 360)); + MuehleButton button = new MuehleButton(i,1,i,topRightX -230,topLeftY+ i*100 + 360,button_color,game); shapes.add(button.getShape()); } for (int i = 0; i < 3; i++) { - MuehleButton button = new MuehleButton(0,i,topLeftX +200,topLeftY+ i*130 +200,button_color,game); + + MuehleButton button = new MuehleButton(2,0,i,topLeftX +200,topLeftY+ i*130 +200,button_color,game); shapes.add(button.getShape()); } for (int i = 0; i < 3; i++) { - MuehleButton button = new MuehleButton(2,i,topLeftX +540,topLeftY+ i*130 +200,button_color,game); + MuehleButton button = new MuehleButton(0,2,i,topLeftX +540,topLeftY+ i*130 +200,button_color,game); shapes.add(button.getShape()); } @@ -204,6 +206,8 @@ public class Muehle extends Application { addShape(black_player_chips[i]); } + game.white_player_chips = white_player_chips; + game.black_player_chips = black_player_chips; } public void addShape(Shape newShape) { diff --git a/MuehleButton$1.class b/MuehleButton$1.class index 19b239d..50ecccd 100644 Binary files a/MuehleButton$1.class and b/MuehleButton$1.class differ diff --git a/MuehleButton.class b/MuehleButton.class index 8e3f9af..be8c01b 100644 Binary files a/MuehleButton.class and b/MuehleButton.class differ diff --git a/MuehleButton.java b/MuehleButton.java index 010db75..8ae4a27 100644 --- a/MuehleButton.java +++ b/MuehleButton.java @@ -20,7 +20,11 @@ public class MuehleButton { public Circle circle; - public MuehleButton(int relX, int relY, double absX, double absY, Color color, Game game) { + public int ring; + + public MuehleButton(int ring,int relX, int relY, double absX, double absY, Color color, Game game) { + this.ring = ring; + relativeX = relX; relativeY = relY; diff --git a/MuehleButton.~ava b/MuehleButton.~ava index 1c050de..c61c5ae 100644 --- a/MuehleButton.~ava +++ b/MuehleButton.~ava @@ -20,7 +20,7 @@ public class MuehleButton { public Circle circle; - public MuehleButton(int relX, int relY, double absX, double absY, Color color, Game game) { + public MuehleButton(int ring,int relX, int relY, double absX, double absY, Color color, Game game) { relativeX = relX; relativeY = relY; @@ -44,8 +44,8 @@ public class MuehleButton { EventHandler mouse_click_target = new EventHandler() { public void handle(MouseEvent event) { - System.out.println("Button Clicked!"); - MouseClick(); + System.out.println("Button Clicked!"); + MouseClick(); } }; diff --git a/README.md b/README.md new file mode 100644 index 0000000..815631d --- /dev/null +++ b/README.md @@ -0,0 +1,11 @@ +Plan + +* check for combination +* rework UI +* refactoring +* win/lose check + + +08.10.2025 + +Working on UI diff --git a/README.~d b/README.~d new file mode 100644 index 0000000..f08ebbe --- /dev/null +++ b/README.~d @@ -0,0 +1,7 @@ +Plan + +* check for combination +* rework UI +* refactoring +* win/lose check +