From 70097886d4c60b2caf2ef509e8a1dc35f6be0668 Mon Sep 17 00:00:00 2001 From: k1ntas <100801775+k1ntas@users.noreply.github.com> Date: Thu, 7 Apr 2022 08:48:24 +0200 Subject: [PATCH] =?UTF-8?q?Schack=20funkar=20lite=20b=C3=A4ttre=20men=20ma?= =?UTF-8?q?n=20fattar=20inte?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nbproject/project.properties | 11 +++++------ src/schack/Board.java | 4 ++-- src/schack/Queen.java | 1 + 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/nbproject/project.properties b/nbproject/project.properties index dec7de7..15aa047 100644 --- a/nbproject/project.properties +++ b/nbproject/project.properties @@ -13,7 +13,6 @@ auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.text-limit-width= auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.text-line-wrap=none auxiliary.org-netbeans-modules-editor-indent.CodeStyle.usedProfile=project auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.enable-indent=true -auxiliary.org-netbeans-spi-editor-hints-projects.perProjectHintSettingsFile=nbproject/cfg_hints.xml build.classes.dir=${build.dir}/classes build.classes.excludes=**/*.java,**/*.form # This directory is removed when the project is cleaned: @@ -42,17 +41,17 @@ dist.jar=${dist.dir}/Schack.jar dist.javadoc.dir=${dist.dir}/javadoc endorsed.classpath= excludes= -file.reference.flatlaf-2.1.jar=lib\\flatlaf-2.1.jar -file.reference.flatlaf-extras-2.1.jar=lib\\flatlaf-extras-2.1.jar -file.reference.flatlaf-intellij-themes-2.1.jar=lib\\flatlaf-intellij-themes-2.1.jar +file.reference.flatlaf-2.1.jar=lib/flatlaf-2.1.jar +file.reference.flatlaf-extras-2.1.jar=lib/flatlaf-extras-2.1.jar +file.reference.flatlaf-intellij-themes-2.1.jar=lib/flatlaf-intellij-themes-2.1.jar includes=** jar.archive.disabled=${jnlp.enabled} jar.compress=false jar.index=${jnlp.enabled} javac.classpath=\ ${file.reference.flatlaf-2.1.jar}:\ - ${file.reference.flatlaf-intellij-themes-2.1.jar}:\ - ${file.reference.flatlaf-extras-2.1.jar} + ${file.reference.flatlaf-extras-2.1.jar}:\ + ${file.reference.flatlaf-intellij-themes-2.1.jar} # Space-separated list of extra javac options javac.compilerargs= javac.deprecation=false diff --git a/src/schack/Board.java b/src/schack/Board.java index 7598e50..4fb5312 100644 --- a/src/schack/Board.java +++ b/src/schack/Board.java @@ -157,8 +157,8 @@ public class Board extends JPanel implements MouseListener { validMoves.removeAll(turn ? blackAttacks : whiteAttacks); } // Funkar inte - for (Point attack : turn ? whiteAttacks : blackAttacks) { - Piece attacked = pieces[attack.x][attack.x]; + for (Point attack : turn ? blackAttacks : whiteAttacks) { + Piece attacked = pieces[attack.x][attack.y]; if (attacked == null) { continue; } diff --git a/src/schack/Queen.java b/src/schack/Queen.java index 1da927a..c1a617d 100644 --- a/src/schack/Queen.java +++ b/src/schack/Queen.java @@ -18,6 +18,7 @@ public class Queen extends Piece { // Vänster for (int loopX = this.position.x - 1; loopX >= 0; loopX--) { boolean shouldBreak = addMovesIfCan(new Point(loopX, this.position.y), movable, pieces); + if (shouldBreak) { break; }