Merge commit '81625e0c38e2d926cc2bc04cc8e317317cfa47e6' as 'H01'
This commit is contained in:
commit
3e57aee598
30 changed files with 1643 additions and 0 deletions
12
H01/.editorconfig
Normal file
12
H01/.editorconfig
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
# Editor configuration, see https://editorconfig.org
|
||||||
|
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
end_of_line = lf
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 4
|
||||||
|
insert_final_newline = true
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
|
||||||
|
[{*.yml,*.json}]
|
||||||
|
indent_size = 2
|
86
H01/.gitignore
vendored
Normal file
86
H01/.gitignore
vendored
Normal file
|
@ -0,0 +1,86 @@
|
||||||
|
### Intellij ###
|
||||||
|
.idea/
|
||||||
|
*.iws
|
||||||
|
/out/
|
||||||
|
*.iml
|
||||||
|
.idea_modules/
|
||||||
|
atlassian-ide-plugin.xml
|
||||||
|
|
||||||
|
### VS-Code ###
|
||||||
|
.vscode/
|
||||||
|
.VSCodeCounter/
|
||||||
|
|
||||||
|
### Eclipse ###
|
||||||
|
.metadata
|
||||||
|
bin/
|
||||||
|
tmp/
|
||||||
|
*.tmp
|
||||||
|
*.bak
|
||||||
|
*.swp
|
||||||
|
*~.nib
|
||||||
|
local.properties
|
||||||
|
.settings/
|
||||||
|
.loadpath
|
||||||
|
.recommenders
|
||||||
|
.externalToolBuilders/
|
||||||
|
*.launch
|
||||||
|
.factorypath
|
||||||
|
.recommenders/
|
||||||
|
.apt_generated/
|
||||||
|
.project
|
||||||
|
.classpath
|
||||||
|
|
||||||
|
### Linux ###
|
||||||
|
*~
|
||||||
|
.fuse_hidden*
|
||||||
|
.directory
|
||||||
|
.Trash-*
|
||||||
|
.nfs*
|
||||||
|
|
||||||
|
### macOS ###
|
||||||
|
.DS_Store
|
||||||
|
.AppleDouble
|
||||||
|
.LSOverride
|
||||||
|
Icon
|
||||||
|
._*
|
||||||
|
.DocumentRevisions-V100
|
||||||
|
.fseventsd
|
||||||
|
.Spotlight-V100
|
||||||
|
.TemporaryItems
|
||||||
|
.Trashes
|
||||||
|
.VolumeIcon.icns
|
||||||
|
.com.apple.timemachine.donotpresent
|
||||||
|
.AppleDB
|
||||||
|
.AppleDesktop
|
||||||
|
Network Trash Folder
|
||||||
|
Temporary Items
|
||||||
|
.apdisk
|
||||||
|
|
||||||
|
### NetBeans ###
|
||||||
|
nbproject/private/
|
||||||
|
build/
|
||||||
|
nbbuild/
|
||||||
|
dist/
|
||||||
|
nbdist/
|
||||||
|
.nb-gradle/
|
||||||
|
|
||||||
|
### Windows ###
|
||||||
|
# Windows thumbnail cache files
|
||||||
|
Thumbs.db
|
||||||
|
ehthumbs.db
|
||||||
|
ehthumbs_vista.db
|
||||||
|
*.stackdump
|
||||||
|
[Dd]esktop.ini
|
||||||
|
$RECYCLE.BIN/
|
||||||
|
*.lnk
|
||||||
|
|
||||||
|
### Gradle ###
|
||||||
|
.gradle
|
||||||
|
/build/
|
||||||
|
out/
|
||||||
|
gradle-app.setting
|
||||||
|
!gradle-wrapper.jar
|
||||||
|
.gradletasknamecache
|
||||||
|
|
||||||
|
*.hprof
|
||||||
|
jagr.conf
|
4
H01/README.md
Normal file
4
H01/README.md
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
# Vorlage zu Hausübung 01
|
||||||
|
|
||||||
|
Beachten Sie die Hinweise zum Herunterladen, Importieren, Bearbeitern, Exportieren und Hochladen in unserem
|
||||||
|
[Studierenden-Guide](https://wiki.tudalgo.org/)
|
37
H01/build.gradle.kts
Normal file
37
H01/build.gradle.kts
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
import org.sourcegrade.jagr.gradle.task.grader.GraderRunTask
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
alias(libs.plugins.algomate)
|
||||||
|
}
|
||||||
|
|
||||||
|
exercise {
|
||||||
|
assignmentId.set("h01")
|
||||||
|
}
|
||||||
|
|
||||||
|
submission {
|
||||||
|
// ACHTUNG!
|
||||||
|
// Setzen Sie im folgenden Bereich Ihre TU-ID (NICHT Ihre Matrikelnummer!), Ihren Nachnamen und Ihren Vornamen
|
||||||
|
// in Anführungszeichen (z.B. "ab12cdef" für Ihre TU-ID) ein!
|
||||||
|
// BEISPIEL:
|
||||||
|
// studentId = "ab12cdef"
|
||||||
|
// firstName = "sol_first"
|
||||||
|
// lastName = "sol_last"
|
||||||
|
studentId = ""
|
||||||
|
firstName = ""
|
||||||
|
lastName = ""
|
||||||
|
|
||||||
|
// Optionally require own tests for mainBuildSubmission task. Default is false
|
||||||
|
requireTests = false
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation(libs.fopbot)
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks {
|
||||||
|
withType<GraderRunTask> {
|
||||||
|
doFirst {
|
||||||
|
throw GradleException("No public tests are provided for this exercise! For more information go to https://moodle.informatik.tu-darmstadt.de/mod/page/view.php?id=68766")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
6
H01/gradle/libs.versions.toml
Normal file
6
H01/gradle/libs.versions.toml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
[plugins]
|
||||||
|
algomate = { id = "org.tudalgo.algomate", version = "0.7.1" }
|
||||||
|
style = { id = "org.sourcegrade.style", version = "3.0.0" }
|
||||||
|
|
||||||
|
[libraries]
|
||||||
|
fopbot = { module = "org.tudalgo:fopbot", version = "0.8.1" }
|
BIN
H01/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
H01/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
7
H01/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
7
H01/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip
|
||||||
|
networkTimeout=10000
|
||||||
|
validateDistributionUrl=true
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
249
H01/gradlew
vendored
Executable file
249
H01/gradlew
vendored
Executable file
|
@ -0,0 +1,249 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright © 2015-2021 the original authors.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# Gradle start up script for POSIX generated by Gradle.
|
||||||
|
#
|
||||||
|
# Important for running:
|
||||||
|
#
|
||||||
|
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||||
|
# noncompliant, but you have some other compliant shell such as ksh or
|
||||||
|
# bash, then to run this script, type that shell name before the whole
|
||||||
|
# command line, like:
|
||||||
|
#
|
||||||
|
# ksh Gradle
|
||||||
|
#
|
||||||
|
# Busybox and similar reduced shells will NOT work, because this script
|
||||||
|
# requires all of these POSIX shell features:
|
||||||
|
# * functions;
|
||||||
|
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||||
|
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||||
|
# * compound commands having a testable exit status, especially «case»;
|
||||||
|
# * various built-in commands including «command», «set», and «ulimit».
|
||||||
|
#
|
||||||
|
# Important for patching:
|
||||||
|
#
|
||||||
|
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||||
|
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||||
|
#
|
||||||
|
# The "traditional" practice of packing multiple parameters into a
|
||||||
|
# space-separated string is a well documented source of bugs and security
|
||||||
|
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||||
|
# options in "$@", and eventually passing that to Java.
|
||||||
|
#
|
||||||
|
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||||
|
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||||
|
# see the in-line comments for details.
|
||||||
|
#
|
||||||
|
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||||
|
# Darwin, MinGW, and NonStop.
|
||||||
|
#
|
||||||
|
# (3) This script is generated from the Groovy template
|
||||||
|
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||||
|
# within the Gradle project.
|
||||||
|
#
|
||||||
|
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
# Attempt to set APP_HOME
|
||||||
|
|
||||||
|
# Resolve links: $0 may be a link
|
||||||
|
app_path=$0
|
||||||
|
|
||||||
|
# Need this for daisy-chained symlinks.
|
||||||
|
while
|
||||||
|
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||||
|
[ -h "$app_path" ]
|
||||||
|
do
|
||||||
|
ls=$( ls -ld "$app_path" )
|
||||||
|
link=${ls#*' -> '}
|
||||||
|
case $link in #(
|
||||||
|
/*) app_path=$link ;; #(
|
||||||
|
*) app_path=$APP_HOME$link ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# This is normally unused
|
||||||
|
# shellcheck disable=SC2034
|
||||||
|
APP_BASE_NAME=${0##*/}
|
||||||
|
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||||
|
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
||||||
|
|
||||||
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
|
MAX_FD=maximum
|
||||||
|
|
||||||
|
warn () {
|
||||||
|
echo "$*"
|
||||||
|
} >&2
|
||||||
|
|
||||||
|
die () {
|
||||||
|
echo
|
||||||
|
echo "$*"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
} >&2
|
||||||
|
|
||||||
|
# OS specific support (must be 'true' or 'false').
|
||||||
|
cygwin=false
|
||||||
|
msys=false
|
||||||
|
darwin=false
|
||||||
|
nonstop=false
|
||||||
|
case "$( uname )" in #(
|
||||||
|
CYGWIN* ) cygwin=true ;; #(
|
||||||
|
Darwin* ) darwin=true ;; #(
|
||||||
|
MSYS* | MINGW* ) msys=true ;; #(
|
||||||
|
NONSTOP* ) nonstop=true ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
|
# Determine the Java command to use to start the JVM.
|
||||||
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
|
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||||
|
else
|
||||||
|
JAVACMD=$JAVA_HOME/bin/java
|
||||||
|
fi
|
||||||
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
JAVACMD=java
|
||||||
|
if ! command -v java >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Increase the maximum file descriptors if we can.
|
||||||
|
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||||
|
case $MAX_FD in #(
|
||||||
|
max*)
|
||||||
|
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||||
|
# shellcheck disable=SC2039,SC3045
|
||||||
|
MAX_FD=$( ulimit -H -n ) ||
|
||||||
|
warn "Could not query maximum file descriptor limit"
|
||||||
|
esac
|
||||||
|
case $MAX_FD in #(
|
||||||
|
'' | soft) :;; #(
|
||||||
|
*)
|
||||||
|
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||||
|
# shellcheck disable=SC2039,SC3045
|
||||||
|
ulimit -n "$MAX_FD" ||
|
||||||
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Collect all arguments for the java command, stacking in reverse order:
|
||||||
|
# * args from the command line
|
||||||
|
# * the main class name
|
||||||
|
# * -classpath
|
||||||
|
# * -D...appname settings
|
||||||
|
# * --module-path (only if needed)
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||||
|
|
||||||
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
|
if "$cygwin" || "$msys" ; then
|
||||||
|
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||||
|
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||||
|
|
||||||
|
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||||
|
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
for arg do
|
||||||
|
if
|
||||||
|
case $arg in #(
|
||||||
|
-*) false ;; # don't mess with options #(
|
||||||
|
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||||
|
[ -e "$t" ] ;; #(
|
||||||
|
*) false ;;
|
||||||
|
esac
|
||||||
|
then
|
||||||
|
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||||
|
fi
|
||||||
|
# Roll the args list around exactly as many times as the number of
|
||||||
|
# args, so each arg winds up back in the position where it started, but
|
||||||
|
# possibly modified.
|
||||||
|
#
|
||||||
|
# NB: a `for` loop captures its iteration list before it begins, so
|
||||||
|
# changing the positional parameters here affects neither the number of
|
||||||
|
# iterations, nor the values presented in `arg`.
|
||||||
|
shift # remove old arg
|
||||||
|
set -- "$@" "$arg" # push replacement arg
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
|
|
||||||
|
# Collect all arguments for the java command:
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||||
|
# and any embedded shellness will be escaped.
|
||||||
|
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||||
|
# treated as '${Hostname}' itself on the command line.
|
||||||
|
|
||||||
|
set -- \
|
||||||
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||||
|
-classpath "$CLASSPATH" \
|
||||||
|
org.gradle.wrapper.GradleWrapperMain \
|
||||||
|
"$@"
|
||||||
|
|
||||||
|
# Stop when "xargs" is not available.
|
||||||
|
if ! command -v xargs >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "xargs is not available"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Use "xargs" to parse quoted args.
|
||||||
|
#
|
||||||
|
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||||
|
#
|
||||||
|
# In Bash we could simply go:
|
||||||
|
#
|
||||||
|
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||||
|
# set -- "${ARGS[@]}" "$@"
|
||||||
|
#
|
||||||
|
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||||
|
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||||
|
# character that might be a shell metacharacter, then use eval to reverse
|
||||||
|
# that process (while maintaining the separation between arguments), and wrap
|
||||||
|
# the whole thing up as a single "set" statement.
|
||||||
|
#
|
||||||
|
# This will of course break if any of these variables contains a newline or
|
||||||
|
# an unmatched quote.
|
||||||
|
#
|
||||||
|
|
||||||
|
eval "set -- $(
|
||||||
|
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||||
|
xargs -n1 |
|
||||||
|
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||||
|
tr '\n' ' '
|
||||||
|
)" '"$@"'
|
||||||
|
|
||||||
|
exec "$JAVACMD" "$@"
|
92
H01/gradlew.bat
vendored
Normal file
92
H01/gradlew.bat
vendored
Normal file
|
@ -0,0 +1,92 @@
|
||||||
|
@rem
|
||||||
|
@rem Copyright 2015 the original author or authors.
|
||||||
|
@rem
|
||||||
|
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
@rem you may not use this file except in compliance with the License.
|
||||||
|
@rem You may obtain a copy of the License at
|
||||||
|
@rem
|
||||||
|
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
@rem
|
||||||
|
@rem Unless required by applicable law or agreed to in writing, software
|
||||||
|
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
@rem See the License for the specific language governing permissions and
|
||||||
|
@rem limitations under the License.
|
||||||
|
@rem
|
||||||
|
|
||||||
|
@if "%DEBUG%"=="" @echo off
|
||||||
|
@rem ##########################################################################
|
||||||
|
@rem
|
||||||
|
@rem Gradle startup script for Windows
|
||||||
|
@rem
|
||||||
|
@rem ##########################################################################
|
||||||
|
|
||||||
|
@rem Set local scope for the variables with windows NT shell
|
||||||
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
|
set DIRNAME=%~dp0
|
||||||
|
if "%DIRNAME%"=="" set DIRNAME=.
|
||||||
|
@rem This is normally unused
|
||||||
|
set APP_BASE_NAME=%~n0
|
||||||
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||||
|
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||||
|
|
||||||
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||||
|
|
||||||
|
@rem Find java.exe
|
||||||
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
|
set JAVA_EXE=java.exe
|
||||||
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
|
if %ERRORLEVEL% equ 0 goto execute
|
||||||
|
|
||||||
|
echo. 1>&2
|
||||||
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||||
|
echo. 1>&2
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||||
|
echo location of your Java installation. 1>&2
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:findJavaFromJavaHome
|
||||||
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
|
if exist "%JAVA_EXE%" goto execute
|
||||||
|
|
||||||
|
echo. 1>&2
|
||||||
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||||
|
echo. 1>&2
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||||
|
echo location of your Java installation. 1>&2
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:execute
|
||||||
|
@rem Setup the command line
|
||||||
|
|
||||||
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
|
@rem Execute Gradle
|
||||||
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||||
|
|
||||||
|
:end
|
||||||
|
@rem End local scope for the variables with windows NT shell
|
||||||
|
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||||
|
|
||||||
|
:fail
|
||||||
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
|
rem the _cmd.exe /c_ return code!
|
||||||
|
set EXIT_CODE=%ERRORLEVEL%
|
||||||
|
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||||
|
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||||
|
exit /b %EXIT_CODE%
|
||||||
|
|
||||||
|
:mainEnd
|
||||||
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
||||||
|
:omega
|
11
H01/settings.gradle.kts
Normal file
11
H01/settings.gradle.kts
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
dependencyResolutionManagement {
|
||||||
|
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
||||||
|
repositories {
|
||||||
|
// mavenLocal()
|
||||||
|
maven("https://s01.oss.sonatype.org/content/repositories/snapshots")
|
||||||
|
maven("https://jitpack.io")
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
rootProject.name = "H01-Student"
|
34
H01/src/main/java/h01/BlueGhost.java
Normal file
34
H01/src/main/java/h01/BlueGhost.java
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
package h01;
|
||||||
|
|
||||||
|
import org.tudalgo.algoutils.student.annotation.StudentImplementationRequired;
|
||||||
|
|
||||||
|
import fopbot.Robot;
|
||||||
|
import h01.template.Families;
|
||||||
|
import h01.template.Ghost;
|
||||||
|
import h01.template.TickBased;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The {@link BlueGhost} is a {@link Robot} that looks like a blue ghost.
|
||||||
|
* It tries to move in a circle.
|
||||||
|
*/
|
||||||
|
public class BlueGhost extends Robot implements Ghost, TickBased {
|
||||||
|
/**
|
||||||
|
* Creates a new {@link BlueGhost} at the given position.
|
||||||
|
*
|
||||||
|
* @param x the x-coordinate
|
||||||
|
* @param y the y-coordinate
|
||||||
|
*/
|
||||||
|
public BlueGhost(int x, int y) {
|
||||||
|
super(x, y, Families.GHOST_BLUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Turns the robot to the right and then moves in the first direction that is
|
||||||
|
* clear.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@StudentImplementationRequired("H2.1")
|
||||||
|
public void doMove() {
|
||||||
|
org.tudalgo.algoutils.student.Student.crash("H2.1 - Remove if implemented");
|
||||||
|
}
|
||||||
|
}
|
23
H01/src/main/java/h01/GameController.java
Normal file
23
H01/src/main/java/h01/GameController.java
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
package h01;
|
||||||
|
|
||||||
|
import h01.template.GameControllerTemplate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The {@link GameController} class is responsible for controlling the game.
|
||||||
|
*/
|
||||||
|
public class GameController extends GameControllerTemplate {
|
||||||
|
/**
|
||||||
|
* Creates a new {@link GameController} object and sets up the game.
|
||||||
|
*/
|
||||||
|
public GameController() {
|
||||||
|
setup();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the player has won the game.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean checkWinCondition() {
|
||||||
|
return pacman.getNumberOfCoins() == totalCoins;
|
||||||
|
}
|
||||||
|
}
|
16
H01/src/main/java/h01/Main.java
Normal file
16
H01/src/main/java/h01/Main.java
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
package h01;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Main entry point in executing the program.
|
||||||
|
*/
|
||||||
|
public class Main {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Main entry point in executing the program.
|
||||||
|
*
|
||||||
|
* @param args program arguments, currently ignored
|
||||||
|
*/
|
||||||
|
public static void main(String[] args) {
|
||||||
|
new GameController().startGame();
|
||||||
|
}
|
||||||
|
}
|
39
H01/src/main/java/h01/OrangeGhost.java
Normal file
39
H01/src/main/java/h01/OrangeGhost.java
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
package h01;
|
||||||
|
|
||||||
|
import org.tudalgo.algoutils.student.annotation.StudentImplementationRequired;
|
||||||
|
|
||||||
|
import fopbot.Robot;
|
||||||
|
import h01.template.Families;
|
||||||
|
import h01.template.Ghost;
|
||||||
|
import h01.template.TickBased;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@link OrangeGhost} is a {@link Robot} that looks like a orange ghost.
|
||||||
|
* It tries to move in a straight line and alternates between turning left and
|
||||||
|
* right.
|
||||||
|
*/
|
||||||
|
public class OrangeGhost extends Robot implements Ghost, TickBased {
|
||||||
|
/**
|
||||||
|
* Creates a new {@link OrangeGhost} at the given position.
|
||||||
|
*
|
||||||
|
* @param x the x-coordinate
|
||||||
|
* @param y the y-coordinate
|
||||||
|
*/
|
||||||
|
public OrangeGhost(int x, int y) {
|
||||||
|
super(x, y, Families.GHOST_ORANGE);
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean leftTurnNext = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Moves the robot in a straight line if possible.
|
||||||
|
* If the robot cannot move forward, it turns left or right until there is no
|
||||||
|
* wall in front.
|
||||||
|
* The robot alternates between turning left and right.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@StudentImplementationRequired("H2.3")
|
||||||
|
public void doMove() {
|
||||||
|
org.tudalgo.algoutils.student.Student.crash("H2.3 - Remove if implemented");
|
||||||
|
}
|
||||||
|
}
|
41
H01/src/main/java/h01/Pacman.java
Normal file
41
H01/src/main/java/h01/Pacman.java
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
package h01;
|
||||||
|
|
||||||
|
import org.tudalgo.algoutils.student.annotation.StudentImplementationRequired;
|
||||||
|
|
||||||
|
import fopbot.Direction;
|
||||||
|
import fopbot.Robot;
|
||||||
|
import h01.template.Controllable;
|
||||||
|
import h01.template.Families;
|
||||||
|
import h01.template.TickBased;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@link Pacman} is a {@link Robot} that can be controlled by the user and
|
||||||
|
* looks like Pacman.
|
||||||
|
* It can move in four directions and pick up coins.
|
||||||
|
*/
|
||||||
|
public class Pacman extends Robot implements Controllable, TickBased {
|
||||||
|
/**
|
||||||
|
* Creates a new {@link Pacman} at the given position.
|
||||||
|
*
|
||||||
|
* @param x the x-coordinate
|
||||||
|
* @param y the y-coordinate
|
||||||
|
*/
|
||||||
|
public Pacman(int x, int y) {
|
||||||
|
super(x, y, Families.PACMAN);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles the key input of the user.
|
||||||
|
* The keys 0, 1, 2, 3 represent the arrow keys up, right, down, left.
|
||||||
|
* If the key is not in this range, the method does nothing.
|
||||||
|
* If the key is in the range, the robot turns in the corresponding direction,
|
||||||
|
* moves one field and collects a coin if there is one.
|
||||||
|
*
|
||||||
|
* @param k the int value of the pressed key
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@StudentImplementationRequired("H1.1")
|
||||||
|
public void handleKeyInput(int k) {
|
||||||
|
org.tudalgo.algoutils.student.Student.crash("H1.1 - Remove if implemented");
|
||||||
|
}
|
||||||
|
}
|
36
H01/src/main/java/h01/PinkGhost.java
Normal file
36
H01/src/main/java/h01/PinkGhost.java
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
package h01;
|
||||||
|
|
||||||
|
import org.tudalgo.algoutils.student.annotation.StudentImplementationRequired;
|
||||||
|
|
||||||
|
import fopbot.Robot;
|
||||||
|
import h01.template.Families;
|
||||||
|
import h01.template.Ghost;
|
||||||
|
import h01.template.TickBased;
|
||||||
|
import h01.template.Util;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The {@link PinkGhost} is a {@link Robot} that looks like a pink ghost.
|
||||||
|
* It tries to move in a random direction.
|
||||||
|
*/
|
||||||
|
public class PinkGhost extends Robot implements Ghost, TickBased {
|
||||||
|
/**
|
||||||
|
* Creates a new {@link PinkGhost} at the given position.
|
||||||
|
*
|
||||||
|
* @param x the x-coordinate
|
||||||
|
* @param y the y-coordinate
|
||||||
|
*/
|
||||||
|
public PinkGhost(int x, int y) {
|
||||||
|
super(x, y, Families.GHOST_PINK);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds in how many directions the ghost can move and then turns a random
|
||||||
|
* amount of times to the left.
|
||||||
|
* The ghost then moves forward or turns to the left until it can move forward.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@StudentImplementationRequired("H2.2")
|
||||||
|
public void doMove() {
|
||||||
|
org.tudalgo.algoutils.student.Student.crash("H2.2 - Remove if implemented");
|
||||||
|
}
|
||||||
|
}
|
39
H01/src/main/java/h01/RedGhost.java
Normal file
39
H01/src/main/java/h01/RedGhost.java
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
package h01;
|
||||||
|
|
||||||
|
import org.tudalgo.algoutils.student.annotation.StudentImplementationRequired;
|
||||||
|
|
||||||
|
import fopbot.Direction;
|
||||||
|
import fopbot.Robot;
|
||||||
|
import h01.template.Families;
|
||||||
|
import h01.template.Ghost;
|
||||||
|
import h01.template.TickBased;
|
||||||
|
import h01.template.Util;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The {@link RedGhost} is a {@link Robot} that looks like a red ghost.
|
||||||
|
* It tries to move in the direction of the chased robot.
|
||||||
|
*/
|
||||||
|
public class RedGhost extends Robot implements Ghost, TickBased {
|
||||||
|
private final Robot chased;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new {@link RedGhost} at the given position.
|
||||||
|
*
|
||||||
|
* @param x the x-coordinate
|
||||||
|
* @param y the y-coordinate
|
||||||
|
* @param chased the robot that is being chased
|
||||||
|
*/
|
||||||
|
public RedGhost(int x, int y, Robot chased) {
|
||||||
|
super(x, y, Families.GHOST_RED);
|
||||||
|
this.chased = chased;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Moves the robot in the direction of the chased robot.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@StudentImplementationRequired("H2.4")
|
||||||
|
public void doMove() {
|
||||||
|
org.tudalgo.algoutils.student.Student.crash("H2.4 - Remove if implemented");
|
||||||
|
}
|
||||||
|
}
|
5
H01/src/main/java/h01/template/Controllable.java
Normal file
5
H01/src/main/java/h01/template/Controllable.java
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
package h01.template;
|
||||||
|
|
||||||
|
public interface Controllable {
|
||||||
|
void handleKeyInput(int k);
|
||||||
|
}
|
36
H01/src/main/java/h01/template/Families.java
Normal file
36
H01/src/main/java/h01/template/Families.java
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
package h01.template;
|
||||||
|
|
||||||
|
import fopbot.RobotFamily;
|
||||||
|
import fopbot.SvgBasedRobotFamily;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
|
|
||||||
|
public class Families {
|
||||||
|
public static RobotFamily GHOST_ORANGE = new SvgBasedRobotFamily(
|
||||||
|
"GHOST_ORANGE",
|
||||||
|
"/robots/ghost_orange.svg",
|
||||||
|
"/robots/ghost_orange.svg",
|
||||||
|
Color.ORANGE);
|
||||||
|
public static RobotFamily GHOST_BLUE = new SvgBasedRobotFamily(
|
||||||
|
"GHOST_BLUE",
|
||||||
|
"/robots/ghost_blue.svg",
|
||||||
|
"/robots/ghost_blue.svg",
|
||||||
|
Color.BLUE);
|
||||||
|
public static RobotFamily GHOST_RED = new SvgBasedRobotFamily(
|
||||||
|
"GHOST_RED",
|
||||||
|
"/robots/ghost_red.svg",
|
||||||
|
"/robots/ghost_red.svg",
|
||||||
|
Color.RED);
|
||||||
|
public static RobotFamily GHOST_PINK = new SvgBasedRobotFamily(
|
||||||
|
"GHOST_PINK",
|
||||||
|
"/robots/ghost_pink.svg",
|
||||||
|
"/robots/ghost_pink.svg",
|
||||||
|
Color.PINK);
|
||||||
|
public static RobotFamily PACMAN = new SvgBasedRobotFamily(
|
||||||
|
"PACMAN",
|
||||||
|
"/robots/pacman.svg",
|
||||||
|
"/robots/pacman.svg",
|
||||||
|
Color.YELLOW,
|
||||||
|
270,
|
||||||
|
270);
|
||||||
|
}
|
378
H01/src/main/java/h01/template/GameControllerTemplate.java
Normal file
378
H01/src/main/java/h01/template/GameControllerTemplate.java
Normal file
|
@ -0,0 +1,378 @@
|
||||||
|
package h01.template;
|
||||||
|
|
||||||
|
import java.awt.Color;
|
||||||
|
import java.awt.Graphics;
|
||||||
|
import java.awt.Graphics2D;
|
||||||
|
import java.awt.Point;
|
||||||
|
import java.awt.geom.Ellipse2D;
|
||||||
|
import java.awt.geom.Rectangle2D;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Timer;
|
||||||
|
import java.util.TimerTask;
|
||||||
|
|
||||||
|
import fopbot.Coin;
|
||||||
|
import fopbot.ColorProfile;
|
||||||
|
import fopbot.GuiPanel;
|
||||||
|
import fopbot.PaintUtils;
|
||||||
|
import fopbot.Robot;
|
||||||
|
import fopbot.World;
|
||||||
|
import h01.BlueGhost;
|
||||||
|
import h01.OrangeGhost;
|
||||||
|
import h01.Pacman;
|
||||||
|
import h01.PinkGhost;
|
||||||
|
import h01.RedGhost;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A {@link GameControllerTemplate} controls the game loop and the
|
||||||
|
* {@link Robot}s and checks the win condition.
|
||||||
|
*/
|
||||||
|
public abstract class GameControllerTemplate {
|
||||||
|
/**
|
||||||
|
* The {@link Timer} that controls the game loop.
|
||||||
|
*/
|
||||||
|
private final Timer gameLoopTimer = new Timer();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The {@link GameInputHandler} that handles the input of the user.
|
||||||
|
*/
|
||||||
|
private final GameInputHandler inputHandler = new GameInputHandler();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The total umber of coins in the map.
|
||||||
|
*/
|
||||||
|
protected int totalCoins;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The {@link Robot}s that are controlled by the {@link GameControllerTemplate}.
|
||||||
|
*/
|
||||||
|
protected final ArrayList<Robot> robots = new ArrayList<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The {@link Pacman} {@link Robot}.
|
||||||
|
*/
|
||||||
|
protected Robot pacman;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The {@link BlueGhost} {@link Robot}.
|
||||||
|
*/
|
||||||
|
protected Robot blue;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The {@link OrangeGhost} {@link Robot}.
|
||||||
|
*/
|
||||||
|
protected Robot orange;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The {@link PinkGhost} {@link Robot}.
|
||||||
|
*/
|
||||||
|
protected Robot pink;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The {@link RedGhost} {@link Robot}.
|
||||||
|
*/
|
||||||
|
protected Robot red;
|
||||||
|
|
||||||
|
private Point ghostField = new Point(4, 4);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A {@link Map} that maps a {@link Robot} to the amount of ticks that have
|
||||||
|
* passed since the last tick action.
|
||||||
|
*/
|
||||||
|
private final Map<Robot, Integer> robotTicks = new HashMap<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The {@link TimerTask} that is executed every tick.
|
||||||
|
*/
|
||||||
|
private final TimerTask gameLoopTask = new TimerTask() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
for (final Robot robot : GameControllerTemplate.this.robots) {
|
||||||
|
if (!(robot instanceof final TickBased tb)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!GameControllerTemplate.this.robotTicks.containsKey(robot)) {
|
||||||
|
GameControllerTemplate.this.robotTicks.put(robot, 0);
|
||||||
|
}
|
||||||
|
if (GameControllerTemplate.this.robotTicks.get(robot) < tb.getUpdateDelay()) {
|
||||||
|
GameControllerTemplate.this.robotTicks.put(robot,
|
||||||
|
GameControllerTemplate.this.robotTicks.get(robot) + 1);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
GameControllerTemplate.this.robotTicks.put(robot, 0);
|
||||||
|
// do tick action
|
||||||
|
if (robot instanceof final Pacman r) {
|
||||||
|
r.handleKeyInput(
|
||||||
|
GameControllerTemplate.this.inputHandler.getDirection());
|
||||||
|
} else if (robot instanceof final Ghost r) {
|
||||||
|
r.doMove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// check win condition
|
||||||
|
if (checkWinCondition())
|
||||||
|
stopGame(true);
|
||||||
|
if (checkLoseCondition())
|
||||||
|
stopGame(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the {@link Pacman} {@link Robot}.
|
||||||
|
*
|
||||||
|
* @return the {@link Pacman} {@link Robot}
|
||||||
|
*/
|
||||||
|
public Robot getPacman() {
|
||||||
|
return pacman;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the {@link BlueGhost} {@link Robot}.
|
||||||
|
*
|
||||||
|
* @return the {@link BlueGhost} {@link Robot}
|
||||||
|
*/
|
||||||
|
public Robot getBlue() {
|
||||||
|
return blue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the {@link OrangeGhost} {@link Robot}.
|
||||||
|
*
|
||||||
|
* @return the {@link OrangeGhost} {@link Robot}
|
||||||
|
*/
|
||||||
|
public Robot getOrange() {
|
||||||
|
return orange;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the {@link PinkGhost} {@link Robot}.
|
||||||
|
*
|
||||||
|
* @return the {@link PinkGhost} {@link Robot}
|
||||||
|
*/
|
||||||
|
public Robot getPink() {
|
||||||
|
return pink;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the {@link RedGhost} {@link Robot}.
|
||||||
|
*
|
||||||
|
* @return the {@link RedGhost} {@link Robot}
|
||||||
|
*/
|
||||||
|
public Robot getRed() {
|
||||||
|
return red;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Starts the game loop.
|
||||||
|
*/
|
||||||
|
public void startGame() {
|
||||||
|
System.out.println("Starting game...");
|
||||||
|
this.gameLoopTimer.scheduleAtFixedRate(this.gameLoopTask, 0, 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stops the game loop.
|
||||||
|
*/
|
||||||
|
public void stopGame(boolean won) {
|
||||||
|
this.gameLoopTimer.cancel();
|
||||||
|
endscreen(won ? Color.GREEN : Color.RED);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void endscreen(Color color) {
|
||||||
|
World.getGlobalWorld().getGuiPanel().setColorProfile(
|
||||||
|
ColorProfile.DEFAULT.toBuilder()
|
||||||
|
.backgroundColorDark(Color.BLACK)
|
||||||
|
.backgroundColorLight(Color.BLACK)
|
||||||
|
.fieldColorDark(color)
|
||||||
|
.fieldColorLight(color)
|
||||||
|
.innerBorderColorLight(color)
|
||||||
|
.innerBorderColorDark(color)
|
||||||
|
.wallColorDark(Color.BLUE)
|
||||||
|
.wallColorLight(Color.BLUE)
|
||||||
|
.outerBorderColorDark(Color.BLUE)
|
||||||
|
.outerBorderColorLight(Color.BLUE)
|
||||||
|
.coinColorDark(color)
|
||||||
|
.coinColorLight(color)
|
||||||
|
.build());
|
||||||
|
World.getGlobalWorld().getGuiPanel().updateGui();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets up the game.
|
||||||
|
*/
|
||||||
|
protected void setup() {
|
||||||
|
setupWorld();
|
||||||
|
setupTheme();
|
||||||
|
setupRobots();
|
||||||
|
totalCoins = 2;// World.getHeight()*World.getWidth()-2;
|
||||||
|
setupCoins(totalCoins);
|
||||||
|
this.inputHandler.install();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setupTheme() {
|
||||||
|
World.getGlobalWorld().getGuiPanel().setColorProfile(
|
||||||
|
ColorProfile.DEFAULT.toBuilder()
|
||||||
|
.backgroundColorDark(Color.BLACK)
|
||||||
|
.backgroundColorLight(Color.BLACK)
|
||||||
|
.fieldColorDark(Color.BLACK)
|
||||||
|
.fieldColorLight(Color.BLACK)
|
||||||
|
.innerBorderColorLight(Color.BLACK)
|
||||||
|
.innerBorderColorDark(Color.BLACK)
|
||||||
|
.wallColorDark(Color.BLUE)
|
||||||
|
.wallColorLight(Color.BLUE)
|
||||||
|
.outerBorderColorDark(Color.BLUE)
|
||||||
|
.outerBorderColorLight(Color.BLUE)
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes the {@link World} and adds the {@link Robot}s to it.
|
||||||
|
*/
|
||||||
|
public void setupWorld() {
|
||||||
|
World.setSize(9, 9);
|
||||||
|
|
||||||
|
World.getGlobalWorld().setGuiPanel(new GuiPanel(World.getGlobalWorld()) {
|
||||||
|
@Override
|
||||||
|
@SuppressWarnings("UnstableApiUsage")
|
||||||
|
protected void drawCoin(final Coin c, final Graphics g, final boolean evadeRobots) {
|
||||||
|
final var g2d = (Graphics2D) g;
|
||||||
|
final var oldColor = g2d.getColor();
|
||||||
|
g2d.setColor(getColorProfile().getCoinColor());
|
||||||
|
final Rectangle2D fieldBounds = scale(PaintUtils.getFieldBounds(c, world));
|
||||||
|
final double radius = scale(5d);
|
||||||
|
g2d.fill(
|
||||||
|
new Ellipse2D.Double(
|
||||||
|
fieldBounds.getCenterX() - radius,
|
||||||
|
fieldBounds.getCenterY() - radius,
|
||||||
|
2 * radius,
|
||||||
|
2 * radius));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
World.setDelay(0);
|
||||||
|
World.setVisible(true);
|
||||||
|
World.getGlobalWorld().setDrawTurnedOffRobots(false);
|
||||||
|
|
||||||
|
World.placeVerticalWall(0, 3);
|
||||||
|
World.placeVerticalWall(0, 4);
|
||||||
|
World.placeVerticalWall(0, 5);
|
||||||
|
|
||||||
|
World.placeVerticalWall(1, 2);
|
||||||
|
World.placeVerticalWall(1, 4);
|
||||||
|
World.placeVerticalWall(1, 6);
|
||||||
|
|
||||||
|
World.placeVerticalWall(2, 2);
|
||||||
|
World.placeVerticalWall(2, 3);
|
||||||
|
World.placeVerticalWall(2, 5);
|
||||||
|
World.placeVerticalWall(2, 6);
|
||||||
|
|
||||||
|
World.placeVerticalWall(3, 4);
|
||||||
|
World.placeVerticalWall(3, 7);
|
||||||
|
|
||||||
|
World.placeVerticalWall(4, 4);
|
||||||
|
World.placeVerticalWall(4, 1);
|
||||||
|
|
||||||
|
World.placeVerticalWall(5, 2);
|
||||||
|
World.placeVerticalWall(5, 3);
|
||||||
|
World.placeVerticalWall(5, 5);
|
||||||
|
World.placeVerticalWall(5, 6);
|
||||||
|
|
||||||
|
World.placeVerticalWall(6, 2);
|
||||||
|
World.placeVerticalWall(6, 4);
|
||||||
|
World.placeVerticalWall(6, 6);
|
||||||
|
|
||||||
|
World.placeVerticalWall(7, 3);
|
||||||
|
World.placeVerticalWall(7, 4);
|
||||||
|
World.placeVerticalWall(7, 5);
|
||||||
|
|
||||||
|
World.placeHorizontalWall(1, 0);
|
||||||
|
World.placeHorizontalWall(1, 1);
|
||||||
|
World.placeHorizontalWall(1, 6);
|
||||||
|
World.placeHorizontalWall(1, 7);
|
||||||
|
|
||||||
|
World.placeHorizontalWall(2, 0);
|
||||||
|
World.placeHorizontalWall(2, 7);
|
||||||
|
|
||||||
|
World.placeHorizontalWall(3, 0);
|
||||||
|
World.placeHorizontalWall(3, 2);
|
||||||
|
World.placeHorizontalWall(3, 5);
|
||||||
|
|
||||||
|
World.placeHorizontalWall(4, 1);
|
||||||
|
World.placeHorizontalWall(4, 3);
|
||||||
|
World.placeHorizontalWall(4, 6);
|
||||||
|
|
||||||
|
World.placeHorizontalWall(5, 2);
|
||||||
|
World.placeHorizontalWall(5, 5);
|
||||||
|
World.placeHorizontalWall(5, 7);
|
||||||
|
|
||||||
|
World.placeHorizontalWall(6, 0);
|
||||||
|
World.placeHorizontalWall(6, 7);
|
||||||
|
|
||||||
|
World.placeHorizontalWall(7, 0);
|
||||||
|
World.placeHorizontalWall(7, 1);
|
||||||
|
World.placeHorizontalWall(7, 6);
|
||||||
|
World.placeHorizontalWall(7, 7);
|
||||||
|
|
||||||
|
World.getGlobalWorld().setFieldColor(ghostField.x, ghostField.y, Color.YELLOW);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the {@link Robot}s to the {@link World}.
|
||||||
|
*/
|
||||||
|
public void setupRobots() {
|
||||||
|
this.robots.add(pacman = new Pacman(4, 3));
|
||||||
|
this.robots.add(blue = new BlueGhost(ghostField.x, ghostField.y));
|
||||||
|
this.robots.add(orange = new OrangeGhost(ghostField.x, ghostField.y));
|
||||||
|
this.robots.add(pink = new PinkGhost(ghostField.x, ghostField.y));
|
||||||
|
this.robots.add(red = new RedGhost(ghostField.x, ghostField.y, pacman));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setupCoins(int numberOfCoins) {
|
||||||
|
if (numberOfCoins > World.getHeight() * World.getWidth() - 2) {
|
||||||
|
throw new IllegalArgumentException("Too many coins for this world size.");
|
||||||
|
}
|
||||||
|
|
||||||
|
ArrayList<Point> Fields = new ArrayList<>();
|
||||||
|
for (int y = 0; y < World.getHeight(); y++) {
|
||||||
|
for (int x = 0; x < World.getWidth(); x++) {
|
||||||
|
if (!((x == ghostField.x && y == ghostField.y) || x == pacman.getX() && y == pacman.getY()))
|
||||||
|
Fields.add(new Point(x, y));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < numberOfCoins; i++) {
|
||||||
|
int randomIndex = (int) (Math.random() * Fields.size());
|
||||||
|
Point spot = Fields.remove(randomIndex);
|
||||||
|
World.putCoins(spot.x, spot.y, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks the win condition.
|
||||||
|
*
|
||||||
|
* @return Returns true if the game is won.
|
||||||
|
*/
|
||||||
|
public abstract boolean checkWinCondition();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks the lose condition.
|
||||||
|
*
|
||||||
|
* @return Returns true if the game is lost.
|
||||||
|
*/
|
||||||
|
public boolean checkLoseCondition() {
|
||||||
|
boolean gameDone = pacman.getX() == orange.getX() && pacman.getY() == orange.getY();
|
||||||
|
|
||||||
|
if (pacman.getX() == blue.getX() && pacman.getY() == blue.getY()) {
|
||||||
|
gameDone = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pacman.getX() == pink.getX() && pacman.getY() == pink.getY()) {
|
||||||
|
gameDone = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pacman.getX() == red.getX() && pacman.getY() == red.getY()) {
|
||||||
|
gameDone = true;
|
||||||
|
}
|
||||||
|
return gameDone;
|
||||||
|
}
|
||||||
|
}
|
108
H01/src/main/java/h01/template/GameInputHandler.java
Normal file
108
H01/src/main/java/h01/template/GameInputHandler.java
Normal file
|
@ -0,0 +1,108 @@
|
||||||
|
package h01.template;
|
||||||
|
|
||||||
|
import fopbot.Direction;
|
||||||
|
import fopbot.World;
|
||||||
|
|
||||||
|
import java.awt.event.KeyAdapter;
|
||||||
|
import java.awt.event.KeyEvent;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A {@link GameInputHandler} handles the input of the user.
|
||||||
|
*/
|
||||||
|
public class GameInputHandler {
|
||||||
|
/**
|
||||||
|
* The {@link Direction} to turn to. If {@code -1} the robot should not turn.
|
||||||
|
*/
|
||||||
|
private final AtomicInteger direction = new AtomicInteger(-1);
|
||||||
|
/**
|
||||||
|
* If {@code true} the robot should put a coin on the current field.
|
||||||
|
*/
|
||||||
|
private final AtomicBoolean shouldPutCoins = new AtomicBoolean(false);
|
||||||
|
/**
|
||||||
|
* If {@code true} the robot should pick a coin from the current field.
|
||||||
|
*/
|
||||||
|
private final AtomicBoolean shouldPickCoins = new AtomicBoolean(false);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parses the inputs to a direction.
|
||||||
|
*
|
||||||
|
* @param keysPressed the keys pressed
|
||||||
|
* @return the direction or null if no direction is pressed
|
||||||
|
*/
|
||||||
|
public static Direction getDirectionFromKeysPressed(final Set<Integer> keysPressed) {
|
||||||
|
final Map<Direction, List<Integer>> directionKeys = Map.of(
|
||||||
|
Direction.UP, List.of(KeyEvent.VK_UP, KeyEvent.VK_W),
|
||||||
|
Direction.LEFT, List.of(KeyEvent.VK_LEFT, KeyEvent.VK_A),
|
||||||
|
Direction.DOWN, List.of(KeyEvent.VK_DOWN, KeyEvent.VK_S),
|
||||||
|
Direction.RIGHT, List.of(KeyEvent.VK_RIGHT, KeyEvent.VK_D)
|
||||||
|
);
|
||||||
|
final Set<Direction> pressedDirections = new HashSet<>();
|
||||||
|
for (final Direction direction : directionKeys.keySet()) {
|
||||||
|
for (final Integer key : directionKeys.get(direction)) {
|
||||||
|
if (keysPressed.contains(key)) {
|
||||||
|
pressedDirections.add(direction);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (pressedDirections.size() == 1) {
|
||||||
|
return pressedDirections.iterator().next();
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Installs the {@link GameInputHandler} to the {@link World}.
|
||||||
|
*/
|
||||||
|
public void install() {
|
||||||
|
World.getGlobalWorld().getInputHandler().addKeyListener(new KeyAdapter() {
|
||||||
|
@Override
|
||||||
|
public void keyTyped(final KeyEvent e) {
|
||||||
|
updateKeysPressed();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void keyPressed(final KeyEvent e) {
|
||||||
|
updateKeysPressed();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void keyReleased(final KeyEvent e) {
|
||||||
|
updateKeysPressed();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the {@link #direction}, {@link #shouldPutCoins} and {@link #shouldPickCoins} based on the pressed keys.
|
||||||
|
*/
|
||||||
|
protected void updateKeysPressed() {
|
||||||
|
this.direction.set(
|
||||||
|
Optional.ofNullable(getDirectionFromKeysPressed(World.getGlobalWorld().getInputHandler().getKeysPressed()))
|
||||||
|
.map(Enum::ordinal)
|
||||||
|
.orElse(-1)
|
||||||
|
);
|
||||||
|
this.shouldPickCoins.set(
|
||||||
|
World.getGlobalWorld().getInputHandler().getKeysPressed().contains(KeyEvent.VK_SPACE)
|
||||||
|
);
|
||||||
|
this.shouldPutCoins.set(
|
||||||
|
World.getGlobalWorld().getInputHandler().getKeysPressed().contains(KeyEvent.VK_R)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the current {@link Direction} to turn to. If {@code -1} the robot should not turn.
|
||||||
|
*
|
||||||
|
* @return the current {@link Direction} to turn to. If {@code -1} the robot should not turn.
|
||||||
|
*/
|
||||||
|
public int getDirection() {
|
||||||
|
return this.direction.get();
|
||||||
|
}
|
||||||
|
}
|
5
H01/src/main/java/h01/template/Ghost.java
Normal file
5
H01/src/main/java/h01/template/Ghost.java
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
package h01.template;
|
||||||
|
|
||||||
|
public interface Ghost {
|
||||||
|
void doMove();
|
||||||
|
}
|
15
H01/src/main/java/h01/template/TickBased.java
Normal file
15
H01/src/main/java/h01/template/TickBased.java
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
package h01.template;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An interface that enables an object to be updated every n-th tick.
|
||||||
|
*/
|
||||||
|
public interface TickBased {
|
||||||
|
/**
|
||||||
|
* Returns the number of ticks between two updates.
|
||||||
|
*
|
||||||
|
* @return the number of ticks between two updates
|
||||||
|
*/
|
||||||
|
default int getUpdateDelay() {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
55
H01/src/main/java/h01/template/Util.java
Normal file
55
H01/src/main/java/h01/template/Util.java
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
package h01.template;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import fopbot.Direction;
|
||||||
|
import fopbot.Robot;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Utility class for the ghosts
|
||||||
|
*/
|
||||||
|
public class Util {
|
||||||
|
|
||||||
|
private static Random rnd = new Random();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a random integer between min and max (both inclusive)
|
||||||
|
*
|
||||||
|
* @param min the minimum value
|
||||||
|
* @param max the maximum value
|
||||||
|
* @return a random integer between min and max (both inclusive)
|
||||||
|
*/
|
||||||
|
public static int getRandomInteger(int min, int max) {
|
||||||
|
return min + rnd.nextInt(max - min + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the direction in which the robot is the closest to the chaser
|
||||||
|
*
|
||||||
|
* @param pacman the robot that is being chased
|
||||||
|
* @param chaser the robot that is chasing
|
||||||
|
* @return the direction in which the robot is the closest to the chaser
|
||||||
|
*/
|
||||||
|
public static Direction furthestDirection(Robot pacman, Robot chaser) {
|
||||||
|
int px = pacman.getX();
|
||||||
|
int py = pacman.getY();
|
||||||
|
int cx = chaser.getX();
|
||||||
|
int cy = chaser.getY();
|
||||||
|
|
||||||
|
int xdelta = Math.abs(px - cx);
|
||||||
|
int ydelta = Math.abs(py - cy);
|
||||||
|
|
||||||
|
if (xdelta > ydelta) {
|
||||||
|
if (cx > px)
|
||||||
|
return Direction.LEFT;
|
||||||
|
else
|
||||||
|
return Direction.RIGHT;
|
||||||
|
} else {
|
||||||
|
if (cy > py)
|
||||||
|
return Direction.DOWN;
|
||||||
|
else
|
||||||
|
return Direction.UP;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
67
H01/src/main/resources/robots/ghost_blue.svg
Normal file
67
H01/src/main/resources/robots/ghost_blue.svg
Normal file
|
@ -0,0 +1,67 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
height="800px"
|
||||||
|
width="800px"
|
||||||
|
version="1.1"
|
||||||
|
id="Layer_1"
|
||||||
|
viewBox="0 0 512.001 512.001"
|
||||||
|
xml:space="preserve"
|
||||||
|
sodipodi:docname="ghost_blue.svg"
|
||||||
|
inkscape:version="1.3.2 (091e20e, 2023-11-25, custom)"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"><defs
|
||||||
|
id="defs8" /><sodipodi:namedview
|
||||||
|
id="namedview8"
|
||||||
|
pagecolor="#505050"
|
||||||
|
bordercolor="#eeeeee"
|
||||||
|
borderopacity="1"
|
||||||
|
inkscape:showpageshadow="0"
|
||||||
|
inkscape:pageopacity="0"
|
||||||
|
inkscape:pagecheckerboard="0"
|
||||||
|
inkscape:deskcolor="#d1d1d1"
|
||||||
|
inkscape:zoom="1.49875"
|
||||||
|
inkscape:cx="399.33278"
|
||||||
|
inkscape:cy="400"
|
||||||
|
inkscape:window-width="2560"
|
||||||
|
inkscape:window-height="1377"
|
||||||
|
inkscape:window-x="-8"
|
||||||
|
inkscape:window-y="-8"
|
||||||
|
inkscape:window-maximized="1"
|
||||||
|
inkscape:current-layer="Layer_1" />
|
||||||
|
<path
|
||||||
|
style="fill:#555bff;fill-opacity:1"
|
||||||
|
d="M248.399,0.135C135.421,4.152,47.514,100.436,47.514,213.484V508.8c0,2.792,3.432,4.127,5.319,2.069 l57.191-62.39c3.756-4.098,10.216-4.098,13.971,0l55.336,60.365c3.858,4.209,10.493,4.209,14.35,0l55.334-60.365 c3.756-4.098,10.216-4.098,13.971,0l55.334,60.365c3.858,4.209,10.493,4.209,14.35,0l55.336-60.365 c3.756-4.098,10.216-4.098,13.971,0l57.191,62.39c1.887,2.059,5.319,0.724,5.319-2.069V208.486 C464.489,90.819,367.009-4.082,248.399,0.135z"
|
||||||
|
id="path1" />
|
||||||
|
<path
|
||||||
|
style="fill:#325ca9;fill-opacity:1"
|
||||||
|
d="M151.758,227.632c0-107.205,79.072-199.275,183.593-211.938 C308.687,4.707,279.273-0.963,248.399,0.135C135.421,4.152,47.514,100.436,47.514,213.484V508.8c0,2.792,3.432,4.127,5.319,2.069 l57.191-62.39c3.755-4.098,10.216-4.098,13.971,0l27.762,30.285V227.632H151.758z"
|
||||||
|
id="path2" />
|
||||||
|
<path
|
||||||
|
style="fill:#FFFFFF;"
|
||||||
|
d="M186.385,303.255L186.385,303.255c-31.001,0-56.132-25.131-56.132-56.132v-20.412 c0-31.001,25.131-56.132,56.132-56.132l0,0c31.001,0,56.132,25.131,56.132,56.132v20.412 C242.515,278.124,217.385,303.255,186.385,303.255z"
|
||||||
|
id="path3" />
|
||||||
|
<path
|
||||||
|
style="fill:#E4EAF6;"
|
||||||
|
d="M217.002,293.049c-31.001,0-56.132-25.131-56.132-56.132v-20.412 c0-18.952,9.419-35.676,23.803-45.839c-30.201,0.912-54.421,25.621-54.421,56.045v20.412c0,31.001,25.131,56.132,56.132,56.132 c12.048,0,23.184-3.831,32.327-10.292C218.139,292.98,217.579,293.049,217.002,293.049z"
|
||||||
|
id="path4" />
|
||||||
|
<path
|
||||||
|
style="fill:#82B9FF;"
|
||||||
|
d="M201.693,262.431L201.693,262.431c-11.273,0-20.412-9.138-20.412-20.412v-10.205 c0-11.273,9.138-20.412,20.412-20.412l0,0c11.273,0,20.412,9.138,20.412,20.412v10.205 C222.105,253.294,212.966,262.431,201.693,262.431z"
|
||||||
|
id="path5" />
|
||||||
|
<path
|
||||||
|
style="fill:#FFFFFF;"
|
||||||
|
d="M325.619,303.255L325.619,303.255c-31.001,0-56.132-25.131-56.132-56.132v-20.412 c0-31.001,25.131-56.132,56.132-56.132l0,0c31.001,0,56.132,25.131,56.132,56.132v20.412 C381.75,278.124,356.619,303.255,325.619,303.255z"
|
||||||
|
id="path6" />
|
||||||
|
<path
|
||||||
|
style="fill:#E4EAF6;"
|
||||||
|
d="M356.236,293.049c-31.001,0-56.132-25.131-56.132-56.132v-20.412 c0-18.952,9.419-35.676,23.804-45.839c-30.201,0.912-54.421,25.621-54.421,56.045v20.412c0,31.001,25.131,56.132,56.132,56.132 c12.048,0,23.184-3.831,32.327-10.292C357.374,292.98,356.814,293.049,356.236,293.049z"
|
||||||
|
id="path7" />
|
||||||
|
<path
|
||||||
|
style="fill:#82B9FF;"
|
||||||
|
d="M340.927,262.431L340.927,262.431c-11.273,0-20.412-9.138-20.412-20.412v-10.205 c0-11.273,9.138-20.412,20.412-20.412l0,0c11.273,0,20.412,9.138,20.412,20.412v10.205 C361.339,253.294,352.201,262.431,340.927,262.431z"
|
||||||
|
id="path8" />
|
||||||
|
</svg>
|
After Width: | Height: | Size: 3.6 KiB |
31
H01/src/main/resources/robots/ghost_orange.svg
Normal file
31
H01/src/main/resources/robots/ghost_orange.svg
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||||
|
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
||||||
|
<svg height="800px" width="800px" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||||
|
viewBox="0 0 512.001 512.001" xml:space="preserve">
|
||||||
|
<path style="fill:#FFA05A;" d="M248.399,0.135C135.421,4.152,47.514,100.436,47.514,213.484V508.8c0,2.792,3.432,4.127,5.319,2.069
|
||||||
|
l57.191-62.39c3.756-4.098,10.216-4.098,13.971,0l55.336,60.365c3.858,4.209,10.493,4.209,14.35,0l55.334-60.365
|
||||||
|
c3.756-4.098,10.216-4.098,13.971,0l55.334,60.365c3.858,4.209,10.493,4.209,14.35,0l55.336-60.365
|
||||||
|
c3.756-4.098,10.216-4.098,13.971,0l57.191,62.39c1.887,2.059,5.319,0.724,5.319-2.069V208.486
|
||||||
|
C464.489,90.819,367.009-4.082,248.399,0.135z"/>
|
||||||
|
<path style="fill:#F08C46;" d="M151.758,227.632c0-107.205,79.072-199.275,183.593-211.938
|
||||||
|
C308.687,4.707,279.273-0.963,248.399,0.135C135.421,4.152,47.514,100.436,47.514,213.484V508.8c0,2.792,3.432,4.127,5.319,2.069
|
||||||
|
l57.191-62.39c3.755-4.098,10.216-4.098,13.971,0l27.762,30.285V227.632H151.758z"/>
|
||||||
|
<path style="fill:#FFFFFF;" d="M186.385,303.255L186.385,303.255c-31.001,0-56.132-25.131-56.132-56.132v-20.412
|
||||||
|
c0-31.001,25.131-56.132,56.132-56.132l0,0c31.001,0,56.132,25.131,56.132,56.132v20.412
|
||||||
|
C242.515,278.124,217.385,303.255,186.385,303.255z"/>
|
||||||
|
<path style="fill:#E4EAF6;" d="M217.002,293.049c-31.001,0-56.132-25.131-56.132-56.132v-20.412
|
||||||
|
c0-18.952,9.419-35.676,23.803-45.839c-30.201,0.912-54.421,25.621-54.421,56.045v20.412c0,31.001,25.131,56.132,56.132,56.132
|
||||||
|
c12.048,0,23.184-3.831,32.327-10.292C218.139,292.98,217.579,293.049,217.002,293.049z"/>
|
||||||
|
<path style="fill:#82B9FF;" d="M201.693,262.431L201.693,262.431c-11.273,0-20.412-9.138-20.412-20.412v-10.205
|
||||||
|
c0-11.273,9.138-20.412,20.412-20.412l0,0c11.273,0,20.412,9.138,20.412,20.412v10.205
|
||||||
|
C222.105,253.294,212.966,262.431,201.693,262.431z"/>
|
||||||
|
<path style="fill:#FFFFFF;" d="M325.619,303.255L325.619,303.255c-31.001,0-56.132-25.131-56.132-56.132v-20.412
|
||||||
|
c0-31.001,25.131-56.132,56.132-56.132l0,0c31.001,0,56.132,25.131,56.132,56.132v20.412
|
||||||
|
C381.75,278.124,356.619,303.255,325.619,303.255z"/>
|
||||||
|
<path style="fill:#E4EAF6;" d="M356.236,293.049c-31.001,0-56.132-25.131-56.132-56.132v-20.412
|
||||||
|
c0-18.952,9.419-35.676,23.804-45.839c-30.201,0.912-54.421,25.621-54.421,56.045v20.412c0,31.001,25.131,56.132,56.132,56.132
|
||||||
|
c12.048,0,23.184-3.831,32.327-10.292C357.374,292.98,356.814,293.049,356.236,293.049z"/>
|
||||||
|
<path style="fill:#82B9FF;" d="M340.927,262.431L340.927,262.431c-11.273,0-20.412-9.138-20.412-20.412v-10.205
|
||||||
|
c0-11.273,9.138-20.412,20.412-20.412l0,0c11.273,0,20.412,9.138,20.412,20.412v10.205
|
||||||
|
C361.339,253.294,352.201,262.431,340.927,262.431z"/>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 2.6 KiB |
67
H01/src/main/resources/robots/ghost_pink.svg
Normal file
67
H01/src/main/resources/robots/ghost_pink.svg
Normal file
|
@ -0,0 +1,67 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
height="800px"
|
||||||
|
width="800px"
|
||||||
|
version="1.1"
|
||||||
|
id="Layer_1"
|
||||||
|
viewBox="0 0 512.001 512.001"
|
||||||
|
xml:space="preserve"
|
||||||
|
sodipodi:docname="ghost_pink.svg"
|
||||||
|
inkscape:version="1.3.2 (091e20e, 2023-11-25, custom)"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"><defs
|
||||||
|
id="defs8" /><sodipodi:namedview
|
||||||
|
id="namedview8"
|
||||||
|
pagecolor="#505050"
|
||||||
|
bordercolor="#eeeeee"
|
||||||
|
borderopacity="1"
|
||||||
|
inkscape:showpageshadow="0"
|
||||||
|
inkscape:pageopacity="0"
|
||||||
|
inkscape:pagecheckerboard="0"
|
||||||
|
inkscape:deskcolor="#d1d1d1"
|
||||||
|
inkscape:zoom="1.49875"
|
||||||
|
inkscape:cx="399.33278"
|
||||||
|
inkscape:cy="400"
|
||||||
|
inkscape:window-width="2560"
|
||||||
|
inkscape:window-height="1377"
|
||||||
|
inkscape:window-x="-8"
|
||||||
|
inkscape:window-y="-8"
|
||||||
|
inkscape:window-maximized="1"
|
||||||
|
inkscape:current-layer="Layer_1" />
|
||||||
|
<path
|
||||||
|
style="fill:#e555ff;fill-opacity:1"
|
||||||
|
d="M248.399,0.135C135.421,4.152,47.514,100.436,47.514,213.484V508.8c0,2.792,3.432,4.127,5.319,2.069 l57.191-62.39c3.756-4.098,10.216-4.098,13.971,0l55.336,60.365c3.858,4.209,10.493,4.209,14.35,0l55.334-60.365 c3.756-4.098,10.216-4.098,13.971,0l55.334,60.365c3.858,4.209,10.493,4.209,14.35,0l55.336-60.365 c3.756-4.098,10.216-4.098,13.971,0l57.191,62.39c1.887,2.059,5.319,0.724,5.319-2.069V208.486 C464.489,90.819,367.009-4.082,248.399,0.135z"
|
||||||
|
id="path1" />
|
||||||
|
<path
|
||||||
|
style="fill:#c53bd0;fill-opacity:1"
|
||||||
|
d="M151.758,227.632c0-107.205,79.072-199.275,183.593-211.938 C308.687,4.707,279.273-0.963,248.399,0.135C135.421,4.152,47.514,100.436,47.514,213.484V508.8c0,2.792,3.432,4.127,5.319,2.069 l57.191-62.39c3.755-4.098,10.216-4.098,13.971,0l27.762,30.285V227.632H151.758z"
|
||||||
|
id="path2" />
|
||||||
|
<path
|
||||||
|
style="fill:#FFFFFF;"
|
||||||
|
d="M186.385,303.255L186.385,303.255c-31.001,0-56.132-25.131-56.132-56.132v-20.412 c0-31.001,25.131-56.132,56.132-56.132l0,0c31.001,0,56.132,25.131,56.132,56.132v20.412 C242.515,278.124,217.385,303.255,186.385,303.255z"
|
||||||
|
id="path3" />
|
||||||
|
<path
|
||||||
|
style="fill:#E4EAF6;"
|
||||||
|
d="M217.002,293.049c-31.001,0-56.132-25.131-56.132-56.132v-20.412 c0-18.952,9.419-35.676,23.803-45.839c-30.201,0.912-54.421,25.621-54.421,56.045v20.412c0,31.001,25.131,56.132,56.132,56.132 c12.048,0,23.184-3.831,32.327-10.292C218.139,292.98,217.579,293.049,217.002,293.049z"
|
||||||
|
id="path4" />
|
||||||
|
<path
|
||||||
|
style="fill:#82B9FF;"
|
||||||
|
d="M201.693,262.431L201.693,262.431c-11.273,0-20.412-9.138-20.412-20.412v-10.205 c0-11.273,9.138-20.412,20.412-20.412l0,0c11.273,0,20.412,9.138,20.412,20.412v10.205 C222.105,253.294,212.966,262.431,201.693,262.431z"
|
||||||
|
id="path5" />
|
||||||
|
<path
|
||||||
|
style="fill:#FFFFFF;"
|
||||||
|
d="M325.619,303.255L325.619,303.255c-31.001,0-56.132-25.131-56.132-56.132v-20.412 c0-31.001,25.131-56.132,56.132-56.132l0,0c31.001,0,56.132,25.131,56.132,56.132v20.412 C381.75,278.124,356.619,303.255,325.619,303.255z"
|
||||||
|
id="path6" />
|
||||||
|
<path
|
||||||
|
style="fill:#E4EAF6;"
|
||||||
|
d="M356.236,293.049c-31.001,0-56.132-25.131-56.132-56.132v-20.412 c0-18.952,9.419-35.676,23.804-45.839c-30.201,0.912-54.421,25.621-54.421,56.045v20.412c0,31.001,25.131,56.132,56.132,56.132 c12.048,0,23.184-3.831,32.327-10.292C357.374,292.98,356.814,293.049,356.236,293.049z"
|
||||||
|
id="path7" />
|
||||||
|
<path
|
||||||
|
style="fill:#82B9FF;"
|
||||||
|
d="M340.927,262.431L340.927,262.431c-11.273,0-20.412-9.138-20.412-20.412v-10.205 c0-11.273,9.138-20.412,20.412-20.412l0,0c11.273,0,20.412,9.138,20.412,20.412v10.205 C361.339,253.294,352.201,262.431,340.927,262.431z"
|
||||||
|
id="path8" />
|
||||||
|
</svg>
|
After Width: | Height: | Size: 3.6 KiB |
67
H01/src/main/resources/robots/ghost_red.svg
Normal file
67
H01/src/main/resources/robots/ghost_red.svg
Normal file
|
@ -0,0 +1,67 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
height="800px"
|
||||||
|
width="800px"
|
||||||
|
version="1.1"
|
||||||
|
id="Layer_1"
|
||||||
|
viewBox="0 0 512.001 512.001"
|
||||||
|
xml:space="preserve"
|
||||||
|
sodipodi:docname="ghost_red.svg"
|
||||||
|
inkscape:version="1.3.2 (091e20e, 2023-11-25, custom)"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"><defs
|
||||||
|
id="defs8" /><sodipodi:namedview
|
||||||
|
id="namedview8"
|
||||||
|
pagecolor="#505050"
|
||||||
|
bordercolor="#eeeeee"
|
||||||
|
borderopacity="1"
|
||||||
|
inkscape:showpageshadow="0"
|
||||||
|
inkscape:pageopacity="0"
|
||||||
|
inkscape:pagecheckerboard="0"
|
||||||
|
inkscape:deskcolor="#d1d1d1"
|
||||||
|
inkscape:zoom="1.49875"
|
||||||
|
inkscape:cx="399.33278"
|
||||||
|
inkscape:cy="400"
|
||||||
|
inkscape:window-width="2560"
|
||||||
|
inkscape:window-height="1377"
|
||||||
|
inkscape:window-x="-8"
|
||||||
|
inkscape:window-y="-8"
|
||||||
|
inkscape:window-maximized="1"
|
||||||
|
inkscape:current-layer="Layer_1" />
|
||||||
|
<path
|
||||||
|
style="fill:#ff4040;fill-opacity:1"
|
||||||
|
d="M248.399,0.135C135.421,4.152,47.514,100.436,47.514,213.484V508.8c0,2.792,3.432,4.127,5.319,2.069 l57.191-62.39c3.756-4.098,10.216-4.098,13.971,0l55.336,60.365c3.858,4.209,10.493,4.209,14.35,0l55.334-60.365 c3.756-4.098,10.216-4.098,13.971,0l55.334,60.365c3.858,4.209,10.493,4.209,14.35,0l55.336-60.365 c3.756-4.098,10.216-4.098,13.971,0l57.191,62.39c1.887,2.059,5.319,0.724,5.319-2.069V208.486 C464.489,90.819,367.009-4.082,248.399,0.135z"
|
||||||
|
id="path1" />
|
||||||
|
<path
|
||||||
|
style="fill:#d03b3b;fill-opacity:1"
|
||||||
|
d="M151.758,227.632c0-107.205,79.072-199.275,183.593-211.938 C308.687,4.707,279.273-0.963,248.399,0.135C135.421,4.152,47.514,100.436,47.514,213.484V508.8c0,2.792,3.432,4.127,5.319,2.069 l57.191-62.39c3.755-4.098,10.216-4.098,13.971,0l27.762,30.285V227.632H151.758z"
|
||||||
|
id="path2" />
|
||||||
|
<path
|
||||||
|
style="fill:#FFFFFF;"
|
||||||
|
d="M186.385,303.255L186.385,303.255c-31.001,0-56.132-25.131-56.132-56.132v-20.412 c0-31.001,25.131-56.132,56.132-56.132l0,0c31.001,0,56.132,25.131,56.132,56.132v20.412 C242.515,278.124,217.385,303.255,186.385,303.255z"
|
||||||
|
id="path3" />
|
||||||
|
<path
|
||||||
|
style="fill:#E4EAF6;"
|
||||||
|
d="M217.002,293.049c-31.001,0-56.132-25.131-56.132-56.132v-20.412 c0-18.952,9.419-35.676,23.803-45.839c-30.201,0.912-54.421,25.621-54.421,56.045v20.412c0,31.001,25.131,56.132,56.132,56.132 c12.048,0,23.184-3.831,32.327-10.292C218.139,292.98,217.579,293.049,217.002,293.049z"
|
||||||
|
id="path4" />
|
||||||
|
<path
|
||||||
|
style="fill:#82B9FF;"
|
||||||
|
d="M201.693,262.431L201.693,262.431c-11.273,0-20.412-9.138-20.412-20.412v-10.205 c0-11.273,9.138-20.412,20.412-20.412l0,0c11.273,0,20.412,9.138,20.412,20.412v10.205 C222.105,253.294,212.966,262.431,201.693,262.431z"
|
||||||
|
id="path5" />
|
||||||
|
<path
|
||||||
|
style="fill:#FFFFFF;"
|
||||||
|
d="M325.619,303.255L325.619,303.255c-31.001,0-56.132-25.131-56.132-56.132v-20.412 c0-31.001,25.131-56.132,56.132-56.132l0,0c31.001,0,56.132,25.131,56.132,56.132v20.412 C381.75,278.124,356.619,303.255,325.619,303.255z"
|
||||||
|
id="path6" />
|
||||||
|
<path
|
||||||
|
style="fill:#E4EAF6;"
|
||||||
|
d="M356.236,293.049c-31.001,0-56.132-25.131-56.132-56.132v-20.412 c0-18.952,9.419-35.676,23.804-45.839c-30.201,0.912-54.421,25.621-54.421,56.045v20.412c0,31.001,25.131,56.132,56.132,56.132 c12.048,0,23.184-3.831,32.327-10.292C357.374,292.98,356.814,293.049,356.236,293.049z"
|
||||||
|
id="path7" />
|
||||||
|
<path
|
||||||
|
style="fill:#82B9FF;"
|
||||||
|
d="M340.927,262.431L340.927,262.431c-11.273,0-20.412-9.138-20.412-20.412v-10.205 c0-11.273,9.138-20.412,20.412-20.412l0,0c11.273,0,20.412,9.138,20.412,20.412v10.205 C361.339,253.294,352.201,262.431,340.927,262.431z"
|
||||||
|
id="path8" />
|
||||||
|
</svg>
|
After Width: | Height: | Size: 3.6 KiB |
61
H01/src/main/resources/robots/pacman.svg
Normal file
61
H01/src/main/resources/robots/pacman.svg
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
height="800px"
|
||||||
|
width="800px"
|
||||||
|
version="1.1"
|
||||||
|
id="Layer_1"
|
||||||
|
viewBox="0 0 512 512"
|
||||||
|
xml:space="preserve"
|
||||||
|
sodipodi:docname="gamer-svgrepo-com.svg"
|
||||||
|
inkscape:version="1.3.2 (091e20e, 2023-11-25, custom)"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"><defs
|
||||||
|
id="defs6" /><sodipodi:namedview
|
||||||
|
id="namedview6"
|
||||||
|
pagecolor="#505050"
|
||||||
|
bordercolor="#eeeeee"
|
||||||
|
borderopacity="1"
|
||||||
|
inkscape:showpageshadow="0"
|
||||||
|
inkscape:pageopacity="0"
|
||||||
|
inkscape:pagecheckerboard="0"
|
||||||
|
inkscape:deskcolor="#d1d1d1"
|
||||||
|
inkscape:zoom="1.49875"
|
||||||
|
inkscape:cx="399.66639"
|
||||||
|
inkscape:cy="400"
|
||||||
|
inkscape:window-width="2560"
|
||||||
|
inkscape:window-height="1377"
|
||||||
|
inkscape:window-x="-8"
|
||||||
|
inkscape:window-y="-8"
|
||||||
|
inkscape:window-maximized="1"
|
||||||
|
inkscape:current-layer="Layer_1" />
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<g
|
||||||
|
id="g6"
|
||||||
|
transform="translate(83.607539,4.4703637e-4)"><path
|
||||||
|
style="fill:#ffd782"
|
||||||
|
d="m 209.638,244.628 129.736,-95.594 c 6.241,-4.599 7.204,-13.545 2.155,-19.428 C 301.171,82.587 238.774,55.049 170.311,63.221 81.862,73.778 10.999,145.353 1.223,233.893 c -12.937,117.155 78.443,216.313 192.983,216.313 58.996,0 111.782,-26.358 147.389,-67.889 5.021,-5.856 3.992,-14.775 -2.218,-19.35 L 209.638,267.37 c -7.661,-5.645 -7.661,-17.096 0,-22.742 z"
|
||||||
|
id="path1" /><path
|
||||||
|
style="fill:#ffc36e"
|
||||||
|
d="M 255.491,406.068 C 140.951,406.068 49.571,306.911 62.507,189.755 67.182,147.409 85.94,109.043 113.803,79.279 53.119,107.021 8.797,165.293 1.223,233.892 c -12.937,117.156 78.443,216.314 192.983,216.314 55.956,0 106.298,-23.738 141.721,-61.62 -24.506,11.197 -51.724,17.482 -80.436,17.482 z"
|
||||||
|
id="path2" /><circle
|
||||||
|
style="fill:#5b5d6e"
|
||||||
|
cx="220.689"
|
||||||
|
cy="150.06799"
|
||||||
|
r="26.483"
|
||||||
|
id="circle5" /><path
|
||||||
|
style="fill:#464655"
|
||||||
|
d="m 231.724,163.31 c -13.407,0 -24.276,-10.869 -24.276,-24.276 0,-5.134 1.614,-9.88 4.335,-13.802 -10.222,3.669 -17.577,13.351 -17.577,24.836 0,14.626 11.857,26.483 26.483,26.483 11.486,0 21.167,-7.354 24.836,-17.577 -3.921,2.72 -8.667,4.336 -13.801,4.336 z"
|
||||||
|
id="path6" /></g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 2.3 KiB |
16
H01/src/test/java/h01/ExampleJUnitTest.java
Normal file
16
H01/src/test/java/h01/ExampleJUnitTest.java
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
package h01;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An example JUnit test class.
|
||||||
|
*/
|
||||||
|
public class ExampleJUnitTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testAddition() {
|
||||||
|
assertEquals(2, 1 + 1);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue