Skip to content
/ sge-risk Public

🎲 A clone of the game "Risk" implemented in sge.

License

Notifications You must be signed in to change notification settings

Entze/sge-risk

Repository files navigation

SGE-Risk

GitHub Build Workflow Status GitHub Manual Workflow Status

Gradle 7.6 Java

SGE-Risk is a clone of the game "Risk" implemented in SGE.

This program consists of a map generator and a library for agents to play the game.

Installation

Library

Gradle

Jitpack (no GitHub Account required)

Add the following to your build.gradle:

repositories {
    maven { url 'https://jitpack.io' }
}

dependencies {
    implementation("com.github.Entze:sge-risk:v1.0.4")
}
GitHub Packages (GitHub Account required)

Add the following to your build.gradle:

repositories {
    maven {
        url = uri("https://maven.pkg.github.com/Entze/sge-risk")
        credentials {
            username = project.findProperty("gpr.user") ?: findProperty("github.actor") ?: System.getenv("GITHUB_ACTOR")
            password = project.findProperty("gpr.key") ?: findProperty("github.token") ?: System.getenv("GITHUB_TOKEN")
        }
    }
}

dependencies {
    implementation("at.ac.tuwien.ifs.sge:sge-risk:1.0.4")
}

This requires that either gpr.user or github.actor are set in the gradle config or the environment variable GITHUB_ACTOR is set (equivalently for the key/token).

Usually this can be done by adding a gradle.properties with the (unquoted) key value pairs like so:

github.actor=MyUserName
github.token=ghp_...

Maven

See the GitHub packages page for a guide how to add sge-risk as a dependency in a maven project.

From Source

./gradlew jar shadowJar sourcesJar javadocJar

This produces four jar files (in build/libs/):

One executable

  • sge-risk-1.0.4-exe.jar (Game-jar & Map Generator Executable)

And three jars usually used for development

  • sge-risk-1.0.4.jar (Library)
  • sge-risk-1.0.4-sources.jar (Sources)
  • sge-risk-1.0.4-javadoc.jar (Documentation)

Map Generator

Prebuilt Jar

Download the prebuilt jar from the GitHub Releases page. The jar is standalone and therefore it does not need to be installed.

From Source

See Installation>Library>From Source.

Usage

Library

The javadoc provides documentation for all public methods. Otherwise, once the library is installed you should be able to use the Library via the API.

There are also a general agent-guide and a ruleset available.

Map Generator

The map generator compresses the whitespace in map strings.

To use:

java -jar sge-risk-1.0.4-exe.jar [MAPFILE] [TERRITORIESFILE]

The map file is an ascii image. Xs represent the position of the troop indicator. The territories file lists the names of the territories in order of their appearance in the map file (using the X as marker, left to right, top to bottom).

The result is printed on stdout.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

AGPL-3.0