Skip to content

Commit

Permalink
Added fxml dependencies for running UI from CML. Updated README for i…
Browse files Browse the repository at this point in the history
…nstruction on UI. Added IntelliJ path setting.
  • Loading branch information
ginowangsh4 committed Jun 9, 2018
1 parent e12a76e commit cdf7448
Show file tree
Hide file tree
Showing 89 changed files with 334 additions and 8 deletions.
11 changes: 4 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,14 @@ Implementation of board game Tsuro with Java
- Jennifer Liu - jenniferliu2018@u.northwestern.edu
- Jin Han - jinhan2019@u.northwestern.edu

## Update on GUI and HPlayer
## GUI and HPlayer

We implemented most of the GUI and HPlayer but are struggling to run our app from command line. That being said, please try it out using any IDE (we recommend IntelliJ) following these steps:
- Compile and run all unit tests with `make`.
- Run this command `java -cp bin/ tsuro.Tsuro 10086 1 7 0`, which starts a local tournament with 1 HPlayer and 7 MPlayers, the number, e.g. 10086, is the port number any remote players can connect to should you want to add any to the tournament.
- Navigate to the IDE and run the class (or the main function of this class) under `src/admin/App.java`. This should fire up the GUI and allow you to play the game as the HPlayer.
- Run `java -cp bin/ tsuro.Tsuro 10086 1 7 0`, which starts a local tournament with 1 HPlayer and 7 MPlayers, the number, e.g. `10086`, is the port number any remote players can connect to should you want to add any to the tournament.
- In a new terminal, run `java -cp bin/ tsuro.admin.App` to join the tournament as the HPlayer. This should fire up the GUI.

We still need to implement the case when a HPlayer tries to place pawn at an illegal starting position or to commit an illegal move.

Please give us some feedback or suggestion about how to start the GUI from command line!

## Test

Run all unit tests:
Expand All @@ -27,7 +24,7 @@ Run with test-play-a-turn:
- Use `./test-play-a-turn -h` to see options such as number of games to run and enable verbose display on console.

Run a unit test suite:
- Better to compile first with `javac -cp lib/junit-jupiter-api-5.0.0.jar -d bin/ src/main/*.java src/test/*.java`.
- Better to compile first with `make`.
- Then run with `java -jar lib/junit-platform-console-standalone-1.2.0.jar --class-path bin/ -c TESTNAME`.
- You would need to specific package for the `TESTNAME` - see *Run from command line* section for more.

