Layheng-Hok / Jungle-Chess

Jungle: Chess Game Engine - Implementation of Minimax, Alpha-Beta Pruning, Move Ordering, and Quiescence Search - SUSTech's project of course CS109: Introduction to Programming in Spring 2023 - Score: 110/100
1 stars 0 forks source link

Could you help us? #2

Open JSettler opened 5 months ago

JSettler commented 5 months ago

We are unable to build this interesting project.. Can you give us advice how to build it in IntelliJ IDEA community edition? In Linux Mint, does it need additional libraries to compile?

scharlach commented 5 months ago

To chip in, it would be helpful to set up the project for running without an IDE. Just a few commands should suffice. It would be also better to record the dependencies in a standard format, like pom.xml for the Maven, rather than an IntelliJ .iml . That would perhaps also make the jars in the lib directory unnecessary. Last, it could help to specify the target Java version.

Other than that, the project looks like a nice work, so it deserves to be more accessible to users.

Layheng-Hok commented 5 months ago

Hey there, I'm kinda in the middle of a hectic semester right now.

I do understand your request, but I'm pretty new to Maven or Gradle as I always stick with IntelliJ IDEA's default build tool. By running it without IDE, do you mean running the game on a JAR file? And for the Java version, I used JDK 17 for this project.

Responding to the first comment, I'm not sure on how to make it run on Linux Mint since I never use one. I'll try to release it as a JAR file if you just want to run the game and play it. With JVM set up, I think you should be able to run it.

I hope I can get back to resolve this issue asap. If you have any tips on how I should do it, pls lemme know, thanks:)

scharlach commented 5 months ago

Short answer: yes, a JAR file would be good.

Longer answer: I made it to work on the second try.

First, the IDE complained about missing JUnit:

java: package org.junit.jupiter.api does not exist

So I had to click around in the tests and tell it to install the missing import.

Then there was another missing library:

Can't load library: /usr/lib/jvm/java-17-openjdk-amd64/lib/libawt_xawt.so

It turned out that I installed openjdk-17-jdk-headless, but needed openjdk-17-jdk (this was on kubuntu 22.04). Then it started working.

Even longer answer: I am not a Java developer and I am more used to working with command line tools. Installing a whole IDE - and one specific IDE - in order to compile and run a project seems cumbersome to me. In the comparison, running commands like mvn package or javac compile and java -jar ... is much more concise and easier to isolate and debug when something goes wrong.

I understand you are busy. Don't worry too much, your reaction is already better than I expected :). Have a nice day

Layheng-Hok commented 5 months ago

Glad to hear that and sorry for the inconvenience. I tried to deploy it as a JAR file once, but things didn't work out as expected since some of the images in my resources folder didn't load properly, making the GUI incomplete. That JAR file ran fine on my laptop but not on other devices. I'll try to do it again soon, so that it's more accessible to someone who just wanna run it real quick and enjoy the game.

Thanks for ur kind words btw, hope you have fun with Jungle Chess and have a great day!!

hoang0902 commented 5 months ago

Exception in thread "main" java.lang.ExceptionInInitializerError at view.Controller.loadGameSetting(Controller.java:716) at Main.main(Main.java:8) Caused by: java.lang.IllegalArgumentException: w and h must be > 0 at java.desktop/java.awt.image.Raster.createInterleavedRaster(Raster.java:214) at java.desktop/java.awt.image.ComponentColorModel.createCompatibleWritableRaster(ComponentColorModel.java:2809) at java.desktop/java.awt.image.BufferedImage.(BufferedImage.java:420) at view.MainMenuFrame.toGrayScale(MainMenuFrame.java:184) at view.MainMenuFrame.(MainMenuFrame.java:16) at view.MainMenuFrame.(MainMenuFrame.java:24) ... 2 more What should I do with this error?