Add some classes
This commit is contained in:
18
app/src/main/java/org/main/client/Cell.java
Normal file
18
app/src/main/java/org/main/client/Cell.java
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
package org.main.client;
|
||||||
|
|
||||||
|
public class Cell{
|
||||||
|
boolean isPopulated;
|
||||||
|
Pawn populatingObject;
|
||||||
|
|
||||||
|
Cell(){
|
||||||
|
this.isPopulated = false;
|
||||||
|
this.populatingObject = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Pawn getObject(){
|
||||||
|
return this.populatingObject;
|
||||||
|
}
|
||||||
|
void setObject(Pawn object){
|
||||||
|
this.populatingObject = object;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1 +1,10 @@
|
|||||||
package org.main.client;
|
package org.main.client;
|
||||||
|
|
||||||
|
public class Field{
|
||||||
|
Cell[] ringCells;
|
||||||
|
|
||||||
|
Field(){
|
||||||
|
this.ringCells[28] = new Cell();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
5
app/src/main/java/org/main/client/GameConnectable.java
Normal file
5
app/src/main/java/org/main/client/GameConnectable.java
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
package org.main.client;
|
||||||
|
|
||||||
|
public interface GameConnectable{
|
||||||
|
void Connect();
|
||||||
|
}
|
||||||
7
app/src/main/java/org/main/client/LocalGame.java
Normal file
7
app/src/main/java/org/main/client/LocalGame.java
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
package org.main.client;
|
||||||
|
|
||||||
|
public class LocalGame implements GameConnectable{
|
||||||
|
public void Connect(){
|
||||||
|
//TODO: implement game starting code
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1 +1,27 @@
|
|||||||
package org.main.client;
|
package org.main.client;
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class Menu{
|
||||||
|
|
||||||
|
|
||||||
|
void DisplayMenu(char menuEntry){
|
||||||
|
if(menuEntry == 0){
|
||||||
|
System.out.println("1. ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void RotateEntries(BufferedReader br){
|
||||||
|
char choice = 0;
|
||||||
|
while(choice != 5){
|
||||||
|
try{
|
||||||
|
choice = br.readLine().charAt(0);
|
||||||
|
} catch(IOException e){
|
||||||
|
System.out.println("Input/output error while reading symbol from console");
|
||||||
|
}
|
||||||
|
|
||||||
|
this.DisplayMenu(choice);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@@ -1 +1,32 @@
|
|||||||
package org.main.client;
|
package org.main.client;
|
||||||
|
|
||||||
|
public class Pawn{
|
||||||
|
Cell currentCell;
|
||||||
|
Cell homeCell;
|
||||||
|
String command;
|
||||||
|
boolean isOnField;
|
||||||
|
boolean isInHome;
|
||||||
|
|
||||||
|
Pawn(String command, Cell[] plenumCells){
|
||||||
|
this.command = command;
|
||||||
|
this.isOnField = false;
|
||||||
|
this.isInHome = false;
|
||||||
|
|
||||||
|
if(command == "red"){
|
||||||
|
this.homeCell = this.currentCell = plenumCells[21];
|
||||||
|
}
|
||||||
|
if(command == "green"){
|
||||||
|
this.homeCell = this.currentCell = plenumCells[0];
|
||||||
|
}
|
||||||
|
if(command == "blue"){
|
||||||
|
this.homeCell = this.currentCell = plenumCells[7];
|
||||||
|
}
|
||||||
|
if(command == "white"){
|
||||||
|
this.homeCell = this.currentCell = plenumCells[14];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean checkHome(Cell checkCell){
|
||||||
|
return checkCell == homeCell;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
8
app/src/main/java/org/main/client/RemoteGame.java
Normal file
8
app/src/main/java/org/main/client/RemoteGame.java
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
package org.main.client;
|
||||||
|
|
||||||
|
public class RemoteGame implements GameConnectable{
|
||||||
|
public void Connect(){
|
||||||
|
//TODO: implement game starting code
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user