Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Initial commit. Added class for Piece representation.
  • Loading branch information
john committed Mar 28, 2016
1 parent 0199c00 commit feaa10c
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .classpath
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
</classpath>
17 changes: 17 additions & 0 deletions .project
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>CSE-4705-Checkers</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
6 changes: 6 additions & 0 deletions src/model/Color.java
@@ -0,0 +1,6 @@
package model;

public enum Color {
RED,
BLACK
}
36 changes: 36 additions & 0 deletions src/model/Piece.java
@@ -0,0 +1,36 @@
package model;

public class Piece {
public final Color color;
private int x;
private int y;
private Type type;

public Piece(Color color, int x, int y) {
this.color = color;
this.x = x;
this.y = y;
this.type = Type.NORMAL;
}

public void updateCoordinates(int x, int y) {
this.x = x;
this.y = y;
}

public int getX() {
return this.x;
}

public int getY() {
return this.y;
}

public void promote() {
this.type = Type.KING;
}

public Type getType() {
return this.type;
}
}
6 changes: 6 additions & 0 deletions src/model/Type.java
@@ -0,0 +1,6 @@
package model;

public enum Type {
NORMAL,
KING
}

0 comments on commit feaa10c

Please sign in to comment.