diff --git a/.project b/.project index 6ec5eb6..1723b62 100644 --- a/.project +++ b/.project @@ -1,6 +1,6 @@ - Arimaa + Arimaa-2.0 diff --git a/README.md b/README.md index d51ba82..fe12066 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,4 @@ -# Arimaa -CSSE376 Project by Tayler How, Luke Miller, and Jesse Shellabarger +# Arimaa 2.0 +Arimaa 2.0 is a CSSE375 Project Tayler How, Jesse Shellabarger, and Trevor Burch. + +*Arimaa was originally a CSSE376 Project by Tayler How, Luke Miller, and Jesse Shellabarger. diff --git a/codecover/test-session-container-2015-04-24-01-50-42-398.xml b/codecover/test-session-container-2015-04-24-01-50-42-398.xml deleted file mode 100644 index a339dc2..0000000 --- a/codecover/test-session-container-2015-04-24-01-50-42-398.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - -
- - - - diff --git a/codecover/test-session-container-2015-04-24-01-54-58-202.xml b/codecover/test-session-container-2015-04-24-01-54-58-202.xml deleted file mode 100644 index 3433a16..0000000 --- a/codecover/test-session-container-2015-04-24-01-54-58-202.xml +++ /dev/null @@ -1,1983 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -
- - -
- -
- - - - - - -
- -
- - - -
- -
- -
- - - -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- -
- -
- - - - -
- -
- - - - - - - - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
-
- - - - diff --git a/codecover/test-session-container-2015-04-24-01-54-59-090.xml b/codecover/test-session-container-2015-04-24-01-54-59-090.xml deleted file mode 100644 index 62f3eb4..0000000 --- a/codecover/test-session-container-2015-04-24-01-54-59-090.xml +++ /dev/null @@ -1,1983 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -
- - -
- -
- - - - - - -
- -
- - - -
- -
- -
- - - -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- -
- -
- - - - -
- -
- - - - - - - - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
-
- - - - diff --git a/codecover/test-session-container-2015-04-24-11-20-15-714.xml b/codecover/test-session-container-2015-04-24-11-20-15-714.xml deleted file mode 100644 index effa093..0000000 --- a/codecover/test-session-container-2015-04-24-11-20-15-714.xml +++ /dev/null @@ -1,2022 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -
- - -
- -
- - - - - - -
- -
- - - -
- -
- -
- - - -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- -
- -
- - - - -
- -
- - - - - - - - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
-
- - - - diff --git a/codecover/test-session-container-2015-04-30-12-41-03-119.xml b/codecover/test-session-container-2015-04-30-12-41-03-119.xml deleted file mode 100644 index dd250ca..0000000 --- a/codecover/test-session-container-2015-04-30-12-41-03-119.xml +++ /dev/null @@ -1,5338 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -
- - -
- -
- - - - - - -
- -
- - - -
- -
- -
- - - -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
-
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- -
- -
- - - - - - - - - - - - - - - - - - - -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- -
- - - - -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- -
- -
- - - - -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- -
- -
- - - - -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - -
-
- -
- -
- - - - -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- -
- -
- - - - -
- -
- - - - - - - - - - - - - - - - - - - -
- -
- -
- - - -
- -
- -
- - - -
- -
- -
- - - -
- -
- -
- - - -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
- -
- -
- - - - -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
-
- -
- -
- - - - -
- -
- - - - - - - - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
-
- - - - diff --git a/codecover/test-session-container-2015-04-30-17-58-04-351.xml b/codecover/test-session-container-2015-04-30-17-58-04-351.xml deleted file mode 100644 index 787ffc9..0000000 --- a/codecover/test-session-container-2015-04-30-17-58-04-351.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - -
- - - - diff --git a/codecover/test-session-container-2015-04-30-18-05-13-010.xml b/codecover/test-session-container-2015-04-30-18-05-13-010.xml deleted file mode 100644 index 2fca537..0000000 --- a/codecover/test-session-container-2015-04-30-18-05-13-010.xml +++ /dev/null @@ -1,2889 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -
- - -
- -
- - - - - - -
- -
- - - -
- -
- -
- - - -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
-
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- -
- -
- - - - -
- -
- - - - - - - - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
-
- - - - diff --git a/codecover/test-session-container-2015-04-30-18-08-50-558.xml b/codecover/test-session-container-2015-04-30-18-08-50-558.xml deleted file mode 100644 index 724464b..0000000 --- a/codecover/test-session-container-2015-04-30-18-08-50-558.xml +++ /dev/null @@ -1,2889 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -
- - -
- -
- - - - - - -
- -
- - - -
- -
- -
- - - -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
-
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- -
- -
- - - - -
- -
- - - - - - - - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
- -
- -
- - - - - - - - - - - - - -
-
- - - - diff --git a/docs/UML diagram.pdf b/docs/Old UML Diagram.pdf similarity index 100% rename from docs/UML diagram.pdf rename to docs/Old UML Diagram.pdf diff --git a/docs/UML diagram.vsdx b/docs/Old UML diagram.vsdx similarity index 100% rename from docs/UML diagram.vsdx rename to docs/Old UML diagram.vsdx diff --git a/docs/TeamC-Milestone2-RefactoringPlans.docx b/docs/TeamC-Milestone2-RefactoringPlans.docx new file mode 100644 index 0000000..090f2f7 Binary files /dev/null and b/docs/TeamC-Milestone2-RefactoringPlans.docx differ diff --git a/docs/TeamC-Milestone2-RefactoringPlans.pdf b/docs/TeamC-Milestone2-RefactoringPlans.pdf new file mode 100644 index 0000000..2ed6656 Binary files /dev/null and b/docs/TeamC-Milestone2-RefactoringPlans.pdf differ diff --git a/docs/Updated UML.pdf b/docs/Updated UML.pdf new file mode 100644 index 0000000..259ee88 Binary files /dev/null and b/docs/Updated UML.pdf differ diff --git a/docs/Updated UML.uxf b/docs/Updated UML.uxf new file mode 100644 index 0000000..6f807ba --- /dev/null +++ b/docs/Updated UML.uxf @@ -0,0 +1,553 @@ + + + 8 + + UMLClass + + 928 + 8 + 416 + 696 + + game::Game +-- +~boards = new ArrayList<BoardState>(): ArrayList<BoardState> ++currentBoard = null: BoardState +~moveTimer = 0: int +~p1TimeBank = 0: int +~p2TimeBank = 0: int +~turnCounter = 0: int +~p1Name = "Player1": String +~p2Name = "Player2": String +-winner = 0: int +-numMoves = 4: int +-playerTurn = 1: int +-isPushPull: boolean +~p1Pieces: HashMap<Character, Integer> +~p2Pieces: HashMap<Character, Integer> +-- ++Game(BoardState b): ctor ++Game(): ctor ++configurePieceInventory(): void ++placePiece(int row, int column, char piece): boolean ++removePiece(int row, int column): boolean ++getSpace(int row, int column): Piece ++move(int row, int column, int dir): boolean +-isValidMoveFromSquare(int row, int column): boolean +-isValidMoveSquare(int row, int column): boolean +-endMove(): void +-checkWin(): void +-checkDeaths(int row, int col): void +-checkFriendlyAdjacent(int row, int col): boolean +-checkStrongerAdjacent(int row, int col): boolean +-checkStrong(Piece one, Piece two): boolean +-switchPiece(int row1, int column1, int row2, int column2): void ++push(int row, int column, int dir1, int dir2): boolean +-pieceCanPush(Piece pushingPiece, Piece pushedPiece): boolean +-isValidSquareToPushFrom(int row, int column): boolean ++pull(int row1, int column1, int row2, int column2, int direction1): boolean +-tryPull(Piece space, Piece space2, int row1, int column1, int direction1): boolean +-isValidSquaretoPullFrom(int row1, int column1, int row2, int column2): boolean ++getDirection(int row1, int column1, int row2, int column2): int ++undoMove(): void ++loadFile(Scanner scanner): boolean ++saveFile(FileWriter fw): boolean ++getTurnCounter(): int ++getP1Name(): String ++getP2Name(): String ++setWinner(int winner): void ++getNumMoves(): int ++getTurnTimer(): int ++getWinner(): int ++getPlayerTurn(): int ++setPlayerTurn(int playerTurn): void ++getP1Pieces(): HashMap<Character, Integer> ++getP2Pieces(): HashMap<Character, Integer> +-- + + + + + UMLClass + + 544 + 0 + 272 + 368 + + game::GUI +-- +-p1Name: String +-p2Name: String +-activeFrames: ArrayList<JFrame> +-game: Game +-gameBoardPanel = null: ImagePanel +-boardPieces: ImagePanel[][] +-p1TextField: JTextField +-p2TextField: JTextField +-timerComboBox: JComboBox<Integer> +-moveCountLabel: JLabel +-turnCountLabel: JLabel +-turnIndicatorLabel: JLabel +-timerLabel: JLabel +-timer: TimePanel +-- ++GUI(): ctor ++main(String[] args): void ++getP1name(): String ++setP1name(String p1name): void ++getP2name(): String ++setP2name(String p2name): void ++getActiveFrames(): ArrayList<JFrame> ++setActiveFrames(ArrayList<JFrame> frames): void +-renderInitialBoard(): void +#renderBoard(): void ++createWinWindow(): void +-- + + + + + UMLClass + + 1376 + 424 + 232 + 280 + + game::Piece +-- +-type: PieceType +-image: Image +-owner: Owner +-rank: int +-- ++Piece(char c): ctor ++Piece(PieceType t, Image i, Owner o): ctor +-createP2Piece(char c): void +-createP1Piece(char c): void ++getType(): PieceType ++setType(PieceType type): void ++getImage(): Image ++setImg(Image img): void ++getOwner(): Owner ++setOwner(Owner owner): void ++getRank(): int ++setRank(int rank): void ++equals(Object p2): boolean ++isStrongerThan(Piece p2): boolean +-- + + + + + UMLClass + + 1464 + 8 + 288 + 176 + + game::BoardState +-- +-boardArray = new char[8][8]: char[][] +-turnNumber: int +-- ++BoardState(char[][] map, int turnNumber): ctor ++getBoardArray(): char[][] ++setBoardArray(char[][] boardArray): void ++setBoardSpace(int row, int column, String piece): void ++getTurnNumber(): int ++setTurnNumber(int turnNumber): void ++incrementTurn(): void ++clone(): BoardState +-- + + + + + UMLClass + + 400 + 448 + 344 + 136 + + game::TimePanel +-- +-timerLabel: JLabel +~timer: Timer +~playerTurn: int +-- ++TimePanel(GUI gui, Game game, int startTime, JLabel label): ctor ++update(int s, int minute): void ++getTimerLabel(): JLabel ++setTimerLabel(JLabel timerLabel): void +-- + + + + + UMLClass + + 96 + 448 + 272 + 224 + + game::ImagePanel +-- +-serialVersionUID = -7315460075240330922L: long +-img: Image +-row: int +-column: int +-- ++ImagePanel(String img): ctor ++ImagePanel(Image img): ctor ++createWinWindow(): void ++paintComponent(Graphics g): void ++setRow(int row): void ++getRow(): int ++setColumn(int column): void ++getColumn(): int ++getPixelX(): int ++getPixelY(): int +-- + + + + + Relation + + 560 + 360 + 128 + 104 + + lt=<<<<<- + 140.0;10.0;140.0;70.0;10.0;70.0;10.0;110.0 + + + Relation + + 208 + 360 + 392 + 104 + + lt=<<<<<- + 470.0;10.0;470.0;40.0;10.0;40.0;10.0;110.0 + + + Relation + + 1336 + 48 + 144 + 24 + + lt=<<<<<- + 10.0;10.0;160.0;10.0 + + + Relation + + 1336 + 152 + 160 + 288 + + lt=<. + 180.0;340.0;180.0;280.0;100.0;280.0;100.0;10.0;10.0;10.0 + + + Relation + + 808 + 112 + 136 + 24 + + lt=<<<<<- + 10.0;10.0;150.0;10.0 + + + Relation + + 784 + 360 + 48 + 400 + + lt=<. + 40.0;480.0;40.0;70.0;10.0;70.0;10.0;10.0 + + + UMLClass + + 696 + 744 + 232 + 48 + + /ActionListener/ +-- +-- ++actionPerformed(ActionEvent arg0): void + + + + + Relation + + 872 + 784 + 144 + 56 + + lt=<<- + 10.0;10.0;10.0;50.0;160.0;50.0 + + + UMLClass + + 1000 + 800 + 232 + 48 + + newGameListener +-- +-- ++actionPerformed(ActionEvent arg0): void + + + + + UMLClass + + 1000 + 856 + 232 + 64 + + loadGameListener +-- +-- ++actionPerformed(ActionEvent arg0): void +-loadGame(File file): void + + + + + UMLClass + + 1000 + 928 + 232 + 48 + + cancelListener +-- +-- ++actionPerformed(ActionEvent arg0): void + + + + + UMLClass + + 1000 + 984 + 232 + 48 + + startGameListener +-- +-- ++actionPerformed(ActionEvent arg0): void + + + + + UMLClass + + 1000 + 1040 + 232 + 48 + + saveGameListener +-- +-- ++actionPerformed(ActionEvent arg0): void + + + + + UMLClass + + 1000 + 1096 + 232 + 48 + + undoListener +-- +-- ++actionPerformed(ActionEvent arg0): void + + + + + UMLClass + + 1000 + 1152 + 232 + 48 + + endTurnListener +-- +-- ++actionPerformed(ActionEvent arg0): void + + + + + Relation + + 848 + 784 + 168 + 120 + + lt=<<- + 10.0;10.0;10.0;130.0;190.0;130.0 + + + Relation + + 824 + 784 + 192 + 184 + + lt=<<- + 10.0;10.0;10.0;210.0;220.0;210.0 + + + Relation + + 800 + 784 + 216 + 240 + + lt=<<- + 10.0;10.0;10.0;280.0;250.0;280.0 + + + Relation + + 776 + 784 + 240 + 296 + + lt=<<- + 10.0;10.0;10.0;350.0;280.0;350.0 + + + Relation + + 752 + 784 + 264 + 352 + + lt=<<- + 10.0;10.0;10.0;420.0;310.0;420.0 + + + Relation + + 728 + 784 + 288 + 408 + + lt=<<- + 10.0;10.0;10.0;490.0;340.0;490.0 + + + UMLClass + + 432 + 744 + 232 + 96 + + /MouseListener/ +-- +-- ++mouseClicked(MouseEvent): void ++mouseReleased(MouseEvent): void ++mouseEntered(MouseEvent): void ++mouseExited(MouseEvent): void ++mousePressed(MouseEvent): void + + + + Relation + + 544 + 360 + 232 + 400 + + lt=<. + 10.0;480.0;10.0;400.0;270.0;400.0;270.0;70.0;240.0;70.0;240.0;10.0 + + + UMLClass + + 392 + 936 + 304 + 256 + + MovementListener +-- +-selectedPiece: ImagePanel +-secondSelectedPiece: ImagePanel +-- ++mouseClicked(MouseEvent): void ++mouseReleased(MouseEvent): void ++mouseEntered(MouseEvent): void ++mouseExited(MouseEvent): void ++mousePressed(MouseEvent): void +-moveDirectionTwoPush(ImagePanel, int, int): int +-moveDirectionOnePush(ImagePanel, ImagePanel): int +-twoPieceSelectedAndEmptySpaceClicked(int, int): boolean +-pieceSelectedAndSecondPieceClicked(int, int): boolean +-moveDirection(ImagePanel, int, int): int +-noSelectedPieceAndEmptySpaceClicked(int, int): int +-noPieceSelectedAndPieceClicked(int, int): boolean +-clockOnBoard(int, int): boolean +-checkForPush(int, int): boolean +-checkForPull(int, int): boolean + + + + Relation + + 536 + 832 + 24 + 120 + + lt=<<- + 10.0;10.0;10.0;130.0 + + diff --git a/src/game/ArimaaException.java b/src/game/ArimaaException.java new file mode 100644 index 0000000..98a4c43 --- /dev/null +++ b/src/game/ArimaaException.java @@ -0,0 +1,11 @@ +package game; + +public class ArimaaException extends Exception { + + private static final long serialVersionUID = 1190620134914087369L; + + public ArimaaException(String message) { + super(message); + } + +} diff --git a/src/game/BoardState.java b/src/game/BoardState.java index ad8b7af..552e23c 100644 --- a/src/game/BoardState.java +++ b/src/game/BoardState.java @@ -1,7 +1,5 @@ package game; -import java.util.Arrays; - /** * This class represents the states of the board. * diff --git a/src/game/GUI.java b/src/game/GUI.java index 9e97d97..8a1a761 100644 --- a/src/game/GUI.java +++ b/src/game/GUI.java @@ -40,22 +40,21 @@ public class GUI { private JLabel turnCountLabel; private JLabel turnIndicatorLabel; private JLabel timerLabel; - private TimePanel timer; public GUI() { this.p1Name = "Player 1"; this.p2Name = "Player 2"; p2TextField = null; p1TextField = null; -// BoardState b=new BoardState(new char[][] { -// { ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' }, -// { ' ', ' ', ' ', ' ', 'r', ' ', ' ', ' ' }, -// { ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' }, -// { ' ', 'R', ' ', ' ', ' ', ' ', ' ', ' ' }, -// { ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' }, -// { ' ', 'R', ' ', 'E', ' ', ' ', 'r', ' ' }, -// { ' ', 'e', ' ', ' ', ' ', ' ', 'C', ' ' }, -// { ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' }, }, 0); + // BoardState b=new BoardState(new char[][] { + // { ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' }, + // { ' ', ' ', ' ', ' ', 'r', ' ', ' ', ' ' }, + // { ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' }, + // { ' ', 'R', ' ', ' ', ' ', ' ', ' ', ' ' }, + // { ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' }, + // { ' ', 'R', ' ', 'E', ' ', ' ', 'r', ' ' }, + // { ' ', 'e', ' ', ' ', ' ', ' ', 'C', ' ' }, + // { ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' }, }, 0); this.game = new Game(); this.boardPieces = new ImagePanel[8][8]; this.activeFrames = new ArrayList(); @@ -66,42 +65,24 @@ public GUI() { } public static void main(String[] args) { + // TODO: Long method, possible refactoring? GUI g = new GUI(); // Add MAIN MENU panel with appropriate background image - ImagePanel panel = new ImagePanel(new ImageIcon( - "resources/BoardStoneBig.jpg").getImage()); + ImagePanel panel = new ImagePanel(new ImageIcon("resources/BoardStoneBig.jpg").getImage()); g.activeFrames.get(0).getContentPane().add(panel); g.activeFrames.get(0).pack(); panel.setVisible(true); // Add the NEW GAME button to the Main Menu - JButton newGameButton = new JButton(); - newGameButton.setSize(150, 75); - newGameButton.setText("New Game"); - Font newGameFont = newGameButton.getFont(); - newGameButton.setFont(new Font(newGameFont.getName(), 4, 20)); - newGameButton.setLocation((panel.getWidth() / 4) - 35, - (panel.getHeight() / 2) - 37); + JButton newGameButton = g.createButton("New Game", 4, 20, 150, 75, (panel.getWidth() / 4) - 35, + (panel.getHeight() / 2) - 37, g.new NewGameListener()); panel.add(newGameButton); - newGameButton.setVisible(true); - - // Setup ActionListener for NEW GAME button - newGameButton.addActionListener(g.new newGameListener()); // Add the LOAD GAME button to the Main Menu - JButton loadGameButton = new JButton(); - loadGameButton.setSize(150, 75); - loadGameButton.setText("Load Game"); - Font loadGameFont = loadGameButton.getFont(); - loadGameButton.setFont(new Font(loadGameFont.getName(), 4, 20)); - loadGameButton.setLocation((panel.getWidth() / 4) * 3 - 110, - (panel.getHeight() / 2) - 37); + JButton loadGameButton = g.createButton("Load Game", 4, 20, 150, 75, (panel.getWidth() / 4) * 3 - 110, + (panel.getHeight() / 2) - 37, g.new LoadGameListener()); panel.add(loadGameButton); - loadGameButton.setVisible(true); - - // Setup ActionListener for the LOAD GAME button - loadGameButton.addActionListener(g.new loadGameListener()); g.activeFrames.get(0).setVisible(true); } @@ -130,6 +111,7 @@ public void setActiveFrames(ArrayList frames) { this.activeFrames = frames; } + // TODO: Long method, bad switch statement. Refactor? private void renderInitialBoard() { if (game.getWinner() != 0) createWinWindow(); @@ -140,137 +122,113 @@ private void renderInitialBoard() { switch (c) { case 'E': ImagePanel whiteElephantPanel = new ImagePanel( - new ImageIcon("resources/White elephant.png") - .getImage()); + new ImageIcon("resources/White elephant.png").getImage()); this.gameBoardPanel.add(whiteElephantPanel); whiteElephantPanel.setRow(row); whiteElephantPanel.setColumn(column); - whiteElephantPanel.setLocation( - whiteElephantPanel.getPixelX(), - whiteElephantPanel.getPixelY()); + whiteElephantPanel.setLocation(whiteElephantPanel.getPixelX(), whiteElephantPanel.getPixelY()); whiteElephantPanel.setVisible(true); this.boardPieces[row][column] = whiteElephantPanel; break; case 'C': - ImagePanel whiteCamelPanel = new ImagePanel(new ImageIcon( - "resources/White camel.png").getImage()); + ImagePanel whiteCamelPanel = new ImagePanel(new ImageIcon("resources/White camel.png").getImage()); this.gameBoardPanel.add(whiteCamelPanel); whiteCamelPanel.setRow(row); whiteCamelPanel.setColumn(column); - whiteCamelPanel.setLocation(whiteCamelPanel.getPixelX(), - whiteCamelPanel.getPixelY()); + whiteCamelPanel.setLocation(whiteCamelPanel.getPixelX(), whiteCamelPanel.getPixelY()); whiteCamelPanel.setVisible(true); this.boardPieces[row][column] = whiteCamelPanel; break; case 'H': - ImagePanel whiteHorsePanel = new ImagePanel(new ImageIcon( - "resources/White horse.png").getImage()); + ImagePanel whiteHorsePanel = new ImagePanel(new ImageIcon("resources/White horse.png").getImage()); this.gameBoardPanel.add(whiteHorsePanel); whiteHorsePanel.setRow(row); whiteHorsePanel.setColumn(column); - whiteHorsePanel.setLocation(whiteHorsePanel.getPixelX(), - whiteHorsePanel.getPixelY()); + whiteHorsePanel.setLocation(whiteHorsePanel.getPixelX(), whiteHorsePanel.getPixelY()); whiteHorsePanel.setVisible(true); this.boardPieces[row][column] = whiteHorsePanel; break; case 'D': - ImagePanel whiteDogPanel = new ImagePanel(new ImageIcon( - "resources/White dog.png").getImage()); + ImagePanel whiteDogPanel = new ImagePanel(new ImageIcon("resources/White dog.png").getImage()); this.gameBoardPanel.add(whiteDogPanel); whiteDogPanel.setRow(row); whiteDogPanel.setColumn(column); - whiteDogPanel.setLocation(whiteDogPanel.getPixelX(), - whiteDogPanel.getPixelY()); + whiteDogPanel.setLocation(whiteDogPanel.getPixelX(), whiteDogPanel.getPixelY()); whiteDogPanel.setVisible(true); this.boardPieces[row][column] = whiteDogPanel; break; case 'K': - ImagePanel whiteCatPanel = new ImagePanel(new ImageIcon( - "resources/White cat.png").getImage()); + ImagePanel whiteCatPanel = new ImagePanel(new ImageIcon("resources/White cat.png").getImage()); this.gameBoardPanel.add(whiteCatPanel); whiteCatPanel.setRow(row); whiteCatPanel.setColumn(column); - whiteCatPanel.setLocation(whiteCatPanel.getPixelX(), - whiteCatPanel.getPixelY()); + whiteCatPanel.setLocation(whiteCatPanel.getPixelX(), whiteCatPanel.getPixelY()); whiteCatPanel.setVisible(true); this.boardPieces[row][column] = whiteCatPanel; break; case 'R': - ImagePanel whiteRabbitPanel = new ImagePanel(new ImageIcon( - "resources/White rabbit.png").getImage()); + ImagePanel whiteRabbitPanel = new ImagePanel( + new ImageIcon("resources/White rabbit.png").getImage()); this.gameBoardPanel.add(whiteRabbitPanel); whiteRabbitPanel.setRow(row); whiteRabbitPanel.setColumn(column); - whiteRabbitPanel.setLocation(whiteRabbitPanel.getPixelX(), - whiteRabbitPanel.getPixelY()); + whiteRabbitPanel.setLocation(whiteRabbitPanel.getPixelX(), whiteRabbitPanel.getPixelY()); whiteRabbitPanel.setVisible(true); this.boardPieces[row][column] = whiteRabbitPanel; break; case 'e': ImagePanel blackElephantPanel = new ImagePanel( - new ImageIcon("resources/Black elephant.png") - .getImage()); + new ImageIcon("resources/Black elephant.png").getImage()); this.gameBoardPanel.add(blackElephantPanel); blackElephantPanel.setRow(row); blackElephantPanel.setColumn(column); - blackElephantPanel.setLocation( - blackElephantPanel.getPixelX(), - blackElephantPanel.getPixelY()); + blackElephantPanel.setLocation(blackElephantPanel.getPixelX(), blackElephantPanel.getPixelY()); blackElephantPanel.setVisible(true); this.boardPieces[row][column] = blackElephantPanel; break; case 'c': - ImagePanel blackCamelPanel = new ImagePanel(new ImageIcon( - "resources/Black camel.png").getImage()); + ImagePanel blackCamelPanel = new ImagePanel(new ImageIcon("resources/Black camel.png").getImage()); this.gameBoardPanel.add(blackCamelPanel); blackCamelPanel.setRow(row); blackCamelPanel.setColumn(column); - blackCamelPanel.setLocation(blackCamelPanel.getPixelX(), - blackCamelPanel.getPixelY()); + blackCamelPanel.setLocation(blackCamelPanel.getPixelX(), blackCamelPanel.getPixelY()); blackCamelPanel.setVisible(true); this.boardPieces[row][column] = blackCamelPanel; break; case 'h': - ImagePanel blackHorsePanel = new ImagePanel(new ImageIcon( - "resources/Black horse.png").getImage()); + ImagePanel blackHorsePanel = new ImagePanel(new ImageIcon("resources/Black horse.png").getImage()); this.gameBoardPanel.add(blackHorsePanel); blackHorsePanel.setRow(row); blackHorsePanel.setColumn(column); - blackHorsePanel.setLocation(blackHorsePanel.getPixelX(), - blackHorsePanel.getPixelY()); + blackHorsePanel.setLocation(blackHorsePanel.getPixelX(), blackHorsePanel.getPixelY()); blackHorsePanel.setVisible(true); this.boardPieces[row][column] = blackHorsePanel; break; case 'd': - ImagePanel blackDogPanel = new ImagePanel(new ImageIcon( - "resources/Black dog.png").getImage()); + ImagePanel blackDogPanel = new ImagePanel(new ImageIcon("resources/Black dog.png").getImage()); this.gameBoardPanel.add(blackDogPanel); blackDogPanel.setRow(row); blackDogPanel.setColumn(column); - blackDogPanel.setLocation(blackDogPanel.getPixelX(), - blackDogPanel.getPixelY()); + blackDogPanel.setLocation(blackDogPanel.getPixelX(), blackDogPanel.getPixelY()); blackDogPanel.setVisible(true); this.boardPieces[row][column] = blackDogPanel; break; case 'k': - ImagePanel blackCatPanel = new ImagePanel(new ImageIcon( - "resources/Black cat.png").getImage()); + ImagePanel blackCatPanel = new ImagePanel(new ImageIcon("resources/Black cat.png").getImage()); this.gameBoardPanel.add(blackCatPanel); blackCatPanel.setRow(row); blackCatPanel.setColumn(column); - blackCatPanel.setLocation(blackCatPanel.getPixelX(), - blackCatPanel.getPixelY()); + blackCatPanel.setLocation(blackCatPanel.getPixelX(), blackCatPanel.getPixelY()); blackCatPanel.setVisible(true); this.boardPieces[row][column] = blackCatPanel; break; case 'r': - ImagePanel blackRabbitPanel = new ImagePanel(new ImageIcon( - "resources/Black rabbit.png").getImage()); + ImagePanel blackRabbitPanel = new ImagePanel( + new ImageIcon("resources/Black rabbit.png").getImage()); this.gameBoardPanel.add(blackRabbitPanel); blackRabbitPanel.setRow(row); blackRabbitPanel.setColumn(column); - blackRabbitPanel.setLocation(blackRabbitPanel.getPixelX(), - blackRabbitPanel.getPixelY()); + blackRabbitPanel.setLocation(blackRabbitPanel.getPixelX(), blackRabbitPanel.getPixelY()); blackRabbitPanel.setVisible(true); this.boardPieces[row][column] = blackRabbitPanel; break; @@ -288,34 +246,175 @@ protected void renderBoard() { this.boardPieces[i][k] = null; } } - moveCountLabel.setText(" " + "Moves Left: \n" - + game.getNumMoves() + ""); - turnCountLabel.setText(" " + "Turn: " + game.getTurnCounter() - + ""); + moveCountLabel.setText(" " + "Moves Left: \n" + game.getNumMoves() + ""); + turnCountLabel.setText(" " + "Turn: " + game.getTurnCounter() + ""); if (game.getPlayerTurn() == 1) { - turnIndicatorLabel.setText(" " + game.getP1Name() - + "'s turn" + ""); + turnIndicatorLabel.setText(" " + game.getP1Name() + "'s turn" + ""); } else { - turnIndicatorLabel.setText(" " + game.getP2Name() - + "'s turn" + ""); + turnIndicatorLabel.setText(" " + game.getP2Name() + "'s turn" + ""); } renderInitialBoard(); } + public void createWinWindow() { + String playerName = ""; + if (this.game.getWinner() == 1) + playerName = game.getP1Name(); + else if (this.game.getWinner() == 2) + playerName = game.getP2Name(); + + JFrame winnerFrame = new JFrame(); + activeFrames.add(winnerFrame); + winnerFrame.setTitle("Winner!"); + winnerFrame.setLocation(650 / 2 - 324 / 2 + 75, 650 / 2 - 324 / 2 + 0); + winnerFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + winnerFrame.setVisible(true); + + ImagePanel panel = new ImagePanel(new ImageIcon("resources/BoardStoneBigCropped.jpg").getImage()); + winnerFrame.getContentPane().add(panel); + winnerFrame.pack(); + panel.setVisible(true); + + // Set Up winner name Label + JLabel winnerLabel = createLabel( + "
" + playerName + " Wins!" + "", Color.WHITE, + 24, 150, 150, winnerFrame.getWidth() / 2 - 75, winnerFrame.getHeight() / 2 - 87); + panel.add(winnerLabel); + panel.repaint(); + } + + // Method extracted from duplicate code in StartGameListener and + // LoadGameListener. yay! + public void setupForGame() { + JFrame mainMenu = activeFrames.get(0); + activeFrames.remove(0); + mainMenu.dispose(); + + JFrame gameFrame = new JFrame(); + activeFrames.add(gameFrame); + gameFrame.setTitle("Let's Play!"); + gameFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + + ImagePanel panel = new ImagePanel(new ImageIcon("resources/board.jpg").getImage()); + activeFrames.get(0).getContentPane().add(panel); + activeFrames.get(0).pack(); + panel.setVisible(true); + gameBoardPanel = panel; + + gameBoardPanel.addMouseListener(new MovementListener()); + activeFrames.get(0).setBackground(Color.BLACK); + + gameFrame.setVisible(true); + + // Set Up Player1 Label + JLabel player1Label = createLabel(" Player 1: ", Color.BLACK, 22, 110, 25, 675, 25); + gameBoardPanel.add(player1Label); + + // Set Up Player1 name Label + JLabel player1NameLabel = createLabel(" " + game.p1Name + "", Color.BLACK, 18, 110, 100, + 675, 25); + gameBoardPanel.add(player1NameLabel); + + // Set Up Player2 Label + JLabel player2Label = createLabel(" Player 2: ", Color.BLACK, 22, 110, 25, 675, 550); + gameBoardPanel.add(player2Label); + + // Set Up Player2 name Label + JLabel player2NameLabel = createLabel(" " + game.p2Name + "", Color.BLACK, 18, 110, 100, + 675, 550); + gameBoardPanel.add(player2NameLabel); + + // Set up Turn Counter label + turnCountLabel = createLabel(" " + "Turn: " + game.getTurnCounter() + "", Color.BLACK, 18, + 110, 25, 675, 130); + gameBoardPanel.add(turnCountLabel); + + // Set up Player Turn label + String playerTurnLabelText = ""; + if (game.getPlayerTurn() == 1) { + playerTurnLabelText = " " + game.getP1Name() + "'s turn" + ""; + } else { + playerTurnLabelText = " " + game.getP2Name() + "'s turn" + ""; + } + turnIndicatorLabel = createLabel(playerTurnLabelText, Color.BLACK, 18, 110, 50, 675, 200); + gameBoardPanel.add(turnIndicatorLabel); + + // Set up move counter label + moveCountLabel = createLabel(" " + "Moves Left: \n" + game.getNumMoves() + "", Color.BLACK, + 18, 110, 50, 675, 370); + gameBoardPanel.add(moveCountLabel); + + // Set up turn timer name label + JLabel turnTimerLabel = createLabel(" " + "Turn Time:" + "", Color.BLACK, 18, 110, 25, 675, + 450); + gameBoardPanel.add(turnTimerLabel); + + // Set up actual timer label + timerLabel = createLabel("", Color.BLACK, 18, 110, 25, 675, 475); + gameBoardPanel.add(timerLabel); + + // P1 Time Panel + TimePanel timePanel = new TimePanel(GUI.this, game, game.getTurnTimer(), timerLabel); + + // Set up Save Game Button + JButton saveButton = createButton("Save", 1, 12, 65, 50, 657, gameFrame.getHeight() / 2 - 90, + new SaveGameListener()); + gameBoardPanel.add(saveButton); + + // Set up Undo Button + JButton undoButton = createButton("Undo", 1, 12, 65, 50, 727, gameFrame.getHeight() / 2 - 90, + new UndoListener()); + gameBoardPanel.add(undoButton); + + // Set up End Turn Button + JButton endTurnButton = createButton("End Turn", 1, 12, 137, 50, 655, gameFrame.getHeight() / 2 - 37, + new EndTurnListener()); + gameBoardPanel.add(endTurnButton); + + renderInitialBoard(); + } + + // Label & Button create for convenience in Action Listeners + // DOCME: Long Parameter List bad smell, decided against making a parameter + // object, since this code is unlikely to change much in the futures + public JLabel createLabel(String text, Color fontColor, int fontSize, int width, int height, int x, int y) { + JLabel label = new JLabel(); + label.setText(text); + label.setForeground(fontColor); + Font labelFont = label.getFont(); + label.setFont(new Font(labelFont.getName(), 4, fontSize)); + label.setSize(width, height); + label.setLocation(x, y); + label.setVisible(true); + return label; + } + + public JButton createButton(String text, int fontStyle, int fontSize, int width, int height, int x, int y, + ActionListener listener) { + JButton button = new JButton(); + button.setSize(width, height); + button.setText(text); + Font buttonFont = button.getFont(); + button.setFont(new Font(buttonFont.getName(), fontStyle, fontSize)); + button.setLocation(x, y); + button.addActionListener(listener); + button.setVisible(true); + return button; + } + // ACTION LISTENERS - private class newGameListener implements ActionListener { + // TODO Extract? + private class NewGameListener implements ActionListener { @Override public void actionPerformed(ActionEvent e) { JFrame settingsFrame = new JFrame(); activeFrames.add(settingsFrame); settingsFrame.setTitle("New Game Options"); - settingsFrame.setLocation(650 / 2 - 324 / 2 + 5, 650 / 2 - 324 / 2 - + 44); + settingsFrame.setLocation(650 / 2 - 324 / 2 + 5, 650 / 2 - 324 / 2 + 44); settingsFrame.setVisible(true); - ImagePanel panel = new ImagePanel(new ImageIcon( - "resources/BoardStoneBigCropped.jpg").getImage()); + ImagePanel panel = new ImagePanel(new ImageIcon("resources/BoardStoneBigCropped.jpg").getImage()); settingsFrame.getContentPane().add(panel); settingsFrame.pack(); panel.setVisible(true); @@ -330,8 +429,7 @@ public void actionPerformed(ActionEvent e) { p1NameLabel.setFont(new Font(p1NameFont.getName(), 4, 14)); p1NameLabel.setSize(110, 25); panel.add(p1NameLabel); - p1NameLabel.setLocation( - panel.getWidth() / 2 - p1NameLabel.getWidth(), + p1NameLabel.setLocation(panel.getWidth() / 2 - p1NameLabel.getWidth(), panel.getHeight() / 2 - p1NameLabel.getHeight() * 2); p1NameLabel.setVisible(true); @@ -341,8 +439,7 @@ public void actionPerformed(ActionEvent e) { Font p1FieldFont = p1NameField.getFont(); p1NameLabel.setFont(new Font(p1FieldFont.getName(), 4, 14)); panel.add(p1NameField); - p1NameField.setLocation(panel.getWidth() / 2, panel.getHeight() / 2 - - p1NameField.getHeight() * 2); + p1NameField.setLocation(panel.getWidth() / 2, panel.getHeight() / 2 - p1NameField.getHeight() * 2); p1TextField = p1NameField; p1NameField.setVisible(true); @@ -354,8 +451,7 @@ public void actionPerformed(ActionEvent e) { p2NameLabel.setFont(new Font(p2NameFont.getName(), 4, 14)); p2NameLabel.setSize(110, 25); panel.add(p2NameLabel); - p2NameLabel.setLocation( - panel.getWidth() / 2 - p2NameLabel.getWidth(), + p2NameLabel.setLocation(panel.getWidth() / 2 - p2NameLabel.getWidth(), panel.getHeight() / 2 - p2NameLabel.getHeight()); p2NameLabel.setVisible(true); @@ -364,8 +460,7 @@ public void actionPerformed(ActionEvent e) { Font p2FieldFont = p2NameField.getFont(); p2NameLabel.setFont(new Font(p2FieldFont.getName(), 4, 14)); panel.add(p2NameField); - p2NameField.setLocation(panel.getWidth() / 2, panel.getHeight() / 2 - - p2NameField.getHeight()); + p2NameField.setLocation(panel.getWidth() / 2, panel.getHeight() / 2 - p2NameField.getHeight()); p2TextField = p2NameField; p2NameField.setVisible(true); @@ -377,53 +472,46 @@ public void actionPerformed(ActionEvent e) { turnTimerLabel.setFont(new Font(turnTimerFont.getName(), 4, 14)); turnTimerLabel.setSize(110, 25); panel.add(turnTimerLabel); - turnTimerLabel.setLocation( - panel.getWidth() / 2 - turnTimerLabel.getWidth(), - panel.getHeight() / 2); + turnTimerLabel.setLocation(panel.getWidth() / 2 - turnTimerLabel.getWidth(), panel.getHeight() / 2); turnTimerLabel.setVisible(true); - Integer[] turnTimerPresets = { 30, 45, 60, 75, 90, 105, 120, 135, - 150, 165, 180 }; - JComboBox turnTimerComboBox = new JComboBox( - turnTimerPresets); + Integer[] turnTimerPresets = { 30, 45, 60, 75, 90, 105, 120, 135, 150, 165, 180 }; + JComboBox turnTimerComboBox = new JComboBox(turnTimerPresets); timerComboBox = turnTimerComboBox; turnTimerComboBox.setEditable(false); turnTimerComboBox.setSize(110, 25); panel.add(turnTimerComboBox); - turnTimerComboBox.setLocation(panel.getWidth() / 2, - panel.getHeight() / 2); + turnTimerComboBox.setLocation(panel.getWidth() / 2, panel.getHeight() / 2); turnTimerComboBox.setVisible(true); // Set up Start Game Button JButton startGameButton = new JButton(); startGameButton.setSize(110, 25); startGameButton.setText("Start Game"); - startGameButton.setLocation((panel.getWidth() / 2) - - startGameButton.getWidth(), (panel.getHeight() / 2) - + (2 * startGameButton.getHeight())); + startGameButton.setLocation((panel.getWidth() / 2) - startGameButton.getWidth(), + (panel.getHeight() / 2) + (2 * startGameButton.getHeight())); panel.add(startGameButton); - startGameButton.addActionListener(new startGameListener()); + startGameButton.addActionListener(new StartGameListener()); startGameButton.setVisible(true); // Set up Cancel Button JButton cancelButton = new JButton(); cancelButton.setSize(110, 25); cancelButton.setText("Cancel"); - cancelButton.setLocation((panel.getWidth() / 2), - (panel.getHeight() / 2) + (2 * cancelButton.getHeight())); + cancelButton.setLocation((panel.getWidth() / 2), (panel.getHeight() / 2) + (2 * cancelButton.getHeight())); panel.add(cancelButton); - cancelButton.addActionListener(new cancelListener()); + cancelButton.addActionListener(new CancelListener()); cancelButton.setVisible(true); } } - private class loadGameListener implements ActionListener { + // TODO Extract? + private class LoadGameListener implements ActionListener { @Override public void actionPerformed(ActionEvent e) { JFileChooser fileChooser = new JFileChooser(); - fileChooser.setCurrentDirectory(new File(System - .getProperty("user.home"))); + fileChooser.setCurrentDirectory(new File(System.getProperty("user.home"))); int result = fileChooser.showOpenDialog(activeFrames.get(0)); if (result == JFileChooser.APPROVE_OPTION) { File selectedFile = fileChooser.getSelectedFile(); @@ -440,174 +528,14 @@ public void actionPerformed(ActionEvent e) { private void loadGame(File file) throws FileNotFoundException { Scanner scanner = new Scanner(file); if (game.loadFile(scanner)) { - JFrame mainMenu = activeFrames.get(0); - activeFrames.remove(0); - mainMenu.dispose(); - - JFrame gameFrame = new JFrame(); - activeFrames.add(gameFrame); - gameFrame.setTitle("Let's Play!"); - gameFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - - ImagePanel panel = new ImagePanel(new ImageIcon( - "resources/board.jpg").getImage()); - activeFrames.get(0).getContentPane().add(panel); - activeFrames.get(0).pack(); - panel.setVisible(true); - gameBoardPanel = panel; - - gameBoardPanel.addMouseListener(new MovementListener()); - activeFrames.get(0).setBackground(Color.BLACK); - - gameFrame.setVisible(true); - - // Set Up Player1 Label - JLabel p1Label = new JLabel(); - p1Label.setText(" Player 1: "); - p1Label.setForeground(Color.BLACK); - Font p1Font = p1Label.getFont(); - p1Label.setFont(new Font(p1Font.getName(), 4, 22)); - p1Label.setSize(110, 25); - gameBoardPanel.add(p1Label); - p1Label.setLocation(675, 25); - p1Label.setVisible(true); - - // Set Up Player1 name Label - JLabel p1NameLabel = new JLabel(); - p1NameLabel.setText(" " + game.p1Name + ""); - p1NameLabel.setForeground(Color.BLACK); - Font p1NameFont = p1NameLabel.getFont(); - p1NameLabel.setFont(new Font(p1NameFont.getName(), 4, 18)); - p1NameLabel.setSize(110, 100); - gameBoardPanel.add(p1NameLabel); - p1NameLabel.setLocation(675, 25); - p1NameLabel.setVisible(true); - - // Set Up Player2 Label - JLabel p2Label = new JLabel(); - p2Label.setText(" Player 2: "); - p2Label.setForeground(Color.BLACK); - Font p2Font = p2Label.getFont(); - p2Label.setFont(new Font(p2Font.getName(), 4, 22)); - p2Label.setSize(110, 25); - gameBoardPanel.add(p2Label); - p2Label.setLocation(675, 550); - p2Label.setVisible(true); - - // Set Up Player2 name Label - JLabel p2NameLabel = new JLabel(); - p2NameLabel.setText(" " + game.p2Name + ""); - p2NameLabel.setForeground(Color.BLACK); - Font p2NameFont = p2NameLabel.getFont(); - p2NameLabel.setFont(new Font(p2NameFont.getName(), 4, 18)); - p2NameLabel.setSize(110, 100); - gameBoardPanel.add(p2NameLabel); - p2NameLabel.setLocation(675, 550); - p2NameLabel.setVisible(true); - - // Set up Turn Counter label - JLabel turnCounterLabel = new JLabel(); - turnCountLabel = turnCounterLabel; - turnCounterLabel.setText(" " + "Turn: " - + game.getTurnCounter() + ""); - turnCounterLabel.setForeground(Color.BLACK); - Font turnCounterFont = turnCounterLabel.getFont(); - turnCounterLabel.setFont(new Font(turnCounterFont.getName(), 4, - 18)); - turnCounterLabel.setSize(110, 25); - gameBoardPanel.add(turnCounterLabel); - turnCounterLabel.setLocation(675, 130); - turnCounterLabel.setVisible(true); - - // Set up Player Turn label - JLabel playerTurnLabel = new JLabel(); - turnIndicatorLabel = playerTurnLabel; - if (game.getPlayerTurn() == 1) { - playerTurnLabel.setText(" " + game.getP1Name() - + "'s turn" + ""); - } else { - playerTurnLabel.setText(" " + game.getP2Name() - + "'s turn" + ""); - } - playerTurnLabel.setForeground(Color.BLACK); - Font playerTurnFont = playerTurnLabel.getFont(); - playerTurnLabel.setFont(new Font(playerTurnFont.getName(), 4, - 18)); - playerTurnLabel.setSize(110, 50); - gameBoardPanel.add(playerTurnLabel); - playerTurnLabel.setLocation(675, 200); - playerTurnLabel.setVisible(true); - - // Set up move counter label - JLabel moveCounterLabel = new JLabel(); - moveCountLabel = moveCounterLabel; - moveCounterLabel.setText(" " + "Moves Left: \n" - + game.getNumMoves() + ""); - moveCounterLabel.setForeground(Color.BLACK); - Font moveCounterFont = moveCounterLabel.getFont(); - moveCounterLabel.setFont(new Font(moveCounterFont.getName(), 4, - 18)); - moveCounterLabel.setSize(110, 50); - gameBoardPanel.add(moveCounterLabel); - moveCounterLabel.setLocation(675, 370); - moveCounterLabel.setVisible(true); - - // Set up turn timer name label - JLabel turnTimerNameLabel = new JLabel(); - turnTimerNameLabel.setText(" " + "Turn Time:" - + ""); - turnTimerNameLabel.setForeground(Color.BLACK); - Font turnTimerNameFont = turnTimerNameLabel.getFont(); - turnTimerNameLabel.setFont(new Font( - turnTimerNameFont.getName(), 4, 18)); - turnTimerNameLabel.setSize(110, 25); - gameBoardPanel.add(turnTimerNameLabel); - turnTimerNameLabel.setLocation(675, 450); - turnTimerNameLabel.setVisible(true); - - // Set up actual timer label - JLabel turnTimerLabel = new JLabel(); - timerLabel = turnTimerLabel; - turnTimerLabel.setForeground(Color.BLACK); - Font turnTimerFont = turnTimerLabel.getFont(); - turnTimerLabel - .setFont(new Font(turnTimerFont.getName(), 4, 18)); - turnTimerLabel.setSize(110, 25); - gameBoardPanel.add(turnTimerLabel); - turnTimerLabel.setLocation(675, 475); - turnTimerLabel.setVisible(true); - - // P1 Time Panel - TimePanel timePanel = new TimePanel(GUI.this, game, - game.getTurnTimer(), timerLabel); - timer = timePanel; - - // Set up Save Game Button - JButton saveGameButton = new JButton(); - saveGameButton.setSize(65, 75); - saveGameButton.setText("Save"); - saveGameButton.setLocation(660, gameFrame.getHeight() / 2 - 75); - gameBoardPanel.add(saveGameButton); - saveGameButton.addActionListener(new SaveGameListener()); - saveGameButton.setVisible(true); - - // Set up Undo Button - JButton undoButton = new JButton(); - undoButton.setSize(65, 75); - undoButton.setText("Undo"); - undoButton.setLocation(730, gameFrame.getHeight() / 2 - 75); - gameBoardPanel.add(undoButton); - undoButton.addActionListener(new UndoListener()); - undoButton.setVisible(true); - - renderInitialBoard(); + setupForGame(); } else { System.err.println("Invalid game state"); } } } - private class cancelListener implements ActionListener { + private class CancelListener implements ActionListener { @Override public void actionPerformed(ActionEvent e) { @@ -617,7 +545,8 @@ public void actionPerformed(ActionEvent e) { } } - private class startGameListener implements ActionListener { + // TODO Extract to another class? + private class StartGameListener implements ActionListener { @Override public void actionPerformed(ActionEvent e) { @@ -634,175 +563,19 @@ public void actionPerformed(ActionEvent e) { activeFrames.remove(1); settings.dispose(); - JFrame mainMenu = activeFrames.get(0); - activeFrames.remove(0); - mainMenu.dispose(); - - JFrame gameFrame = new JFrame(); - activeFrames.add(gameFrame); - gameFrame.setTitle("Let's Play!"); - gameFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - - ImagePanel panel = new ImagePanel(new ImageIcon( - "resources/board.jpg").getImage()); - activeFrames.get(0).getContentPane().add(panel); - activeFrames.get(0).pack(); - panel.setVisible(true); - gameBoardPanel = panel; - - gameBoardPanel.addMouseListener(new MovementListener()); - activeFrames.get(0).setBackground(Color.BLACK); - - gameFrame.setVisible(true); - // Set Up Player1 Label - JLabel p1Label = new JLabel(); - p1Label.setText(" Player 1: "); - p1Label.setForeground(Color.BLACK); - Font p1Font = p1Label.getFont(); - p1Label.setFont(new Font(p1Font.getName(), 4, 22)); - p1Label.setSize(110, 25); - gameBoardPanel.add(p1Label); - p1Label.setLocation(675, 25); - p1Label.setVisible(true); - - // Set Up Player1 name Label - JLabel p1NameLabel = new JLabel(); - p1NameLabel.setText(" " + game.p1Name + ""); - p1NameLabel.setForeground(Color.BLACK); - Font p1NameFont = p1NameLabel.getFont(); - p1NameLabel.setFont(new Font(p1NameFont.getName(), 4, 18)); - p1NameLabel.setSize(110, 100); - gameBoardPanel.add(p1NameLabel); - p1NameLabel.setLocation(675, 25); - p1NameLabel.setVisible(true); - - // Set Up Player2 Label - JLabel p2Label = new JLabel(); - p2Label.setText(" Player 2: "); - p2Label.setForeground(Color.BLACK); - Font p2Font = p2Label.getFont(); - p2Label.setFont(new Font(p2Font.getName(), 4, 22)); - p2Label.setSize(110, 25); - gameBoardPanel.add(p2Label); - p2Label.setLocation(675, 550); - p2Label.setVisible(true); - - // Set Up Player2 name Label - JLabel p2NameLabel = new JLabel(); - p2NameLabel.setText(" " + game.p2Name + ""); - p2NameLabel.setForeground(Color.BLACK); - Font p2NameFont = p2NameLabel.getFont(); - p2NameLabel.setFont(new Font(p2NameFont.getName(), 4, 18)); - p2NameLabel.setSize(110, 100); - gameBoardPanel.add(p2NameLabel); - p2NameLabel.setLocation(675, 550); - p2NameLabel.setVisible(true); - - // Set up Turn Counter label - JLabel turnCounterLabel = new JLabel(); - turnCountLabel = turnCounterLabel; - turnCounterLabel.setText(" " + "Turn: " - + game.getTurnCounter() + ""); - turnCounterLabel.setForeground(Color.BLACK); - Font turnCounterFont = turnCounterLabel.getFont(); - turnCounterLabel - .setFont(new Font(turnCounterFont.getName(), 4, 18)); - turnCounterLabel.setSize(110, 25); - gameBoardPanel.add(turnCounterLabel); - turnCounterLabel.setLocation(675, 130); - turnCounterLabel.setVisible(true); - - // Set up Player Turn label - JLabel playerTurnLabel = new JLabel(); - turnIndicatorLabel = playerTurnLabel; - if (game.getPlayerTurn() == 1) { - playerTurnLabel.setText(" " + game.getP1Name() - + "'s turn" + ""); - } else { - playerTurnLabel.setText(" " + game.getP2Name() - + "'s turn" + ""); - } - playerTurnLabel.setForeground(Color.BLACK); - Font playerTurnFont = playerTurnLabel.getFont(); - playerTurnLabel.setFont(new Font(playerTurnFont.getName(), 4, 18)); - playerTurnLabel.setSize(110, 50); - gameBoardPanel.add(playerTurnLabel); - playerTurnLabel.setLocation(675, 200); - playerTurnLabel.setVisible(true); - - // Set up move counter label - JLabel moveCounterLabel = new JLabel(); - moveCountLabel = moveCounterLabel; - moveCounterLabel.setText(" " + "Moves Left: \n" - + game.getNumMoves() + ""); - moveCounterLabel.setForeground(Color.BLACK); - Font moveCounterFont = moveCounterLabel.getFont(); - moveCounterLabel - .setFont(new Font(moveCounterFont.getName(), 4, 18)); - moveCounterLabel.setSize(110, 50); - gameBoardPanel.add(moveCounterLabel); - moveCounterLabel.setLocation(675, 370); - moveCounterLabel.setVisible(true); - - // Set up turn timer name label - JLabel turnTimerNameLabel = new JLabel(); - turnTimerNameLabel.setText(" " + "Turn Time:" - + ""); - turnTimerNameLabel.setForeground(Color.BLACK); - Font turnTimerNameFont = turnTimerNameLabel.getFont(); - turnTimerNameLabel.setFont(new Font(turnTimerNameFont.getName(), 4, - 18)); - turnTimerNameLabel.setSize(110, 25); - gameBoardPanel.add(turnTimerNameLabel); - turnTimerNameLabel.setLocation(675, 450); - turnTimerNameLabel.setVisible(true); - - // Set up actual timer label - JLabel turnTimerLabel = new JLabel(); - timerLabel = turnTimerLabel; - turnTimerLabel.setForeground(Color.BLACK); - Font turnTimerFont = turnTimerLabel.getFont(); - turnTimerLabel.setFont(new Font(turnTimerFont.getName(), 4, 18)); - turnTimerLabel.setSize(110, 25); - gameBoardPanel.add(turnTimerLabel); - turnTimerLabel.setLocation(675, 475); - turnTimerLabel.setVisible(true); - - // P1 Time Panel - TimePanel timePanel = new TimePanel(GUI.this, game, - (int) timerComboBox.getSelectedItem(), timerLabel); - timer = timePanel; - - // Set up Save Game Button - JButton saveGameButton = new JButton(); - saveGameButton.setSize(65, 75); - saveGameButton.setText("Save"); - saveGameButton.setLocation(660, gameFrame.getHeight() / 2 - 75); - gameBoardPanel.add(saveGameButton); - saveGameButton.addActionListener(new SaveGameListener()); - saveGameButton.setVisible(true); - - // Set up Undo Button - JButton undoButton = new JButton(); - undoButton.setSize(65, 75); - undoButton.setText("Undo"); - undoButton.setLocation(730, gameFrame.getHeight() / 2 - 75); - gameBoardPanel.add(undoButton); - undoButton.addActionListener(new UndoListener()); - undoButton.setVisible(true); - - renderInitialBoard(); + game.setTurnTimer((int) timerComboBox.getSelectedItem()); + setupForGame(); } } + // TODO Extract to another class? private class SaveGameListener implements ActionListener { @Override public void actionPerformed(ActionEvent arg0) { File selectedFile = null; JFileChooser fileChooser = new JFileChooser(); - fileChooser.setCurrentDirectory(new File(System - .getProperty("user.home"))); + fileChooser.setCurrentDirectory(new File(System.getProperty("user.home"))); int result = fileChooser.showOpenDialog(gameBoardPanel); if (result == JFileChooser.APPROVE_OPTION) { selectedFile = fileChooser.getSelectedFile(); @@ -827,6 +600,16 @@ public void actionPerformed(ActionEvent arg0) { } } + private class EndTurnListener implements ActionListener { + + @Override + public void actionPerformed(ActionEvent arg0) { + game.endTurn(); + renderBoard(); + } + } + + // TODO Extract to seperate class? private class MovementListener implements MouseListener { ImagePanel selectedPiece; ImagePanel secondSelectedPiece; @@ -856,6 +639,7 @@ public void mouseExited(MouseEvent e) { // Not needed } + // TODO Possible refactor, method long and complicated @Override public void mousePressed(MouseEvent e) { int sourceX = (int) e.getPoint().getX(); @@ -876,60 +660,71 @@ public void mousePressed(MouseEvent e) { // If a piece is selected and an empty space is clicked // AKA move - else if (noSelectedPieceAndEmptySpaceClicked(rowClicked, - columnClicked)) { - int calculatedDirection = moveDirection(selectedPiece, - rowClicked, columnClicked); + else if (noSelectedPieceAndEmptySpaceClicked(rowClicked, columnClicked)) { + Integer calculatedDirection = null; + try { + calculatedDirection = moveDirection(selectedPiece, rowClicked, columnClicked); + } catch (ArimaaException e1) { + e1.printStackTrace(); + System.err.println("Arimaa Exception: " + e1.getMessage()); + } // Using move to check for valid move - if (game.move(selectedPiece.getRow(), - selectedPiece.getColumn(), calculatedDirection)) { - renderBoard(); + if (calculatedDirection != null) { + if (game.move(selectedPiece.getRow(), selectedPiece.getColumn(), calculatedDirection)) { + renderBoard(); + } + this.selectedPiece = null; + this.secondSelectedPiece = null; } - this.selectedPiece = null; - this.secondSelectedPiece = null; } // Piece already selected, clicked a second piece - else if (pieceSelectedAndSecondPieceClicked(rowClicked, - columnClicked)) { + else if (pieceSelectedAndSecondPieceClicked(rowClicked, columnClicked)) { this.secondSelectedPiece = boardPieces[rowClicked][columnClicked]; // Piece selected, Second piece selected, empty square // selected - } else if (twoPieceSelectedAndEmptySapceClicked(rowClicked, - columnClicked)) { + } else if (twoPieceSelectedAndEmptySpaceClicked(rowClicked, columnClicked)) { if (checkForPull(rowClicked, columnClicked)) { - int calculatedDirection = moveDirection(selectedPiece, - rowClicked, columnClicked); - - if (game.pull(this.selectedPiece.getRow(), - this.selectedPiece.getColumn(), - this.secondSelectedPiece.getRow(), - this.secondSelectedPiece.getColumn(), - calculatedDirection)) { - renderBoard(); + Integer calculatedDirection = null; + try { + calculatedDirection = moveDirection(selectedPiece, rowClicked, columnClicked); + } catch (ArimaaException e1) { + e1.printStackTrace(); + System.err.println("Arimaa Exception: " + e1.getMessage()); + } + if (calculatedDirection != null) { + if (game.pull(this.selectedPiece.getRow(), this.selectedPiece.getColumn(), + this.secondSelectedPiece.getRow(), this.secondSelectedPiece.getColumn(), + calculatedDirection)) { + renderBoard(); + } + this.selectedPiece = null; + this.secondSelectedPiece = null; } - this.selectedPiece = null; - this.secondSelectedPiece = null; } else if (checkForPush(rowClicked, columnClicked)) { - int calculatedDirection1 = moveDirectionOnePush( - selectedPiece, secondSelectedPiece); - - int calculatedDirection2 = moveDirectionTwoPush( - secondSelectedPiece, rowClicked, columnClicked); - - if (game.push(this.selectedPiece.getRow(), - this.selectedPiece.getColumn(), - calculatedDirection1, calculatedDirection2)) { - renderBoard(); + Integer calculatedDirection1 = null; + Integer calculatedDirection2 = null; + try { + calculatedDirection1 = moveDirectionOnePush(selectedPiece, secondSelectedPiece); + calculatedDirection2 = moveDirectionTwoPush(secondSelectedPiece, rowClicked, columnClicked); + } catch (ArimaaException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + if (calculatedDirection1 != null && calculatedDirection2 != null) { + if (game.push(this.selectedPiece.getRow(), this.selectedPiece.getColumn(), + calculatedDirection1, calculatedDirection2)) { + renderBoard(); + } + this.selectedPiece = null; + this.secondSelectedPiece = null; } - this.selectedPiece = null; - this.secondSelectedPiece = null; } } @@ -942,93 +737,77 @@ else if (pieceSelectedAndSecondPieceClicked(rowClicked, } - private int moveDirectionTwoPush(ImagePanel secondSelectedPiece2, - int rowClicked, int columnClicked) { - if (secondSelectedPiece.getRow() - 1 == rowClicked - && secondSelectedPiece.getColumn() == columnClicked) + private int moveDirectionTwoPush(ImagePanel secondSelectedPiece2, int rowClicked, int columnClicked) + throws ArimaaException { + if (secondSelectedPiece.getRow() - 1 == rowClicked && secondSelectedPiece.getColumn() == columnClicked) return 0; - else if (secondSelectedPiece.getColumn() + 1 == columnClicked - && secondSelectedPiece.getRow() == rowClicked) + else if (secondSelectedPiece.getColumn() + 1 == columnClicked && secondSelectedPiece.getRow() == rowClicked) return 1; - else if (secondSelectedPiece.getRow() + 1 == rowClicked - && secondSelectedPiece.getColumn() == columnClicked) + else if (secondSelectedPiece.getRow() + 1 == rowClicked && secondSelectedPiece.getColumn() == columnClicked) return 2; - else if (secondSelectedPiece.getColumn() - 1 == columnClicked - && secondSelectedPiece.getRow() == rowClicked) + else if (secondSelectedPiece.getColumn() - 1 == columnClicked && secondSelectedPiece.getRow() == rowClicked) return 3; - return -1; // Shouldn't ever happen + else { + throw new ArimaaException("GUI.moveDirectionTwoPush(): Invalid push movement :("); + } } - private int moveDirectionOnePush(ImagePanel selectedPiece2, - ImagePanel secondSelectedPiece2) { + private int moveDirectionOnePush(ImagePanel selectedPiece2, ImagePanel secondSelectedPiece2) + throws ArimaaException { if (selectedPiece.getRow() - 1 == secondSelectedPiece.getRow() - && selectedPiece.getColumn() == secondSelectedPiece - .getColumn()) + && selectedPiece.getColumn() == secondSelectedPiece.getColumn()) return 0; - else if (selectedPiece.getColumn() + 1 == secondSelectedPiece - .getColumn() + else if (selectedPiece.getColumn() + 1 == secondSelectedPiece.getColumn() && selectedPiece.getRow() == secondSelectedPiece.getRow()) return 1; else if (selectedPiece.getRow() + 1 == secondSelectedPiece.getRow() - && selectedPiece.getColumn() == secondSelectedPiece - .getColumn()) + && selectedPiece.getColumn() == secondSelectedPiece.getColumn()) return 2; - else if (selectedPiece.getColumn() - 1 == secondSelectedPiece - .getColumn() + else if (selectedPiece.getColumn() - 1 == secondSelectedPiece.getColumn() && selectedPiece.getRow() == secondSelectedPiece.getRow()) return 3; - return -1; // Shouldn't ever happen + else { + throw new ArimaaException("GUI.moveDirectionOnePush(): Invalid push movement :("); + } } - private boolean twoPieceSelectedAndEmptySapceClicked(int rowClicked, - int columnClicked) { - return this.selectedPiece != null - && this.secondSelectedPiece != null + private boolean twoPieceSelectedAndEmptySpaceClicked(int rowClicked, int columnClicked) { + return this.selectedPiece != null && this.secondSelectedPiece != null && boardPieces[rowClicked][columnClicked] == null; } - private boolean pieceSelectedAndSecondPieceClicked(int rowClicked, - int columnClicked) { - return this.selectedPiece != null - && this.secondSelectedPiece == null + private boolean pieceSelectedAndSecondPieceClicked(int rowClicked, int columnClicked) { + return this.selectedPiece != null && this.secondSelectedPiece == null && boardPieces[rowClicked][columnClicked] != null && this.selectedPiece != boardPieces[rowClicked][columnClicked]; } - private int moveDirection(ImagePanel selectedPiece2, int rowClicked, - int columnClicked) { - if (selectedPiece.getRow() - 1 == rowClicked - && selectedPiece.getColumn() == columnClicked) + private int moveDirection(ImagePanel selectedPiece2, int rowClicked, int columnClicked) throws ArimaaException { + if (selectedPiece.getRow() - 1 == rowClicked && selectedPiece.getColumn() == columnClicked) return 0; - else if (selectedPiece.getColumn() + 1 == columnClicked - && selectedPiece.getRow() == rowClicked) + else if (selectedPiece.getColumn() + 1 == columnClicked && selectedPiece.getRow() == rowClicked) return 1; - else if (selectedPiece.getRow() + 1 == rowClicked - && selectedPiece.getColumn() == columnClicked) + else if (selectedPiece.getRow() + 1 == rowClicked && selectedPiece.getColumn() == columnClicked) return 2; - else if (selectedPiece.getColumn() - 1 == columnClicked - && selectedPiece.getRow() == rowClicked) + else if (selectedPiece.getColumn() - 1 == columnClicked && selectedPiece.getRow() == rowClicked) return 3; - return -1; // Please never happen... + else { + throw new ArimaaException("GUI.moveDirection(): Invalid direction :("); + } } - private boolean noSelectedPieceAndEmptySpaceClicked(int rowClicked, - int columnClicked) { - return this.selectedPiece != null - && this.secondSelectedPiece == null + private boolean noSelectedPieceAndEmptySpaceClicked(int rowClicked, int columnClicked) { + return this.selectedPiece != null && this.secondSelectedPiece == null && boardPieces[rowClicked][columnClicked] == null; } - private boolean noPieceSelectedAndPieceClicked(int rowClicked, - int columnClicked) { - return boardPieces[rowClicked][columnClicked] != null - && this.selectedPiece == null + private boolean noPieceSelectedAndPieceClicked(int rowClicked, int columnClicked) { + return boardPieces[rowClicked][columnClicked] != null && this.selectedPiece == null && this.secondSelectedPiece == null; } private boolean clickOnBoard(int rowClicked, int columnClicked) { - return rowClicked <= 7 && rowClicked >= 0 && columnClicked <= 7 - && columnClicked >= 0; + return rowClicked <= 7 && rowClicked >= 0 && columnClicked <= 7 && columnClicked >= 0; } private boolean checkForPush(int rowClicked, int columnClicked) { @@ -1055,67 +834,28 @@ private boolean checkForPush(int rowClicked, int columnClicked) { } private boolean checkForPull(int rowClicked, int columnClicked) { - if (this.selectedPiece.getRow() + 1 == rowClicked - && this.selectedPiece.getColumn() == columnClicked) { + if (this.selectedPiece.getRow() + 1 == rowClicked && this.selectedPiece.getColumn() == columnClicked) { // numMoves-=2; return true; } - if (this.selectedPiece.getRow() - 1 == rowClicked - && this.selectedPiece.getColumn() == columnClicked) { + if (this.selectedPiece.getRow() - 1 == rowClicked && this.selectedPiece.getColumn() == columnClicked) { // numMoves-=2; return true; } - if (this.selectedPiece.getRow() == rowClicked - && this.selectedPiece.getColumn() + 1 == columnClicked) { + if (this.selectedPiece.getRow() == rowClicked && this.selectedPiece.getColumn() + 1 == columnClicked) { // numMoves--; return true; } - if (this.selectedPiece.getRow() == rowClicked - && this.selectedPiece.getColumn() - 1 == columnClicked) { + if (this.selectedPiece.getRow() == rowClicked && this.selectedPiece.getColumn() - 1 == columnClicked) { // numMoves--; return true; } return false; } } - - public void createWinWindow() { - String playerName = ""; - if (this.game.getWinner() == 1) - playerName = game.getP1Name(); - else if (this.game.getWinner() == 2) - playerName = game.getP2Name(); - - JFrame winnerFrame = new JFrame(); - activeFrames.add(winnerFrame); - winnerFrame.setTitle("Winner!"); - winnerFrame.setLocation(650 / 2 - 324 / 2 + 5, 650 / 2 - 324 / 2 - + 44); - winnerFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - winnerFrame.setVisible(true); - - ImagePanel panel = new ImagePanel(new ImageIcon( - "resources/BoardStoneBigCropped.jpg").getImage()); - winnerFrame.getContentPane().add(panel); - winnerFrame.pack(); - panel.setVisible(true); - - - // Set Up winner name Label - JLabel winnerLabel = new JLabel(); - winnerLabel.setText("
" + playerName + " Wins!" - + ""); - winnerLabel.setForeground(Color.WHITE); - Font winnerFont = winnerLabel.getFont(); - winnerLabel.setFont(new Font(winnerFont.getName(), 4, 24)); - winnerLabel.setSize(150, 150); - panel.add(winnerLabel); - winnerLabel - .setLocation(winnerFrame.getWidth() / 2 - 75, winnerFrame.getHeight() / 2 - 87); - winnerLabel.setVisible(true); - } } +// TODO: Extract this to another class? class ImagePanel extends JPanel { /** diff --git a/src/game/Game.java b/src/game/Game.java index 79aae45..221b1ee 100644 --- a/src/game/Game.java +++ b/src/game/Game.java @@ -67,6 +67,9 @@ public Piece getSpace(int row, int column) { * @return */ public boolean move(int row, int column, int dir) { + if(numMoves<=0){ + return false; + } if (!isValidMoveFromSquare(row, column)) return false; boards.add(currentBoard); @@ -123,7 +126,7 @@ private boolean isValidMoveFromSquare(int row, int column) { if ((checkStrongerAdjacent(row, column) && !checkFriendlyAdjacent(row, column)) && !isPushPull){ //System.out.println("Can't move "+isPushPull); - return false;// can't move + return false;// can't move } return true; } @@ -146,15 +149,16 @@ private void endMove() { checkDeaths(5, 5); checkWin(); numMoves--; - if (numMoves <= 0) { - if (getPlayerTurn() == 1) { - setPlayerTurn(2); - } else { - setPlayerTurn(1); - } - numMoves = 4; - turnCounter++; + } + + public void endTurn() { + if (getPlayerTurn() == 1) { + setPlayerTurn(2); + } else { + setPlayerTurn(1); } + numMoves = 4; + turnCounter++; } // This method checks both rows for rabbits of the opposite side @@ -504,9 +508,16 @@ else if (row1 + 1 == row2) return -1; } + //EDITED 2015-12-09: Changed functionality so undo only reverts one move at a time, not the player's whole turn. public void undoMove(){ if(this.numMoves == 4) return; + this.currentBoard = this.boards.get(boards.size()-1); + this.boards.remove(this.boards.size()-1); + + this.numMoves += 1; + + /* if(this.numMoves == 3) { this.currentBoard = this.boards.get(boards.size()-1); this.boards.remove(this.boards.size()-1); @@ -523,6 +534,7 @@ public void undoMove(){ } this.numMoves = 4; + */ } public boolean loadFile(Scanner scanner) { @@ -657,6 +669,10 @@ public int getNumMoves() { public int getTurnTimer() { return moveTimer; } + + public void setTurnTimer(int time) { + this.moveTimer = time; + } /** * @return the winner: 0 is nobody, 1 is player1, 2 is player2 diff --git a/src/game/TimePanel.java b/src/game/TimePanel.java index 0a88cd6..99bcc23 100644 --- a/src/game/TimePanel.java +++ b/src/game/TimePanel.java @@ -9,8 +9,8 @@ public class TimePanel { private JLabel timerLabel; - Timer timer; - int playerTurn; + private Timer timer; + private int playerTurn; public TimePanel(GUI gui, Game game, int startTime, JLabel label) { diff --git a/src/testing/TestGame.java b/src/testing/TestGame.java index 0aeb091..32e4bea 100644 --- a/src/testing/TestGame.java +++ b/src/testing/TestGame.java @@ -266,6 +266,7 @@ public void testPushUp() { Game g = new Game(b2); assertTrue(g.push(4, 4, 0, 0)); assertTrue(g.push(3, 4, 0, 0)); + g.endTurn(); g.setPlayerTurn(1); assertTrue(g.push(2, 4, 0, 0)); assertFalse(g.push(1, 4, 0, 0)); @@ -294,9 +295,11 @@ public void testPushLeft() { Game g = new Game(b2); assertTrue(g.push(7, 6, 3, 3)); assertTrue(g.push(7, 5, 3, 3)); + g.endTurn(); g.setPlayerTurn(1); assertTrue(g.push(7, 4, 3, 3)); assertTrue(g.push(7, 3, 3, 3)); + g.endTurn(); g.setPlayerTurn(1); assertTrue(g.push(7, 2, 3, 3)); assertFalse(g.push(7, 1, 3, 3)); @@ -909,6 +912,7 @@ public void testUndoTwoMoves() { g.move(1, 0, 2); g.move(2, 0, 2); g.undoMove(); + g.undoMove(); assertEquals(new Piece('R'), g.getSpace(1,0)); } @Test @@ -918,6 +922,8 @@ public void testUndoThreeMoves() { g.move(2, 0, 2); g.move(3, 0, 2); g.undoMove(); + g.undoMove(); + g.undoMove(); assertEquals(new Piece('R'), g.getSpace(1,0)); } @Test @@ -927,6 +933,7 @@ public void testThatUndoCantCrossTurns(){ g.move(2, 0, 2); g.move(3, 0, 2); g.move(4, 0, 2); + g.endTurn(); g.undoMove(); assertEquals(new Piece('R'), g.getSpace(5,0)); } @@ -977,6 +984,7 @@ public void testEndMove(){ assertTrue(g.move(2,0,2)); assertTrue(g.move(3,0,2)); assertTrue(g.move(4,0,2)); + g.endTurn(); assertTrue(g.move(6,1,0)); assertTrue(g.move(5,1,0)); assertTrue(g.move(4,1,0)); diff --git a/src/testing/TestTimePanel.java b/src/testing/TestTimePanel.java index dc967cd..6372395 100644 --- a/src/testing/TestTimePanel.java +++ b/src/testing/TestTimePanel.java @@ -27,7 +27,6 @@ public void testUpdate() { try { Thread.sleep(500); } catch (InterruptedException e) { - // TODO Auto-generated catch block e.printStackTrace(); } assertEquals(" " + 0 + ":" + 14 + " ", tp.getTimerLabel().getText()); @@ -42,7 +41,6 @@ public void testCancelTimer(){ try { Thread.sleep(3500); } catch (InterruptedException e) { - // TODO Auto-generated catch block e.printStackTrace(); } assertEquals(1, game.getWinner()); @@ -58,20 +56,17 @@ public void testSwitchMove(){ try { Thread.sleep(100); } catch (InterruptedException e) { - // TODO Auto-generated catch block //e.printStackTrace(); } try { Thread.sleep(100); } catch (InterruptedException e) { - // TODO Auto-generated catch block //e.printStackTrace(); } Field playerTurn = null; try { playerTurn = TimePanel.class.getDeclaredField("playerTurn"); } catch (NoSuchFieldException | SecurityException e1) { - // TODO Auto-generated catch block //e1.printStackTrace(); } playerTurn.setAccessible(true); @@ -79,7 +74,6 @@ public void testSwitchMove(){ try { fieldValue = (int)playerTurn.get(tp); } catch (IllegalArgumentException | IllegalAccessException e) { - // TODO Auto-generated catch block //e.printStackTrace(); } assertEquals(2, fieldValue);