Expand Down
5 changes: 4 additions & 1 deletion Tsuro-Game.iml
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<component name="NewModuleRootManager">
<output url="file://$MODULE_DIR$/bin" />
<output-test url="file://$MODULE_DIR$/bin" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/test" isTestSource="true" packagePrefix="tsuro" />
<sourceFolder url="file://$MODULE_DIR$/lib" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" packagePrefix="tsuro" />
<sourceFolder url="file://$MODULE_DIR$/src/main" isTestSource="false" packagePrefix="tsuro" />
<sourceFolder url="file://$MODULE_DIR$/src/resources" type="java-resource" relativeOutputPath="tsuro" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
Expand Down
Binary file removed bin/Board.class
Binary file not shown.
Binary file removed bin/BoardTest.class
Binary file not shown.
Binary file removed bin/Deck.class
Binary file not shown.
Binary file removed bin/DeckTest.class
Binary file not shown.
Binary file removed bin/DragonTest.class
Binary file not shown.
Binary file removed bin/IPlayer.class
Binary file not shown.
Binary file removed bin/LegalPlayTest.class
Binary file not shown.
Binary file removed bin/ListFirstElementComparator.class
Binary file not shown.
Binary file removed bin/MPlayer$State.class
Binary file not shown.
Binary file removed bin/MPlayer.class
Binary file not shown.
Binary file removed bin/MPlayerTest.class
Binary file not shown.
Binary file removed bin/PlayATurnTest.class
Binary file not shown.
Binary file removed bin/SPlayer.class
Binary file not shown.
Binary file removed bin/Server.class
Binary file not shown.
Binary file removed bin/ServerTest.class
Binary file not shown.
Binary file removed bin/SymmetricComparator.class
Binary file not shown.
Binary file removed bin/Tile$1.class
Binary file not shown.
Binary file removed bin/Tile.class
Binary file not shown.
Binary file removed bin/TileTest.class
Binary file not shown.
Binary file removed bin/Token$1.class
Binary file not shown.
Binary file removed bin/Token.class
Binary file not shown.
Binary file added bin/apiguardian-api-1.0.0.jar
Binary file not shown.
Binary file added bin/hamcrest-core-1.3.jar
Binary file not shown.
Binary file added bin/junit-4.12.jar
Binary file not shown.
Binary file added bin/junit-jupiter-api-5.0.0.jar
Binary file not shown.
Binary file added bin/junit-jupiter-api-5.2.0.jar
Binary file not shown.
Binary file added bin/junit-platform-commons-1.0.0.jar
Binary file not shown.
Binary file added bin/junit-platform-commons-1.2.0.jar
Binary file not shown.
Binary file added bin/junit-platform-console-standalone-1.2.0.jar
Binary file not shown.
Binary file added bin/opentest4j-1.0.0.jar
Binary file not shown.
Binary file added bin/opentest4j-1.1.0.jar
Binary file not shown.
Binary file added bin/scenebuilder-8.4.1-all.jar
Binary file not shown.
Binary file modified bin/tsuro/Board.class
Binary file not shown.
Binary file modified bin/tsuro/BoardTest.class
Binary file not shown.
Binary file modified bin/tsuro/Deck.class
Binary file not shown.
Binary file modified bin/tsuro/DragonTest.class
Binary file not shown.
Binary file added bin/tsuro/HPlayer.class
Binary file not shown.
Binary file added bin/tsuro/HPlayerTest.class
Binary file not shown.
Binary file modified bin/tsuro/IPlayer.class
Binary file not shown.
Binary file removed bin/tsuro/LegalPlayTest.class
Binary file not shown.
Binary file removed bin/tsuro/ListFirstElementComparator.class
Binary file not shown.
Binary file added bin/tsuro/MPlayer$1.class
Binary file not shown.
Binary file modified bin/tsuro/MPlayer$State.class
Binary file not shown.
Binary file added bin/tsuro/MPlayer$Strategy.class
Binary file not shown.
Binary file modified bin/tsuro/MPlayer.class
Binary file not shown.
Binary file modified bin/tsuro/MPlayerTest.class
Binary file not shown.
Binary file added bin/tsuro/Pair.class
Binary file not shown.
Binary file added bin/tsuro/PlayATurnAdapter.class
Binary file not shown.
Binary file added bin/tsuro/PlayATurnAdapterTest.class
Binary file not shown.
Binary file removed bin/tsuro/PlayATurnTest.class
Binary file not shown.
Binary file added bin/tsuro/RemotePlayer.class
Binary file not shown.
Binary file modified bin/tsuro/SPlayer.class
Binary file not shown.
Binary file modified bin/tsuro/Server.class
Binary file not shown.
Binary file added bin/tsuro/ServerLegalPlayTest.class
Binary file not shown.
Binary file added bin/tsuro/ServerPlayATurnTest.class
Binary file not shown.
Binary file modified bin/tsuro/ServerTest.class
Binary file not shown.
Binary file removed bin/tsuro/SymmetricComparator.class
Binary file not shown.
Binary file modified bin/tsuro/Tile$1.class
Binary file not shown.
Binary file modified bin/tsuro/Tile$ListFirstElementComparator.class
Binary file not shown.
Binary file modified bin/tsuro/Tile$SymmetricComparator.class
Binary file not shown.
Binary file modified bin/tsuro/Tile.class
Binary file not shown.
Binary file modified bin/tsuro/TileTest.class
Binary file not shown.
Binary file modified bin/tsuro/Token$1.class
Binary file not shown.
Binary file modified bin/tsuro/Token.class
Binary file not shown.
Binary file added bin/tsuro/Tsuro.class
Binary file not shown.
Binary file added bin/tsuro/admin/Admin.class
Binary file not shown.
Binary file added bin/tsuro/admin/AdminSocket.class
Binary file not shown.
Binary file added bin/tsuro/admin/App.class
Binary file not shown.
36 changes: 36 additions & 0 deletions bin/tsuro/admin/EndGame.fxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.scene.control.Label?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.BorderPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?>

<BorderPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="560.0" prefWidth="480.0" xmlns="http://javafx.com/javafx/8.0.141" xmlns:fx="http://javafx.com/fxml/1" fx:controller="tsuro.admin.EndGameController">
<center>
<ImageView fx:id="boardImageView" fitHeight="360.0" fitWidth="360.0" pickOnBounds="true" preserveRatio="true" BorderPane.alignment="CENTER" />
</center>
<top>
<VBox alignment="CENTER" prefHeight="160.0" prefWidth="480.0" style="-fx-border-color: black;" BorderPane.alignment="CENTER">
<children>
<Label alignment="CENTER" prefHeight="40.0" prefWidth="480.0" text="Game is now over! Congratulations to these winners! ">
<font>
<Font size="14.0" />
</font></Label>
<Label fx:id="winnerList" alignment="CENTER" prefWidth="480.0" text="Label" textAlignment="CENTER">
<font>
<Font size="24.0" />
</font></Label>
</children></VBox>
</top>
<left>
<VBox prefHeight="360.0" prefWidth="60.0" BorderPane.alignment="CENTER" />
</left>
<right>
<VBox prefHeight="360.0" prefWidth="60.0" BorderPane.alignment="CENTER" />
</right>
<bottom>
<HBox prefHeight="30.0" prefWidth="480.0" BorderPane.alignment="CENTER" />
</bottom>
</BorderPane>
Binary file added bin/tsuro/admin/EndGameController.class
Binary file not shown.
236 changes: 236 additions & 0 deletions bin/tsuro/admin/PlacePawn.fxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,236 @@
<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.ChoiceBox?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.BorderPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?>
<?import javafx.scene.text.Text?>

<BorderPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="560.0" prefWidth="480.0" xmlns="http://javafx.com/javafx/8.0.141" xmlns:fx="http://javafx.com/fxml/1" fx:controller="tsuro.admin.PlacePawnController">
<center>
<ImageView fx:id="boardImageView" fitHeight="360.0" fitWidth="360.0" pickOnBounds="true" BorderPane.alignment="CENTER" />
</center>
<top>
<VBox prefHeight="140.0" prefWidth="480.0" BorderPane.alignment="CENTER">
<children>
<VBox prefHeight="80.0" prefWidth="480.0" style="-fx-border-color: black;">
<children>
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Choose a starting position to place pawn" textAlignment="CENTER">
<VBox.margin>
<Insets bottom="5.0" left="100.0" right="20.0" top="5.0" />
</VBox.margin>
<font>
<Font size="14.0" />
</font>
</Text>
<HBox alignment="CENTER" prefWidth="480.0">
<children>
<VBox prefWidth="100.0">
<children>
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Side" textAlignment="CENTER" />
<ChoiceBox fx:id="sideDropdown" prefWidth="80.0" />
</children>
<HBox.margin>
<Insets left="60.0" />
</HBox.margin>
<padding>
<Insets right="20.0" />
</padding>
</VBox>
<VBox prefWidth="100.0">
<children>
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Index" />
<ChoiceBox fx:id="indexDropdown" prefWidth="80.0" />
</children>
<HBox.margin>
<Insets />
</HBox.margin>
<padding>
<Insets right="20.0" />
</padding>
</VBox>
<Button fx:id="submitButton" mnemonicParsing="false" text="Submit">
<HBox.margin>
<Insets right="50.0" top="15.0" />
</HBox.margin>
</Button>
</children>
</HBox>
</children>
</VBox>
<HBox layoutX="10.0" layoutY="10.0" prefHeight="60.0" prefWidth="480.0">
<children>
<HBox prefHeight="60.0" prefWidth="60.0" />
<HBox prefHeight="60.0" prefWidth="60.0">
<children>
<Label alignment="BOTTOM_RIGHT" prefHeight="60.0" prefWidth="60.0" text="0 " />
<Label alignment="BOTTOM_LEFT" layoutX="10.0" layoutY="10.0" prefHeight="60.0" prefWidth="60.0" text=" 1" />
</children>
</HBox>
<HBox layoutX="70.0" layoutY="10.0" prefHeight="60.0" prefWidth="60.0">
<children>
<Label alignment="BOTTOM_RIGHT" prefHeight="60.0" prefWidth="60.0" text="2 " />
<Label alignment="BOTTOM_LEFT" layoutX="10.0" layoutY="10.0" prefHeight="60.0" prefWidth="60.0" text=" 3" />
</children>
</HBox>
<HBox layoutX="130.0" layoutY="10.0" prefHeight="60.0" prefWidth="60.0">
<children>
<Label alignment="BOTTOM_RIGHT" prefHeight="60.0" prefWidth="60.0" text="4 " />
<Label alignment="BOTTOM_LEFT" layoutX="10.0" layoutY="10.0" prefHeight="60.0" prefWidth="60.0" text=" 5" />
</children>
</HBox>
<HBox layoutX="70.0" layoutY="10.0" prefHeight="60.0" prefWidth="60.0">
<children>
<Label alignment="BOTTOM_RIGHT" prefHeight="60.0" prefWidth="60.0" text="6 " />
<Label alignment="BOTTOM_LEFT" layoutX="10.0" layoutY="10.0" prefHeight="60.0" prefWidth="60.0" text=" 7" />
</children>
</HBox>
<HBox layoutX="70.0" layoutY="10.0" prefHeight="60.0" prefWidth="60.0">
<children>
<Label alignment="BOTTOM_RIGHT" prefHeight="60.0" prefWidth="60.0" text="8 " />
<Label alignment="BOTTOM_LEFT" layoutX="10.0" layoutY="10.0" prefHeight="60.0" prefWidth="60.0" text=" 9" />
</children>
</HBox>
<HBox layoutX="190.0" layoutY="10.0" prefHeight="60.0" prefWidth="60.0">
<children>
<Label alignment="BOTTOM_RIGHT" prefHeight="60.0" prefWidth="60.0" text="10 " />
<Label alignment="BOTTOM_LEFT" layoutX="10.0" layoutY="10.0" prefHeight="60.0" prefWidth="60.0" text=" 11" />
</children>
</HBox>
<HBox layoutX="10.0" layoutY="10.0" prefHeight="60.0" prefWidth="60.0" />
</children>
</HBox>
</children></VBox>
</top>
<bottom>
<HBox prefHeight="60.0" prefWidth="480.0" BorderPane.alignment="CENTER">
<children>
<HBox prefHeight="60.0" prefWidth="60.0" />
<HBox layoutX="10.0" layoutY="10.0" prefHeight="60.0" prefWidth="60.0">
<children>
<Label alignment="CENTER_RIGHT" prefHeight="30.0" prefWidth="60.0" text="0 " />
<Label layoutX="10.0" layoutY="10.0" prefHeight="30.0" prefWidth="60.0" text=" 1" />
</children>
</HBox>
<HBox layoutX="70.0" layoutY="10.0" prefHeight="60.0" prefWidth="60.0">
<children>
<Label alignment="CENTER_RIGHT" prefHeight="30.0" prefWidth="60.0" text="2 " />
<Label layoutX="10.0" layoutY="10.0" prefHeight="30.0" prefWidth="60.0" text=" 3" />
</children>
</HBox>
<HBox layoutX="70.0" layoutY="10.0" prefHeight="60.0" prefWidth="60.0">
<children>
<Label alignment="CENTER_RIGHT" prefHeight="30.0" prefWidth="60.0" text="4 " />
<Label layoutX="10.0" layoutY="10.0" prefHeight="30.0" prefWidth="60.0" text=" 5" />
</children>
</HBox>
<HBox layoutX="130.0" layoutY="10.0" prefHeight="60.0" prefWidth="60.0">
<children>
<Label alignment="CENTER_RIGHT" prefHeight="30.0" prefWidth="60.0" text="6 " />
<Label layoutX="10.0" layoutY="10.0" prefHeight="30.0" prefWidth="60.0" text=" 7" />
</children>
</HBox>
<HBox layoutX="190.0" layoutY="10.0" prefHeight="60.0" prefWidth="60.0">
<children>
<Label alignment="CENTER_RIGHT" prefHeight="30.0" prefWidth="60.0" text="8 " />
<Label layoutX="10.0" layoutY="10.0" prefHeight="30.0" prefWidth="60.0" text=" 9" />
</children>
</HBox>
<HBox layoutX="250.0" layoutY="10.0" prefHeight="60.0" prefWidth="60.0">
<children>
<Label alignment="CENTER_RIGHT" prefHeight="30.0" prefWidth="60.0" text="10 " />
<Label layoutX="10.0" layoutY="10.0" prefHeight="30.0" prefWidth="60.0" text=" 11" />
</children>
</HBox>
<HBox layoutX="10.0" layoutY="10.0" prefHeight="60.0" prefWidth="60.0" />
</children></HBox>
</bottom>
<left>
<VBox prefHeight="360.0" prefWidth="60.0" BorderPane.alignment="CENTER">
<children>
<VBox prefHeight="60.0" prefWidth="30.0">
<children>
<Label alignment="BOTTOM_RIGHT" prefHeight="30.0" prefWidth="60.0" text="0 " />
<Label alignment="TOP_RIGHT" layoutX="10.0" layoutY="40.0" prefHeight="30.0" prefWidth="60.0" text="1 " />
</children>
</VBox>
<VBox layoutX="10.0" layoutY="10.0" prefHeight="60.0" prefWidth="30.0">
<children>
<Label alignment="BOTTOM_RIGHT" prefHeight="30.0" prefWidth="60.0" text="2 " />
<Label alignment="TOP_RIGHT" layoutX="10.0" layoutY="40.0" prefHeight="30.0" prefWidth="60.0" text="3 " />
</children>
</VBox>
<VBox layoutX="10.0" layoutY="70.0" prefHeight="60.0" prefWidth="30.0">
<children>
<Label alignment="BOTTOM_RIGHT" prefHeight="30.0" prefWidth="60.0" text="4 " />
<Label alignment="TOP_RIGHT" layoutX="10.0" layoutY="40.0" prefHeight="30.0" prefWidth="60.0" text="5 " />
</children>
</VBox>
<VBox layoutX="10.0" layoutY="70.0" prefHeight="60.0" prefWidth="30.0">
<children>
<Label alignment="BOTTOM_RIGHT" prefHeight="30.0" prefWidth="60.0" text="6 " />
<Label alignment="TOP_RIGHT" layoutX="10.0" layoutY="40.0" prefHeight="30.0" prefWidth="60.0" text="7 " />
</children>
</VBox>
<VBox layoutX="10.0" layoutY="130.0" prefHeight="60.0" prefWidth="30.0">
<children>
<Label alignment="BOTTOM_RIGHT" prefHeight="30.0" prefWidth="60.0" text="8 " />
<Label alignment="TOP_RIGHT" layoutX="10.0" layoutY="40.0" prefHeight="30.0" prefWidth="60.0" text="9 " />
</children>
</VBox>
<VBox layoutX="10.0" layoutY="190.0" prefHeight="60.0" prefWidth="30.0">
<children>
<Label alignment="BOTTOM_RIGHT" prefHeight="30.0" prefWidth="60.0" text="10 " />
<Label alignment="TOP_RIGHT" layoutX="10.0" layoutY="40.0" prefHeight="30.0" prefWidth="60.0" text="11 " />
</children>
</VBox>
</children>
</VBox>
</left>
<right>
<VBox prefHeight="360.0" prefWidth="60.0" BorderPane.alignment="CENTER">
<children>
<VBox prefHeight="200.0" prefWidth="100.0">
<children>
<Label alignment="BOTTOM_LEFT" prefHeight="30.0" prefWidth="60.0" text=" 0" />
<Label alignment="TOP_LEFT" layoutX="10.0" layoutY="10.0" prefHeight="30.0" prefWidth="60.0" text=" 1" />
</children>
</VBox>
<VBox layoutX="10.0" layoutY="10.0" prefHeight="200.0" prefWidth="100.0">
<children>
<Label alignment="BOTTOM_LEFT" prefHeight="30.0" prefWidth="60.0" text=" 2" />
<Label alignment="TOP_LEFT" layoutX="10.0" layoutY="10.0" prefHeight="30.0" prefWidth="60.0" text=" 3" />
</children>
</VBox>
<VBox layoutX="10.0" layoutY="190.0" prefHeight="200.0" prefWidth="100.0">
<children>
<Label alignment="BOTTOM_LEFT" prefHeight="30.0" prefWidth="60.0" text=" 4" />
<Label alignment="TOP_LEFT" layoutX="10.0" layoutY="10.0" prefHeight="30.0" prefWidth="60.0" text=" 5" />
</children>
</VBox>
<VBox layoutX="10.0" layoutY="250.0" prefHeight="200.0" prefWidth="100.0">
<children>
<Label alignment="BOTTOM_LEFT" prefHeight="30.0" prefWidth="60.0" text=" 6" />
<Label alignment="TOP_LEFT" layoutX="10.0" layoutY="10.0" prefHeight="30.0" prefWidth="60.0" text=" 7" />
</children>
</VBox>
<VBox layoutX="10.0" layoutY="190.0" prefHeight="200.0" prefWidth="100.0">
<children>
<Label alignment="BOTTOM_LEFT" prefHeight="30.0" prefWidth="60.0" text=" 8" />
<Label alignment="TOP_LEFT" layoutX="10.0" layoutY="10.0" prefHeight="30.0" prefWidth="60.0" text=" 9" />
</children>
</VBox>
<VBox layoutX="10.0" layoutY="82.0" prefHeight="200.0" prefWidth="100.0">
<children>
<Label alignment="BOTTOM_LEFT" prefHeight="30.0" prefWidth="60.0" text=" 10" />
<Label alignment="TOP_LEFT" layoutX="10.0" layoutY="10.0" prefHeight="30.0" prefWidth="60.0" text=" 11" />
</children>
</VBox>
</children></VBox>
</right>
</BorderPane>
Binary file added bin/tsuro/admin/PlacePawnController$Side.class
Binary file not shown.
Binary file added bin/tsuro/admin/PlacePawnController.class
Binary file not shown.
Loading

0 comments on commit cdf7448

Please sign in to comment.