forked from pabulaner/vivi
Init
This commit is contained in:
commit
26c8e9b7e2
38
.gitignore
vendored
Normal file
38
.gitignore
vendored
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
target/
|
||||||
|
!.mvn/wrapper/maven-wrapper.jar
|
||||||
|
!**/src/main/**/target/
|
||||||
|
!**/src/test/**/target/
|
||||||
|
|
||||||
|
### IntelliJ IDEA ###
|
||||||
|
.idea/modules.xml
|
||||||
|
.idea/jarRepositories.xml
|
||||||
|
.idea/compiler.xml
|
||||||
|
.idea/libraries/
|
||||||
|
*.iws
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
|
||||||
|
### Eclipse ###
|
||||||
|
.apt_generated
|
||||||
|
.classpath
|
||||||
|
.factorypath
|
||||||
|
.project
|
||||||
|
.settings
|
||||||
|
.springBeans
|
||||||
|
.sts4-cache
|
||||||
|
|
||||||
|
### NetBeans ###
|
||||||
|
/nbproject/private/
|
||||||
|
/nbbuild/
|
||||||
|
/dist/
|
||||||
|
/nbdist/
|
||||||
|
/.nb-gradle/
|
||||||
|
build/
|
||||||
|
!**/src/main/**/build/
|
||||||
|
!**/src/test/**/build/
|
||||||
|
|
||||||
|
### VS Code ###
|
||||||
|
.vscode/
|
||||||
|
|
||||||
|
### Mac OS ###
|
||||||
|
.DS_Store
|
||||||
9
.idea/encodings.xml
generated
Normal file
9
.idea/encodings.xml
generated
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Encoding">
|
||||||
|
<file url="file://$PROJECT_DIR$/chess/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/chess/src/main/resources" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
13
.idea/misc.xml
generated
Normal file
13
.idea/misc.xml
generated
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="MavenProjectsManager">
|
||||||
|
<option name="originalFiles">
|
||||||
|
<list>
|
||||||
|
<option value="$PROJECT_DIR$/pom.xml" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="temurin-17" project-jdk-type="JavaSDK">
|
||||||
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
124
.idea/uiDesigner.xml
generated
Normal file
124
.idea/uiDesigner.xml
generated
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Palette2">
|
||||||
|
<group name="Swing">
|
||||||
|
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="Button" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="RadioButton" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="CheckBox" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="Label" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||||
|
<preferred-size width="150" height="-1" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||||
|
<preferred-size width="150" height="-1" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||||
|
<preferred-size width="150" height="-1" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||||
|
<preferred-size width="200" height="200" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||||
|
<preferred-size width="200" height="200" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||||
|
<preferred-size width="-1" height="20" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||||
|
</item>
|
||||||
|
</group>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
6
.idea/vcs.xml
generated
Normal file
6
.idea/vcs.xml
generated
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
90
.idea/workspace.xml
generated
Normal file
90
.idea/workspace.xml
generated
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="AutoImportSettings">
|
||||||
|
<option name="autoReloadType" value="SELECTIVE" />
|
||||||
|
</component>
|
||||||
|
<component name="ChangeListManager">
|
||||||
|
<list default="true" id="395d95f7-d752-4ca0-b261-78679f611e7e" name="Changes" comment="">
|
||||||
|
<change afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" />
|
||||||
|
<change afterPath="$PROJECT_DIR$/.idea/encodings.xml" afterDir="false" />
|
||||||
|
<change afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
|
||||||
|
<change afterPath="$PROJECT_DIR$/.idea/uiDesigner.xml" afterDir="false" />
|
||||||
|
<change afterPath="$PROJECT_DIR$/.idea/vcs.xml" afterDir="false" />
|
||||||
|
<change afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
|
<change afterPath="$PROJECT_DIR$/chess/example-output.txt" afterDir="false" />
|
||||||
|
<change afterPath="$PROJECT_DIR$/chess/pom.xml" afterDir="false" />
|
||||||
|
<change afterPath="$PROJECT_DIR$/chess/src/main/java/de/vivi/chess/Main.java" afterDir="false" />
|
||||||
|
<change afterPath="$PROJECT_DIR$/chess/src/main/java/de/vivi/chess/board/Board.java" afterDir="false" />
|
||||||
|
<change afterPath="$PROJECT_DIR$/chess/src/main/java/de/vivi/chess/board/Field.java" afterDir="false" />
|
||||||
|
<change afterPath="$PROJECT_DIR$/chess/src/main/java/de/vivi/chess/game/Game.java" afterDir="false" />
|
||||||
|
<change afterPath="$PROJECT_DIR$/chess/src/main/java/de/vivi/chess/pieces/Color.java" afterDir="false" />
|
||||||
|
<change afterPath="$PROJECT_DIR$/chess/src/main/java/de/vivi/chess/pieces/Piece.java" afterDir="false" />
|
||||||
|
<change afterPath="$PROJECT_DIR$/chess/src/main/java/de/vivi/chess/pieces/Type.java" afterDir="false" />
|
||||||
|
<change afterPath="$PROJECT_DIR$/chess/todo.txt" afterDir="false" />
|
||||||
|
</list>
|
||||||
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
|
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||||
|
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||||
|
</component>
|
||||||
|
<component name="FileTemplateManagerImpl">
|
||||||
|
<option name="RECENT_TEMPLATES">
|
||||||
|
<list>
|
||||||
|
<option value="Enum" />
|
||||||
|
<option value="Class" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="Git.Settings">
|
||||||
|
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||||
|
</component>
|
||||||
|
<component name="ProjectId" id="2t4pEbnSWeDCfbjBDdHvVwWVJbu" />
|
||||||
|
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
|
||||||
|
<component name="ProjectViewState">
|
||||||
|
<option name="hideEmptyMiddlePackages" value="true" />
|
||||||
|
<option name="showLibraryContents" value="true" />
|
||||||
|
</component>
|
||||||
|
<component name="PropertiesComponent"><![CDATA[{
|
||||||
|
"keyToString": {
|
||||||
|
"Application.Main.executor": "Run",
|
||||||
|
"Application.Unnamed.executor": "Run",
|
||||||
|
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
||||||
|
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||||
|
"SHARE_PROJECT_CONFIGURATION_FILES": "true",
|
||||||
|
"git-widget-placeholder": "main",
|
||||||
|
"jdk.selected.JAVA_MODULE": "temurin-17",
|
||||||
|
"kotlin-language-version-configured": "true",
|
||||||
|
"project.structure.last.edited": "Modules",
|
||||||
|
"project.structure.proportion": "0.0",
|
||||||
|
"project.structure.side.proportion": "0.0"
|
||||||
|
}
|
||||||
|
}]]></component>
|
||||||
|
<component name="RunManager">
|
||||||
|
<configuration name="Unnamed" type="Application" factoryName="Application" nameIsGenerated="true">
|
||||||
|
<option name="MAIN_CLASS_NAME" value="de.vivi.chess.Main" />
|
||||||
|
<module name="chess" />
|
||||||
|
<method v="2">
|
||||||
|
<option name="Make" enabled="true" />
|
||||||
|
</method>
|
||||||
|
</configuration>
|
||||||
|
</component>
|
||||||
|
<component name="SharedIndexes">
|
||||||
|
<attachedChunks>
|
||||||
|
<set>
|
||||||
|
<option value="jdk-17.0.10-corretto-17.0.10-3183f394aec4-96c0d24d" />
|
||||||
|
<option value="jdk-17.0.10-temurin-17.0.10-3183f394aec4-539a993e" />
|
||||||
|
</set>
|
||||||
|
</attachedChunks>
|
||||||
|
</component>
|
||||||
|
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
||||||
|
<component name="TaskManager">
|
||||||
|
<task active="true" id="Default" summary="Default task">
|
||||||
|
<changelist id="395d95f7-d752-4ca0-b261-78679f611e7e" name="Changes" comment="" />
|
||||||
|
<created>1739621092112</created>
|
||||||
|
<option name="number" value="Default" />
|
||||||
|
<option name="presentableId" value="Default" />
|
||||||
|
<updated>1739621092112</updated>
|
||||||
|
</task>
|
||||||
|
<servers />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
49
chess/example-output.txt
Normal file
49
chess/example-output.txt
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
Welcome to Vivi's Chess Game!
|
||||||
|
|
||||||
|
A B C D E F G H
|
||||||
|
1 ■ □ ■ □ ■ □ ■ □
|
||||||
|
2 □ ■ □ ■ □ ■ □ ■
|
||||||
|
3 ■ □ ■ □ ■ □ ■ □
|
||||||
|
4 □ ■ □ ■ □ ■ □ ■
|
||||||
|
5 ■ □ ■ □ ■ □ ■ □
|
||||||
|
6 □ ■ □ ■ □ ■ □ ■
|
||||||
|
7 ■ □ ■ □ ■ □ ■ □
|
||||||
|
8 □ ■ □ ■ □ ■ □ ■
|
||||||
|
|
||||||
|
It is white's turn: [from:to]
|
||||||
|
A7:A5 <-- user input
|
||||||
|
Moving white 'Pawn' from A7 to A5
|
||||||
|
|
||||||
|
A B C D E F G H
|
||||||
|
1 ■ □ ■ □ ■ □ ■ □
|
||||||
|
2 □ ■ □ ■ □ ■ □ ■
|
||||||
|
3 ■ □ ■ □ ■ □ ■ □
|
||||||
|
4 □ ■ □ ■ □ ■ □ ■
|
||||||
|
5 ■ □ ■ □ ■ □ ■ □
|
||||||
|
6 □ ■ □ ■ □ ■ □ ■
|
||||||
|
7 ■ □ ■ □ ■ □ ■ □
|
||||||
|
8 □ ■ □ ■ □ ■ □ ■
|
||||||
|
|
||||||
|
It is black's turn: [from:to]
|
||||||
|
D2:D3
|
||||||
|
Moving black 'Pawn' from D2 to D3
|
||||||
|
|
||||||
|
A B C D E F G H
|
||||||
|
1 ■ □ ■ □ ■ □ ■ □
|
||||||
|
2 □ ■ □ ■ □ ■ □ ■
|
||||||
|
3 ■ □ ■ □ ■ □ ■ □
|
||||||
|
4 □ ■ □ ■ □ ■ □ ■
|
||||||
|
5 ■ □ ■ □ ■ □ ■ □
|
||||||
|
6 □ ■ □ ■ □ ■ □ ■
|
||||||
|
7 ■ □ ■ □ ■ □ ■ □
|
||||||
|
8 □ ■ □ ■ □ ■ □ ■
|
||||||
|
|
||||||
|
It is white's turn: [from:to]
|
||||||
|
B2:B3
|
||||||
|
Illegal move, try again: [from:to]
|
||||||
|
A8:A1
|
||||||
|
Illegal move, try again: [from:to]
|
||||||
|
Hello World!
|
||||||
|
Illegal input, try again: [from:to]
|
||||||
|
Z6:X9
|
||||||
|
Illegal input, try again: [from:to]
|
||||||
20
chess/pom.xml
Normal file
20
chess/pom.xml
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>org.example</groupId>
|
||||||
|
<artifactId>vivi-certificate</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>chess</artifactId>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
</project>
|
||||||
12
chess/src/main/java/de/vivi/chess/Main.java
Normal file
12
chess/src/main/java/de/vivi/chess/Main.java
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
package de.vivi.chess;
|
||||||
|
|
||||||
|
import de.vivi.chess.board.Board;
|
||||||
|
import de.vivi.chess.game.Game;
|
||||||
|
|
||||||
|
public class Main {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
Game game = new Game();
|
||||||
|
game.play();
|
||||||
|
}
|
||||||
|
}
|
||||||
85
chess/src/main/java/de/vivi/chess/board/Board.java
Normal file
85
chess/src/main/java/de/vivi/chess/board/Board.java
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
package de.vivi.chess.board;
|
||||||
|
|
||||||
|
import de.vivi.chess.pieces.Piece;
|
||||||
|
|
||||||
|
public class Board {
|
||||||
|
|
||||||
|
private static final int SIZE = 8;
|
||||||
|
|
||||||
|
private final Piece[/* column */][/* row */] grid;
|
||||||
|
|
||||||
|
public Board() {
|
||||||
|
grid = new Piece[SIZE][SIZE];
|
||||||
|
setup();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO: implement
|
||||||
|
* <p>
|
||||||
|
* This method should setup the board like it is common
|
||||||
|
* for a chess game. Black is in the top two rows, white
|
||||||
|
* in the bottom two rows. "White queen, white field, black
|
||||||
|
* queen, black field".
|
||||||
|
*/
|
||||||
|
private void setup() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO: implement
|
||||||
|
* <p>
|
||||||
|
* Moves the piece at the from field to the to field.
|
||||||
|
* Doesn't check for validity, this has to be done somewhere
|
||||||
|
* else. If a piece is already at the to field, this piece is
|
||||||
|
* just getting replaced.
|
||||||
|
*/
|
||||||
|
public void move(Field from, Field to) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO: implement
|
||||||
|
* <p>
|
||||||
|
* Returns the piece at the given field. If no piece is
|
||||||
|
* present it just returns null.
|
||||||
|
*/
|
||||||
|
public Piece getPiece(Field field) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder result = new StringBuilder();
|
||||||
|
boolean whiteField = true;
|
||||||
|
|
||||||
|
result.append(" ");
|
||||||
|
|
||||||
|
for (int column = 0; column < SIZE; column++) {
|
||||||
|
result.append((char) ('A' + column)).append(' ');
|
||||||
|
}
|
||||||
|
|
||||||
|
result.append('\n');
|
||||||
|
|
||||||
|
for (int row = 0; row < SIZE; row++) {
|
||||||
|
result.append((char) ('1' + (char) row)).append(' ');
|
||||||
|
|
||||||
|
for (int column = 0; column < SIZE; column++) {
|
||||||
|
Piece piece = grid[column][row];
|
||||||
|
|
||||||
|
if (piece == null) {
|
||||||
|
result.append(whiteField ? '\u25a0' : '\u25a1');
|
||||||
|
} else {
|
||||||
|
result.append(piece.getSymbol());
|
||||||
|
}
|
||||||
|
|
||||||
|
result.append(' ');
|
||||||
|
whiteField = !whiteField;
|
||||||
|
}
|
||||||
|
|
||||||
|
result.append('\n');
|
||||||
|
whiteField = !whiteField;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
43
chess/src/main/java/de/vivi/chess/board/Field.java
Normal file
43
chess/src/main/java/de/vivi/chess/board/Field.java
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
package de.vivi.chess.board;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO: implement fields and constructor
|
||||||
|
* <p>
|
||||||
|
* This class contains information to identify a single field
|
||||||
|
* on the board by its column and row.
|
||||||
|
*/
|
||||||
|
public class Field {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO: implement
|
||||||
|
* <p>
|
||||||
|
* Returns a new field that represents the field at the
|
||||||
|
* column and row indices.
|
||||||
|
*/
|
||||||
|
public static Field from(int column, int row) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO: implement
|
||||||
|
* <p>
|
||||||
|
* Returns a new field that represents the field represented
|
||||||
|
* by the provided string (like "A5", "E7", ...). If the string
|
||||||
|
* is not valid, because it is garbage (like "hello", "world", ...)
|
||||||
|
* or the indices are out of bounds (like "K3", "B9", ...")
|
||||||
|
* it should throw an IllegalArgument exception.
|
||||||
|
*/
|
||||||
|
public static Field fromString(String value) throws IllegalArgumentException {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getColumn() {
|
||||||
|
// TODO: implement
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getRow() {
|
||||||
|
// TODO: implement
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
29
chess/src/main/java/de/vivi/chess/game/Game.java
Normal file
29
chess/src/main/java/de/vivi/chess/game/Game.java
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
package de.vivi.chess.game;
|
||||||
|
|
||||||
|
import de.vivi.chess.board.Board;
|
||||||
|
import de.vivi.chess.pieces.Color;
|
||||||
|
|
||||||
|
public class Game {
|
||||||
|
|
||||||
|
private final Board board;
|
||||||
|
|
||||||
|
private Color player;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO: implement
|
||||||
|
*/
|
||||||
|
public Game() {
|
||||||
|
board = null;
|
||||||
|
player = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO: implement
|
||||||
|
* <p>
|
||||||
|
* Starts the game and should process the game like it is
|
||||||
|
* specified inside example-output.txt.
|
||||||
|
*/
|
||||||
|
public void play() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
7
chess/src/main/java/de/vivi/chess/pieces/Color.java
Normal file
7
chess/src/main/java/de/vivi/chess/pieces/Color.java
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
package de.vivi.chess.pieces;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO: add colors (white and black)
|
||||||
|
*/
|
||||||
|
public enum Color {
|
||||||
|
}
|
||||||
39
chess/src/main/java/de/vivi/chess/pieces/Piece.java
Normal file
39
chess/src/main/java/de/vivi/chess/pieces/Piece.java
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
package de.vivi.chess.pieces;
|
||||||
|
|
||||||
|
import de.vivi.chess.board.Board;
|
||||||
|
import de.vivi.chess.board.Field;
|
||||||
|
|
||||||
|
public abstract class Piece {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO: implement
|
||||||
|
* <p>
|
||||||
|
* This method needs to be implemented in each piece by
|
||||||
|
* using inheritance. It returns true if the move from the
|
||||||
|
* from field to the to field is considered a valid move
|
||||||
|
* for the type of piece this method is called on. Otherwise
|
||||||
|
* it returns false.
|
||||||
|
*/
|
||||||
|
public abstract boolean isValidMove(Board board, Field from, Field to);
|
||||||
|
|
||||||
|
public Color getColor() {
|
||||||
|
// TODO: implement
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Type getType() {
|
||||||
|
// TODO: implement
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO: implement
|
||||||
|
* <p>
|
||||||
|
* Use unicode symbols for the chess pieces. You can find
|
||||||
|
* them here:
|
||||||
|
* <a href="https://en.wikipedia.org/wiki/Chess_symbols_in_Unicode">Unicode chess pieces</a>
|
||||||
|
*/
|
||||||
|
public char getSymbol() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
17
chess/src/main/java/de/vivi/chess/pieces/Type.java
Normal file
17
chess/src/main/java/de/vivi/chess/pieces/Type.java
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
package de.vivi.chess.pieces;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO: add types
|
||||||
|
* <p>
|
||||||
|
* This enum should contain all chess piece types.
|
||||||
|
* The types are:
|
||||||
|
*
|
||||||
|
* - king (König)
|
||||||
|
* - queen (Dame)
|
||||||
|
* - bishop (Läufer)
|
||||||
|
* - knight (Springer/Pferd)
|
||||||
|
* - rook (Turm)
|
||||||
|
* - pawn (Bauer)
|
||||||
|
*/
|
||||||
|
public enum Type {
|
||||||
|
}
|
||||||
5
chess/todo.txt
Normal file
5
chess/todo.txt
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
Everything you need to do is marked with a TODO comment
|
||||||
|
|
||||||
|
Additionally, create a chess piece class that extends Piece for every type of chess piece.
|
||||||
|
For example Pawn.java, King.java, ...
|
||||||
|
For this you can also look into Type.java
|
||||||
Loading…
Reference in New Issue
Block a user