This commit is contained in:
2021-05-04 17:04:40 +02:00
parent 5a972f89ce
commit e108e3caa4
5 changed files with 103 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
package chess;
import java.awt.Canvas;
import java.awt.Graphics;
import javax.swing.JFrame;
import chess.Chess;
public class Main extends Canvas {
public static void main(String[] args) {
Chess chess = new Chess();
chess.main();
// System.out.println(Piece.blackKing);
// JFrame frame = new JFrame("Chess Game");
// Canvas canvas = new Drawing();
// canvas.setSize(400, 400);
// frame.add(canvas);
// fram[Java 536871240]e.pack();
// frame.setVisible(true);
}
public void paint(Graphics g) {
// g.fillOval(100, 100, 200, 200);
}
}
+26
View File
@@ -0,0 +1,26 @@
package chess;
public class Board {
protected String[][] cells = {
{"wr", "wh", "wb", "wq", "wk", "wb", "wh", "wr"},
{"wp", "wp", "wp", "wp", "wp", "wp", "wp", "wp"},
{" ", " ", " ", " ", " ", " ", " ", " "},
{" ", " ", " ", " ", " ", " ", " ", " "},
{" ", " ", " ", " ", " ", " ", " ", " "},
{" ", " ", " ", " ", " ", " ", " ", " "},
{"br", "bh", "bb", "bq", "bk", "bb", "bh", "br"},
{"bp", "bp", "bp", "bp", "bp", "bp", "bp", "bp"}
};
public Board() {
}
public void print() {
for (String[] rows : cells) {
for (String piece : rows) {
System.out.print(piece);
}
System.out.print("\n");
}
}
}
+19
View File
@@ -0,0 +1,19 @@
package chess;
public class Chess {
public Board board;
public boolean done = false;
public Chess() {
}
public void main() {
while (!done) {
loop();
}
}
protected void loop() {
done = true;
}
}
+19
View File
@@ -0,0 +1,19 @@
package piece;
public class Piece {
// public Hashtable<String, String> my_dict = new Hashtable<String, String>();
// public int empty = 0;e
// public int whitePawn = 1;p
// public int whiteKnight = 2;h // "horseman"
// public int whiteBishop = 3;b
// public int whiteRook = 4;r
// public int whiteQueen = 5;q
// public int whiteKing = 6;k
// public int blackPawn = -1;
// public int blackKnight = -2;
// public int blackBishop = -3;
// public int blackRook = -4;
// public int blackQueen = -5;
// public int blackKing = -6;
}
@@ -14,4 +14,15 @@
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
<filteredResources>
<filter>
<id>1614941341885</id>
<name></name>
<type>30</type>
<matcher>
<id>org.eclipse.core.resources.regexFilterMatcher</id>
<arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
</matcher>
</filter>
</filteredResources>
</projectDescription>