Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Working CheckerGameState1 and tests
  • Loading branch information
sas12028 committed Apr 5, 2017
1 parent cac5859 commit c46033c
Show file tree
Hide file tree
Showing 6 changed files with 3,012 additions and 933 deletions.
31 changes: 31 additions & 0 deletions src/Test.java
@@ -1,4 +1,6 @@
import java.util.Arrays;
import java.util.List;
import java.util.Random;

public class Test{

Expand Down Expand Up @@ -39,8 +41,18 @@ public class Test{
"-", "w", "-", "-", "-", "w", "-", "w",
"w", "-", "w", "-", "w", "-", "w", "-"};

String[] b5 = {"-", "-", "-", "-", "-", "-", "-", "-",
"-", "-", "-", "-", "b", "-", "-", "-",
"-", "-", "-", "w", "-", "-", "-", "-",
"-", "-", "-", "-", "-", "-", "-", "-",
"-", "w", "-", "w", "-", "-", "-", "-",
"-", "-", "-", "-", "-", "-", "-", "-",
"-", "w", "-", "w", "-", "-", "-", "-",
"-", "-", "-", "-", "-", "-", "-", "-"};


Random r = new Random();

CheckersGameState s1 = new CheckersGameState3(1, b);
CheckersGameState s2 = new CheckersGameState3(2, b);
CheckersGameState s3 = new CheckersGameState3(1, b2);
Expand Down Expand Up @@ -68,6 +80,25 @@ public class Test{
printMoves(s7);
System.out.println("Result of State 7");
s7.result(s7.actions().get(0)).printState();
System.out.println("Playing game");
CheckersGameState s8 = new CheckersGameState3(1, b5);
printMoves(s8);
s8.result(s8.actions().get(0)).printState();
CheckersGameState state = new CheckersGameState3(1, b);
state.printState();
List<Move> moves = state.actions();
while(moves.size() > 0){
System.out.println("Possible actions: ");
for(Move move : moves) {
System.out.println(move);
}

Move action = moves.get(r.nextInt(moves.size()));
System.out.println("Chosen action: " + action);
state = state.result(action);
state.printState();
moves = state.actions();
}
}

static void printMoves(CheckersGameState s){
Expand Down
141 changes: 0 additions & 141 deletions src/output.txt

This file was deleted.

0 comments on commit c46033c

Please sign in to comment.