Welcome to the VS Code Java world. Here is a guideline to help you get started to write Java code in Visual Studio Code.
The workspace contains two folders by default, where:
src
: the folder to maintain sourceslib
: the folder to maintain dependencies
Meanwhile, the compiled output files will be generated in the bin
folder by default.
If you want to customize the folder structure, open
.vscode/settings.json
and update the related settings there.
The JAVA PROJECTS
view allows you to manage your dependencies. More details can be found here.
-
Command-line compile. In the connectx/ directory run::
javac -cp ".." *.java */*.java javac -cp ".." L2/L2.java javac -cp ".." L3_5/L3.java javac -cp ".." L2/positionalEval.java javac -cp ".." CXFardoPlayer.java CXFardoPlayer.java javac -cp ".." L5/L5.java javac -cp ".." hope/hope.java
CXGame application:
-
Human vs Computer. In the connectx/ directory run:
java -cp ".." connectx.CXGame 6 7 4 connectx.L0.L0 java -cp ".." connectx.CXGame 6 7 4 connectx.L2.L2 java -cp ".." connectx.CXGame 6 7 4 connectx.L3_5.L3 java -cp ".." connectx.CXGame 6 7 4 connectx.CXFardoPlayer java -cp ".." connectx.CXGame 6 7 4 connectx.L5.L5
-
Computer vs Computer. In the connectx/ directory run:
java -cp ".." connectx.CXGame 6 7 4 connectx.L0.L0 connectx.L1.L1 java -cp ".." connectx.CXGame 6 7 4 connectx.CXFardoPlayer connectx.L1.L1 java -cp ".." connectx.CXGame 6 7 4 connectx.CXFardoPlayer connectx.L2.L2 java -cp ".." connectx.CXGame 6 7 4 connectx.L2.L2 connectx.L1.L1 java -cp ".." connectx.CXGame 6 7 4 connectx.L2.L2 connectx.L3.L3 java -cp ".." connectx.CXGame 6 7 4 connectx.L2.L2 connectx.hope.hope java -cp ".." connectx.CXGame 6 7 4 connectx.L3_5.L3 connectx.L1.L1 java -cp ".." connectx.CXGame 6 7 4 connectx.L2.L2 connectx.L5.L5 java -cp ".." connectx.CXGame 6 7 4 connectx.L5.L5 connectx.L2.L2
CXPlayerTester application:
-
Output score only:
java -cp ".." connectx.CXPlayerTester 6 7 4 connectx.L0.L0 connectx.L1.L1 java -cp ".." connectx.CXPlayerTester 6 7 4 connectx.CXFardoPlayer connectx.L2.L2 java -cp ".." connectx.CXPlayerTester 6 7 4 connectx.L2.L2 connectx.CXFardoPlayer java -cp ".." connectx.CXPlayerTester 6 7 4 connectx.L1.L1 connectx.CXFardoPlayer java -cp ".." connectx.CXPlayerTester 6 7 4 connectx.L2.L2 connectx.L1.L1 java -cp ".." connectx.CXPlayerTester 6 7 4 connectx.L1.L1 connectx.L2.L2 java -cp ".." connectx.CXPlayerTester 6 7 4 connectx.L2.L2 connectx.L3.L3 java -cp ".." connectx.CXPlayerTester 6 7 4 connectx.L3.L3 connectx.L2.L2 java -cp ".." connectx.CXPlayerTester 6 7 4 connectx.L2.L2 connectx.hope.hope -t 1 java -cp ".." connectx.CXPlayerTester 6 7 4 connectx.L5.L5 connectx.L2.L2 java -cp ".." connectx.CXPlayerTester 6 7 4 connectx.L2.L2 connectx.L5.L5 -t 1
-
logger: adding the flag: -1 -2 to save the game in a file in logger directory only if the player loses.
-
Diebbos notes:
quickSetup for testing: javac -cp ".." *.java /.java && java -cp ".." connectx.CXPlayerTester -2 6 7 4 connectx.L2.L2 connectx.L3.L3 -v
rm logger/LosingLogGame*.txt - to remove all the log files (FUNZIONA SU LINUX)
-
Verbose output
adding the flag: -v to print the game in the terminal.
java -cp ".." connectx.CXPlayerTester 6 7 4 connectx.L0.L0 connectx.L1.L1 -v
-
Verbose output and customized timeout (1 sec) and number of game repetitions (10 rounds)
java -cp ".." connectx.CXPlayerTester 6 7 4 connectx.L0.L0 connectx.L1.L1 -v -t 1 -r 10
L2: Aplha-Beta Pruning - Positional Evaluation L3: Iterative Deepening L4: Monte Carlo Tree Search