diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..adeb0a3 --- /dev/null +++ b/.classpath @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ae3c172 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/bin/ diff --git a/.metadata/.lock b/.metadata/.lock new file mode 100644 index 0000000..e69de29 diff --git a/.metadata/.log b/.metadata/.log new file mode 100644 index 0000000..a6c565a --- /dev/null +++ b/.metadata/.log @@ -0,0 +1,53 @@ +!SESSION 2022-12-07 22:04:40.500 ----------------------------------------------- +eclipse.buildId=4.24.0.I20220607-0700 +java.version=17.0.4 +java.vendor=Eclipse Adoptium +BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=ko_KR +Framework arguments: -product org.eclipse.epp.package.java.product -product org.eclipse.epp.package.java.product +Command-line arguments: -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.java.product -data C:\Users\dh101\Desktop\도현\대학\3학년 2학기\프로그래밍설계방법론\팀플\ChessGame -product org.eclipse.epp.package.java.product + +!ENTRY org.eclipse.jface 2 0 2022-12-07 22:04:43.316 +!MESSAGE Keybinding conflicts occurred. They may interfere with normal accelerator operation. +!SUBENTRY 1 org.eclipse.jface 2 0 2022-12-07 22:04:43.316 +!MESSAGE A conflict occurred for CTRL+SHIFT+T: +Binding(CTRL+SHIFT+T, + ParameterizedCommand(Command(org.eclipse.jdt.ui.navigate.open.type,Open Type, + Open a type in a Java editor, + Category(org.eclipse.ui.category.navigate,Navigate,null,true), + org.eclipse.ui.internal.WorkbenchHandlerServiceHandler@4ba13fed, + ,,true),null), + org.eclipse.ui.defaultAcceleratorConfiguration, + org.eclipse.ui.contexts.window,,,system) +Binding(CTRL+SHIFT+T, + ParameterizedCommand(Command(org.eclipse.lsp4e.symbolinworkspace,Go to Symbol in Workspace, + , + Category(org.eclipse.lsp4e.category,Language Servers,null,true), + org.eclipse.ui.internal.WorkbenchHandlerServiceHandler@651cedfb, + ,,true),null), + org.eclipse.ui.defaultAcceleratorConfiguration, + org.eclipse.ui.contexts.window,,,system) +!SUBENTRY 1 org.eclipse.jface 2 0 2022-12-07 22:04:43.316 +!MESSAGE A conflict occurred for ALT+SHIFT+R: +Binding(ALT+SHIFT+R, + ParameterizedCommand(Command(org.eclipse.jdt.ui.edit.text.java.rename.element,Rename - Refactoring , + Rename the selected element, + Category(org.eclipse.jdt.ui.category.refactoring,Refactor - Java,Java Refactoring Actions,true), + org.eclipse.ui.internal.WorkbenchHandlerServiceHandler@18d22ecf, + ,,true),null), + org.eclipse.ui.defaultAcceleratorConfiguration, + org.eclipse.ui.contexts.window,,,system) +Binding(ALT+SHIFT+R, + ParameterizedCommand(Command(org.eclipse.ui.edit.rename,Rename, + Rename the selected item, + Category(org.eclipse.ui.category.file,File,null,true), + org.eclipse.ui.internal.WorkbenchHandlerServiceHandler@73d83141, + ,,true),null), + org.eclipse.ui.defaultAcceleratorConfiguration, + org.eclipse.ui.contexts.window,,,system) + +!ENTRY org.eclipse.egit.ui 2 0 2022-12-07 22:04:46.112 +!MESSAGE Warning: The environment variable HOME is not set. The following directory will be used to store the Git +user global configuration and to define the default location to store repositories: 'C:\Users\dh101'. If this is +not correct please set the HOME environment variable and restart Eclipse. Otherwise Git for Windows and +EGit might behave differently since they see different configuration options. +This warning can be switched off on the Team > Git > Confirmations and Warnings preference page. diff --git a/.metadata/.plugins/org.eclipse.core.resources/.projects/.org.eclipse.egit.core.cmp/.location b/.metadata/.plugins/org.eclipse.core.resources/.projects/.org.eclipse.egit.core.cmp/.location new file mode 100644 index 0000000..6a680af Binary files /dev/null and b/.metadata/.plugins/org.eclipse.core.resources/.projects/.org.eclipse.egit.core.cmp/.location differ diff --git a/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/history.version b/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/history.version new file mode 100644 index 0000000..25cb955 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/history.version @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.index b/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.index new file mode 100644 index 0000000..d237251 Binary files /dev/null and b/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.index differ diff --git a/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.version b/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.version new file mode 100644 index 0000000..6b2aaa7 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.version @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/.metadata/.plugins/org.eclipse.core.resources/.root/1.tree b/.metadata/.plugins/org.eclipse.core.resources/.root/1.tree new file mode 100644 index 0000000..49203ab Binary files /dev/null and b/.metadata/.plugins/org.eclipse.core.resources/.root/1.tree differ diff --git a/.metadata/.plugins/org.eclipse.core.resources/.safetable/org.eclipse.core.resources b/.metadata/.plugins/org.eclipse.core.resources/.safetable/org.eclipse.core.resources new file mode 100644 index 0000000..486cbed Binary files /dev/null and b/.metadata/.plugins/org.eclipse.core.resources/.safetable/org.eclipse.core.resources differ diff --git a/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.core.resources.prefs b/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..30841eb --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,3 @@ +eclipse.preferences.version=1 +encoding=UTF-8 +version=1 diff --git a/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.ui.prefs b/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 0000000..f305bcf --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,8 @@ +content_assist_proposals_background=255,255,255 +content_assist_proposals_foreground=0,0,0 +eclipse.preferences.version=1 +org.eclipse.jdt.ui.formatterprofiles.version=22 +spelling_locale_initialized=true +typefilter_migrated_2=true +useAnnotationsPrefPage=true +useQuickDiffPrefPage=true diff --git a/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jsch.core.prefs b/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jsch.core.prefs new file mode 100644 index 0000000..d56c53f --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jsch.core.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +org.eclipse.jsch.core.hasChangedDefaultWin32SshHome=true diff --git a/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.m2e.discovery.prefs b/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.m2e.discovery.prefs new file mode 100644 index 0000000..67b1d96 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.m2e.discovery.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +org.eclipse.m2e.discovery.pref.projects= diff --git a/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.ide.prefs b/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.ide.prefs new file mode 100644 index 0000000..27016b2 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.ide.prefs @@ -0,0 +1,4 @@ +eclipse.preferences.version=1 +platformState=1662014568512 +quickStart=false +tipsAndTricks=true diff --git a/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.prefs b/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.prefs new file mode 100644 index 0000000..08076f2 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +showIntro=false diff --git a/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.workbench.prefs b/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.workbench.prefs new file mode 100644 index 0000000..b85d0db --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.workbench.prefs @@ -0,0 +1,9 @@ +//org.eclipse.ui.commands/state/org.eclipse.ui.navigator.resources.nested.changeProjectPresentation/org.eclipse.ui.commands.radioState=false +PLUGINS_NOT_ACTIVATED_ON_STARTUP=;org.eclipse.m2e.discovery; +eclipse.preferences.version=1 +org.eclipse.ui.workbench.ACTIVE_NOFOCUS_TAB_BG_END=255,255,255 +org.eclipse.ui.workbench.ACTIVE_NOFOCUS_TAB_BG_START=255,255,255 +org.eclipse.ui.workbench.ACTIVE_NOFOCUS_TAB_TEXT_COLOR=16,16,16 +org.eclipse.ui.workbench.ACTIVE_TAB_BG_END=255,255,255 +org.eclipse.ui.workbench.ACTIVE_TAB_BG_START=255,255,255 +org.eclipse.ui.workbench.INACTIVE_TAB_BG_START=242,242,242 diff --git a/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.urischeme.prefs b/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.urischeme.prefs new file mode 100644 index 0000000..855d634 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.urischeme.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +processedSchemes=,eclipse+command,eclipse+mpc diff --git a/.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi b/.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi new file mode 100644 index 0000000..c4196c3 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi @@ -0,0 +1,2147 @@ + + + + activeSchemeId:org.eclipse.ui.defaultAcceleratorConfiguration + + + + + + + + topLevel + shellMaximized + + + + + persp.actionSet:org.eclipse.ui.cheatsheets.actionSet + persp.actionSet:org.eclipse.search.searchActionSet + persp.actionSet:org.eclipse.text.quicksearch.actionSet + persp.actionSet:org.eclipse.ui.edit.text.actionSet.annotationNavigation + persp.actionSet:org.eclipse.ui.edit.text.actionSet.navigation + persp.actionSet:org.eclipse.ui.edit.text.actionSet.convertLineDelimitersTo + persp.actionSet:org.eclipse.ui.externaltools.ExternalToolsSet + persp.actionSet:org.eclipse.ui.actionSet.keyBindings + persp.actionSet:org.eclipse.ui.actionSet.openFiles + persp.actionSet:org.eclipse.debug.ui.launchActionSet + persp.actionSet:org.eclipse.jdt.ui.JavaActionSet + persp.actionSet:org.eclipse.jdt.ui.JavaElementCreationActionSet + persp.actionSet:org.eclipse.ui.NavigateActionSet + persp.viewSC:org.eclipse.jdt.ui.PackageExplorer + persp.viewSC:org.eclipse.jdt.ui.TypeHierarchy + persp.viewSC:org.eclipse.jdt.ui.SourceView + persp.viewSC:org.eclipse.jdt.ui.JavadocView + persp.viewSC:org.eclipse.search.ui.views.SearchView + persp.viewSC:org.eclipse.ui.console.ConsoleView + persp.viewSC:org.eclipse.ui.views.ContentOutline + persp.viewSC:org.eclipse.ui.views.ProblemView + persp.viewSC:org.eclipse.ui.views.ResourceNavigator + persp.viewSC:org.eclipse.ui.views.TaskList + persp.viewSC:org.eclipse.ui.views.ProgressView + persp.viewSC:org.eclipse.ui.navigator.ProjectExplorer + persp.viewSC:org.eclipse.ui.texteditor.TemplatesView + persp.viewSC:org.eclipse.pde.runtime.LogView + persp.newWizSC:org.eclipse.jdt.ui.wizards.JavaProjectWizard + persp.newWizSC:org.eclipse.jdt.ui.wizards.NewPackageCreationWizard + persp.newWizSC:org.eclipse.jdt.ui.wizards.NewClassCreationWizard + persp.newWizSC:org.eclipse.jdt.ui.wizards.NewInterfaceCreationWizard + persp.newWizSC:org.eclipse.jdt.ui.wizards.NewEnumCreationWizard + persp.newWizSC:org.eclipse.jdt.ui.wizards.NewRecordCreationWizard + persp.newWizSC:org.eclipse.jdt.ui.wizards.NewAnnotationCreationWizard + persp.newWizSC:org.eclipse.jdt.ui.wizards.NewSourceFolderCreationWizard + persp.newWizSC:org.eclipse.jdt.ui.wizards.NewSnippetFileCreationWizard + persp.newWizSC:org.eclipse.jdt.ui.wizards.NewJavaWorkingSetWizard + persp.newWizSC:org.eclipse.ui.wizards.new.folder + persp.newWizSC:org.eclipse.ui.wizards.new.file + persp.newWizSC:org.eclipse.ui.editors.wizards.UntitledTextFileWizard + persp.perspSC:org.eclipse.jdt.ui.JavaBrowsingPerspective + persp.perspSC:org.eclipse.debug.ui.DebugPerspective + persp.showIn:org.eclipse.jdt.ui.PackageExplorer + persp.showIn:org.eclipse.team.ui.GenericHistoryView + persp.showIn:org.eclipse.ui.navigator.ProjectExplorer + persp.actionSet:org.eclipse.debug.ui.breakpointActionSet + persp.actionSet:org.eclipse.jdt.debug.ui.JDTDebugActionSet + persp.showIn:org.eclipse.egit.ui.RepositoriesView + persp.actionSet:org.eclipse.eclemma.ui.CoverageActionSet + persp.showIn:org.eclipse.eclemma.ui.CoverageView + persp.viewSC:org.eclipse.tm.terminal.view.ui.TerminalsView + persp.showIn:org.eclipse.tm.terminal.view.ui.TerminalsView + persp.newWizSC:org.eclipse.jdt.junit.wizards.NewTestCaseCreationWizard + persp.actionSet:org.eclipse.jdt.junit.JUnitActionSet + persp.viewSC:org.eclipse.ant.ui.views.AntView + + + + org.eclipse.e4.primaryNavigationStack + active + + View + categoryTag:Java + + + View + categoryTag:Java + + + View + categoryTag:General + + + View + categoryTag:Java + + + + + View + categoryTag:Git + + + + + + + + org.eclipse.e4.secondaryNavigationStack + + View + categoryTag:General + + + View + categoryTag:General + + + View + categoryTag:General + + + View + categoryTag:Ant + + + + + org.eclipse.e4.secondaryDataStack + + View + categoryTag:General + + + View + categoryTag:Java + + + View + categoryTag:Java + + + View + categoryTag:General + + + View + categoryTag:General + + + View + categoryTag:General + + + View + categoryTag:General + + + View + categoryTag:Terminal + + + + + + + + + View + categoryTag:Help + + + View + categoryTag:General + + + View + categoryTag:Help + + + + + + + View + categoryTag:Help + + + + + + View + categoryTag:General + + ViewMenu + menuContribution:menu + + + + + + + View + categoryTag:Help + + + + org.eclipse.e4.primaryDataStack + EditorStack + + + + + + + View + categoryTag:Java + active + activeOnClose + + ViewMenu + menuContribution:menu + + + + + + + View + categoryTag:Java + + + + + View + categoryTag:General + + + + + + View + categoryTag:General + + ViewMenu + menuContribution:menu + + + + + + + View + categoryTag:Java + + + + + View + categoryTag:Java + + + + + View + categoryTag:General + + + + + View + categoryTag:General + + + + + View + categoryTag:General + + + + + View + categoryTag:General + + + + + + View + categoryTag:General + + ViewMenu + menuContribution:menu + + + + + + + View + categoryTag:General + + + + + View + categoryTag:General + + + + + View + categoryTag:Git + + + + + View + categoryTag:Terminal + + + + + View + categoryTag:Java + + + + + View + categoryTag:Ant + + + + toolbarSeparator + + + + Draggable + + + + toolbarSeparator + + + + Draggable + + + toolbarSeparator + + + + Draggable + + + Draggable + + + Draggable + + + toolbarSeparator + + + + Draggable + + + + toolbarSeparator + + + + toolbarSeparator + + + + Draggable + + + stretch + SHOW_RESTORE_MENU + + + Draggable + HIDEABLE + SHOW_RESTORE_MENU + + + + + stretch + + + Draggable + + + Draggable + + + + + TrimStack + Draggable + + + + + + + + + + + + + + + + + + + + + + platform:win32 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + platform:win32 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Editor + removeOnHide + + + + + View + categoryTag:Ant + + + + + View + categoryTag:Gradle + + + + + View + categoryTag:Gradle + + + + + View + categoryTag:Debug + + + + + View + categoryTag:Debug + + + + + View + categoryTag:Debug + + + + + View + categoryTag:Debug + + + + + View + categoryTag:Debug + + + + + View + categoryTag:Debug + + + + + View + categoryTag:Debug + + + View + categoryTag:Debug + + + + + View + categoryTag:Java + + + + + View + categoryTag:Git + + + + + View + categoryTag:Git + + + + + View + categoryTag:Git + + + + + View + categoryTag:Git + NoRestore + + + + + View + categoryTag:Git + + + + + View + categoryTag:Help + + + + + View + categoryTag:Debug + + + + + View + categoryTag:Java + + + + + View + categoryTag:Java + + + + + View + categoryTag:Java + + + + + View + categoryTag:Java Browsing + + + + + View + categoryTag:Java Browsing + + + + + View + categoryTag:Java Browsing + + + + + View + categoryTag:Java Browsing + + + + + View + categoryTag:Java + + + + + View + categoryTag:General + + + + + View + categoryTag:Java + + + + + View + categoryTag:Java + + + + + View + categoryTag:Maven + + + + + View + categoryTag:Maven + + + + + View + categoryTag:Maven + + + + + View + categoryTag:Oomph + + + + + View + categoryTag:General + + + + + View + categoryTag:Version Control (Team) + + + + + View + categoryTag:Version Control (Team) + + + View + categoryTag:Help + + + + + View + categoryTag:Terminal + + + + + View + categoryTag:Other + + + + + View + categoryTag:General + + + + + View + categoryTag:General + + + + + View + categoryTag:Help + + + + + View + categoryTag:General + + + + + View + categoryTag:General + + + + + View + categoryTag:General + + + + + View + categoryTag:General + + + + + View + categoryTag:General + + + + + View + categoryTag:General + + + + + View + categoryTag:General + + + + + View + categoryTag:General + + + + + View + categoryTag:General + + + + + View + categoryTag:General + + + + + View + categoryTag:General + + + + + View + categoryTag:General + + + + glue + move_after:PerspectiveSpacer + SHOW_RESTORE_MENU + + + move_after:Spacer Glue + HIDEABLE + SHOW_RESTORE_MENU + + + glue + move_after:SearchField + SHOW_RESTORE_MENU + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.metadata/.plugins/org.eclipse.egit.core/.org.eclipse.egit.core.cmp/.project b/.metadata/.plugins/org.eclipse.egit.core/.org.eclipse.egit.core.cmp/.project new file mode 100644 index 0000000..3c10856 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.egit.core/.org.eclipse.egit.core.cmp/.project @@ -0,0 +1,11 @@ + + + .org.eclipse.egit.core.cmp + + + + + + + + diff --git a/.metadata/.plugins/org.eclipse.egit.core/.org.eclipse.egit.core.cmp/.settings/org.eclipse.core.resources.prefs b/.metadata/.plugins/org.eclipse.egit.core/.org.eclipse.egit.core.cmp/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..99f26c0 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.egit.core/.org.eclipse.egit.core.cmp/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/.metadata/.plugins/org.eclipse.jdt.core/assumedExternalFilesCache b/.metadata/.plugins/org.eclipse.jdt.core/assumedExternalFilesCache new file mode 100644 index 0000000..593f470 Binary files /dev/null and b/.metadata/.plugins/org.eclipse.jdt.core/assumedExternalFilesCache differ diff --git a/.metadata/.plugins/org.eclipse.jdt.core/externalFilesCache b/.metadata/.plugins/org.eclipse.jdt.core/externalFilesCache new file mode 100644 index 0000000..593f470 Binary files /dev/null and b/.metadata/.plugins/org.eclipse.jdt.core/externalFilesCache differ diff --git a/.metadata/.plugins/org.eclipse.jdt.core/javaLikeNames.txt b/.metadata/.plugins/org.eclipse.jdt.core/javaLikeNames.txt new file mode 100644 index 0000000..8586397 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.jdt.core/javaLikeNames.txt @@ -0,0 +1 @@ +java \ No newline at end of file diff --git a/.metadata/.plugins/org.eclipse.jdt.core/nonChainingJarsCache b/.metadata/.plugins/org.eclipse.jdt.core/nonChainingJarsCache new file mode 100644 index 0000000..593f470 Binary files /dev/null and b/.metadata/.plugins/org.eclipse.jdt.core/nonChainingJarsCache differ diff --git a/.metadata/.plugins/org.eclipse.jdt.core/variablesAndContainers.dat b/.metadata/.plugins/org.eclipse.jdt.core/variablesAndContainers.dat new file mode 100644 index 0000000..0edae4b Binary files /dev/null and b/.metadata/.plugins/org.eclipse.jdt.core/variablesAndContainers.dat differ diff --git a/.metadata/.plugins/org.eclipse.jdt.ui/OpenTypeHistory.xml b/.metadata/.plugins/org.eclipse.jdt.ui/OpenTypeHistory.xml new file mode 100644 index 0000000..a4ee3cb --- /dev/null +++ b/.metadata/.plugins/org.eclipse.jdt.ui/OpenTypeHistory.xml @@ -0,0 +1,2 @@ + + diff --git a/.metadata/.plugins/org.eclipse.jdt.ui/QualifiedTypeNameHistory.xml b/.metadata/.plugins/org.eclipse.jdt.ui/QualifiedTypeNameHistory.xml new file mode 100644 index 0000000..9e390f5 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.jdt.ui/QualifiedTypeNameHistory.xml @@ -0,0 +1,2 @@ + + diff --git a/.metadata/.plugins/org.eclipse.jdt.ui/dialog_settings.xml b/.metadata/.plugins/org.eclipse.jdt.ui/dialog_settings.xml new file mode 100644 index 0000000..cd0a35b --- /dev/null +++ b/.metadata/.plugins/org.eclipse.jdt.ui/dialog_settings.xml @@ -0,0 +1,10 @@ + +
+
+ + + + + +
+
diff --git a/.metadata/.plugins/org.eclipse.m2e.logback.configuration/0.log b/.metadata/.plugins/org.eclipse.m2e.logback.configuration/0.log new file mode 100644 index 0000000..b10e1b8 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.m2e.logback.configuration/0.log @@ -0,0 +1 @@ +2022-12-07 22:04:46,104 [Worker-3: Loading available Gradle versions] INFO o.e.b.c.i.u.g.PublishedGradleVersions - Gradle version information cache is up-to-date. Trying to read. diff --git a/.metadata/.plugins/org.eclipse.m2e.logback.configuration/logback.1.16.3.20211002-1029.xml b/.metadata/.plugins/org.eclipse.m2e.logback.configuration/logback.1.16.3.20211002-1029.xml new file mode 100644 index 0000000..4512556 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.m2e.logback.configuration/logback.1.16.3.20211002-1029.xml @@ -0,0 +1,41 @@ + + + + %date [%thread] %-5level %logger{35} - %msg%n + + + OFF + + + + + ${org.eclipse.m2e.log.dir}/0.log + + ${org.eclipse.m2e.log.dir}/%i.log + 1 + 10 + + + 100MB + + + %date [%thread] %-5level %logger{35} - %msg%n + + + + + + WARN + + + + + + + + + + + + + diff --git a/.metadata/.plugins/org.eclipse.oomph.setup/workspace.setup b/.metadata/.plugins/org.eclipse.oomph.setup/workspace.setup new file mode 100644 index 0000000..1f73e14 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.oomph.setup/workspace.setup @@ -0,0 +1,6 @@ + + diff --git a/.metadata/.plugins/org.eclipse.tips.ide/dialog_settings.xml b/.metadata/.plugins/org.eclipse.tips.ide/dialog_settings.xml new file mode 100644 index 0000000..5ca0b77 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.tips.ide/dialog_settings.xml @@ -0,0 +1,3 @@ + +
+
diff --git a/.metadata/.plugins/org.eclipse.ui.intro/introstate b/.metadata/.plugins/org.eclipse.ui.intro/introstate new file mode 100644 index 0000000..02f134f --- /dev/null +++ b/.metadata/.plugins/org.eclipse.ui.intro/introstate @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/.metadata/.plugins/org.eclipse.ui.workbench/workingsets.xml b/.metadata/.plugins/org.eclipse.ui.workbench/workingsets.xml new file mode 100644 index 0000000..99cb5e5 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.ui.workbench/workingsets.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.metadata/version.ini b/.metadata/version.ini new file mode 100644 index 0000000..c1abcc6 --- /dev/null +++ b/.metadata/version.ini @@ -0,0 +1,3 @@ +#Wed Dec 07 22:04:41 KST 2022 +org.eclipse.core.runtime=2 +org.eclipse.platform=4.24.0.v20220607-0700 diff --git a/.project b/.project new file mode 100644 index 0000000..c7cb894 --- /dev/null +++ b/.project @@ -0,0 +1,17 @@ + + + ChessGame + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..99f26c0 --- /dev/null +++ b/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..8c9943d --- /dev/null +++ b/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,14 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=17 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=17 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=17 diff --git a/img/bs1.png b/img/bs1.png new file mode 100644 index 0000000..5e1cae4 Binary files /dev/null and b/img/bs1.png differ diff --git a/img/bs2.png b/img/bs2.png new file mode 100644 index 0000000..f931391 Binary files /dev/null and b/img/bs2.png differ diff --git a/img/horse1.png b/img/horse1.png new file mode 100644 index 0000000..95b761c Binary files /dev/null and b/img/horse1.png differ diff --git a/img/horse2.png b/img/horse2.png new file mode 100644 index 0000000..8ee593a Binary files /dev/null and b/img/horse2.png differ diff --git a/img/king1.png b/img/king1.png new file mode 100644 index 0000000..8c5dc5d Binary files /dev/null and b/img/king1.png differ diff --git a/img/king2.png b/img/king2.png new file mode 100644 index 0000000..3a45c78 Binary files /dev/null and b/img/king2.png differ diff --git a/img/lock1.png b/img/lock1.png new file mode 100644 index 0000000..ec9e62a Binary files /dev/null and b/img/lock1.png differ diff --git a/img/lock2.png b/img/lock2.png new file mode 100644 index 0000000..ce3c83a Binary files /dev/null and b/img/lock2.png differ diff --git a/img/porn1.png b/img/porn1.png new file mode 100644 index 0000000..29d7484 Binary files /dev/null and b/img/porn1.png differ diff --git a/img/porn2.png b/img/porn2.png new file mode 100644 index 0000000..ffc45ca Binary files /dev/null and b/img/porn2.png differ diff --git a/img/queen1.png b/img/queen1.png new file mode 100644 index 0000000..1855274 Binary files /dev/null and b/img/queen1.png differ diff --git a/img/queen2.png b/img/queen2.png new file mode 100644 index 0000000..7a007d4 Binary files /dev/null and b/img/queen2.png differ diff --git a/img/road.png b/img/road.png new file mode 100644 index 0000000..33f624c Binary files /dev/null and b/img/road.png differ diff --git a/src/BoardButton.java b/src/BoardButton.java new file mode 100644 index 0000000..1ec48a5 --- /dev/null +++ b/src/BoardButton.java @@ -0,0 +1,52 @@ +import java.awt.Color; +import java.awt.event.*; +import javax.swing.*; +import java.awt.Graphics; + +public class BoardButton extends JButton implements ActionListener{ + private ChessBoard board; + private ChessFrame frame; + private final int row; + private final int col; + public BoardButton(ChessBoard b,ChessFrame f, int row, int col) { + board = b; + frame = f; + this.row = row; + this.col = col; + addActionListener(this); + } + public int row() { + return row; + } + public int col() { + return col; + } + + + public void actionPerformed(ActionEvent e) { + if (board.getBoardPiece(row, col).getType() != "" && board.getBoardPiece(row, col).getPlayerNum() == board.turn) { + for(int i = 0;i < 8;i++) { + for(int j = 0;j < 8;j++) { + if(board.getBoardPiece(i, j).getType() == "" || board.getBoardPiece(i, j).getType() == "road" ) + board.board[i][j].type = ""; + } + } + frame.road = board.calRoad(row, col); + frame.showRoad(); + frame.show = true; + frame.currow = row; + frame.curcol = col; + } + if (frame.show == true && (board.getBoardPiece(row, col).getType() != "" || board.getBoardPiece(row, col).getPlayerNum() != board.turn)) { + for(int i = 0;i < 56;i++) { + if (frame.road[i][0] == row && frame.road[i][1] == col) { + board.movePiece(frame.currow,frame.curcol, row, col); + frame.show = false; + frame.update(); + } + } + } + frame.update(); + } + +} diff --git a/src/BoardPiece.java b/src/BoardPiece.java new file mode 100644 index 0000000..b0034fe --- /dev/null +++ b/src/BoardPiece.java @@ -0,0 +1,17 @@ +public class BoardPiece { + int player; + String type; + + public BoardPiece(int p, String s) { + player = p; + type = s; + } + + public int getPlayerNum() { + return player; + } + public String getType() { + return type; + } + +} diff --git a/src/ChessBoard.java b/src/ChessBoard.java new file mode 100644 index 0000000..3a61b08 --- /dev/null +++ b/src/ChessBoard.java @@ -0,0 +1,452 @@ +import javax.swing.*; + +public class ChessBoard { + public BoardPiece[][] board = new BoardPiece[8][8]; + public String[] piecename = {"King", "Queen", "Rooks", "Bishops", "Knights", "Pawns", ""}; + Player p1; + Player p2; + Grave grave; + int turn = 1; + int first = 0; + int victory = 0; + + public ChessBoard() { + String input = JOptionPane.showInputDialog("1번 플레이어의 이름을 입력해주세요"); + p1 = new Player(input, 1, true); + input = JOptionPane.showInputDialog("2번 플레이어의 이름을 입력해주세요"); + p2 = new Player(input, 1, true); + grave = new Grave(); + createBoard(); + + } + public void createBoard() { + board[7][3]= new BoardPiece(1, piecename[0]); + board[0][3]= new BoardPiece(2, piecename[0]); + board[7][4]= new BoardPiece(1, piecename[1]); + board[0][4]= new BoardPiece(2, piecename[1]); + board[7][7]= new BoardPiece(1, piecename[2]); + board[7][0]= new BoardPiece(1, piecename[2]); + board[0][0]= new BoardPiece(2, piecename[2]); + board[0][7]= new BoardPiece(2, piecename[2]); + board[7][2]= new BoardPiece(1, piecename[3]); + board[7][5]= new BoardPiece(1, piecename[3]); + board[0][2]= new BoardPiece(2, piecename[3]); + board[0][5]= new BoardPiece(2, piecename[3]); + board[7][1]= new BoardPiece(1, piecename[4]); + board[7][6]= new BoardPiece(1, piecename[4]); + board[0][1]= new BoardPiece(2, piecename[4]); + board[0][6]= new BoardPiece(2, piecename[4]); + for (int i = 0; i < 8; i++) { + board[1][i] = new BoardPiece(2, piecename[5]); + board[6][i] = new BoardPiece(1, piecename[5]); + } + for (int i = 0; i < 4; i++) + for (int j = 0; j < 8; j++) { + board[2+i][j] = new BoardPiece(0, piecename[6]); + + } + } + public boolean isPossible(int r, int c) { + return r >= 0 && r < 8 && c >= 0 && c < 8 && board[r][c].getType().equals("") && board[r][c].getPlayerNum() == turn; + } + public boolean isMoveable(int r, int c) { + return r >= 0 && r < 8 && c >= 0 && c < 8 && (board[r][c].getType().equals("") || board[r][c].getPlayerNum() != turn); + } + + public int[][] calRoad(int r, int c){ + BoardPiece tmp = board[r][c]; + int idx=0; + int[][] road = new int[56][2]; + for (int i=0;i < 56; i++) + for(int j=0; j<2; j++) + road[i][j] = -1; + if (tmp.getType().equals(piecename[0])) { + if (isMoveable(r-1, c-1)) { + road[idx][0] = r-1; + road[idx][1] = c-1; + idx++; + } + if (isMoveable(r-1, c)) { + road[idx][0] = r-1; + road[idx][1] = c; + idx++; + } + if (isMoveable(r-1, c+1)) { + road[idx][0] = r-1; + road[idx][1] = c+1; + idx++; + } + if (isMoveable(r, c-1)) { + road[idx][0] = r; + road[idx][1] = c-1; + idx++; + } + if (isMoveable(r, c+1)) { + road[idx][0] = r; + road[idx][1] = c+1; + idx++; + } + if (isMoveable(r+1, c-1)) { + road[idx][0] = r+1; + road[idx][1] = c-1; + idx++; + } + if (isMoveable(r+1, c)) { + road[idx][0] = r+1; + road[idx][1] = c; + idx++; + }if (isMoveable(r+1, c+1)) { + road[idx][0] = r+1; + road[idx][1] = c+1; + idx++; + } + return road; + } + else if (tmp.getType().equals(piecename[4])) { + if (isMoveable(r-2, c-1)) { + road[idx][0] = r-2; + road[idx][1] = c-1; + idx++; + } + if (isMoveable(r-2, c+1)) { + road[idx][0] = r-2; + road[idx][1] = c+1; + idx++; + } + if (isMoveable(r-1, c-2)) { + road[idx][0] = r-1; + road[idx][1] = c-2; + idx++; + } + if (isMoveable(r-1, c+2)) { + road[idx][0] = r-1; + road[idx][1] = c+2; + idx++; + } + if (isMoveable(r+2, c-1)) { + road[idx][0] = r+2; + road[idx][1] = c-1; + idx++; + } + if (isMoveable(r+2, c+1)) { + road[idx][0] = r+2; + road[idx][1] = c+1; + idx++; + } + if (isMoveable(r+1, c-2)) { + road[idx][0] = r+1; + road[idx][1] = c-2; + idx++; + } + if (isMoveable(r+1, c+2)) { + road[idx][0] = r+1; + road[idx][1] = c+2; + idx++; + } + + return road; + } + else if (tmp.getType().equals(piecename[1])) { + for (int i = 1; i < 8; i++) { + if(isMoveable(r+i, c+i)) { + road[idx][0] = r+i; + road[idx][1] = c+i; + idx++; + if (!board[r + i][c+i].getType().equals("")) + break; + } + else + break; + } + for (int i = 1; i < 8; i++) { + if(isMoveable(r+i, c-i)) { + road[idx][0] = r+i; + road[idx][1] = c-i; + idx++; + if (!board[r+i][c-i].getType().equals("")) + break; + } + else + break; + } + for (int i = 1; i < 8; i++) { + if(isMoveable(r-i, c+i)) { + road[idx][0] = r-i; + road[idx][1] = c+i; + idx++; + if (!board[r - i][c+i].getType().equals("")) + break; + } + else + break; + } + for (int i = 1; i < 8; i++) { + if(isMoveable(r-i, c-i)) { + road[idx][0] = r-i; + road[idx][1] = c-i; + idx++; + if (!board[r-i][c-i].getType().equals("")) + break; + } + else + break; + } + for (int i = 1; i < 8; i++) { + if(isMoveable(r+i, c)) { + road[idx][0] = r+i; + road[idx][1] = c; + idx++; + if (!board[r + i][c].getType().equals("")) + break; + } + else + break; + } + for (int i = 1; i < 8; i++) { + if(isMoveable(r, c+i)) { + road[idx][0] = r; + road[idx][1] = c+i; + idx++; + if (!board[r][c+i].getType().equals("")) + break; + } + else + break; + } + for (int i = 1; i < 8; i++) { + if(isMoveable(r-i, c)) { + road[idx][0] = r-i; + road[idx][1] = c; + idx++; + if (!board[r - i][c].getType().equals("")) + break; + } + else + break; + } + for (int i = 1; i < 8; i++) { + if(isMoveable(r, c-i)) { + road[idx][0] = r; + road[idx][1] = c-i; + idx++; + if (!board[r][c-i].getType().equals("")) + break; + } + else + break; + } + } + else if (tmp.getType().equals(piecename[2])) { + + for (int i = 1; i < 8; i++) { + if(isMoveable(r+i, c)) { + road[idx][0] = r+i; + road[idx][1] = c; + idx++; + if (!board[r + i][c].getType().equals("")) + break; + } + else + break; + } + for (int i = 1; i < 8; i++) { + if(isMoveable(r, c+i)) { + road[idx][0] = r; + road[idx][1] = c+i; + idx++; + if (!board[r][c+i].getType().equals("")) + break; + } + else + break; + } + for (int i = 1; i < 8; i++) { + if(isMoveable(r-i, c)) { + road[idx][0] = r-i; + road[idx][1] = c; + idx++; + if (!board[r - i][c].getType().equals("")) + break; + } + else + break; + } + for (int i = 1; i < 8; i++) { + if(isMoveable(r, c-i)) { + road[idx][0] = r; + road[idx][1] = c-i; + idx++; + if (!board[r][c-i].getType().equals("")) + break; + } + else + break; + } + } + else if (tmp.getType().equals(piecename[3])) { + for (int i = 1; i < 8; i++) { + if(isMoveable(r+i, c+i)) { + road[idx][0] = r+i; + road[idx][1] = c+i; + idx++; + if (!board[r + i][c+i].getType().equals("")) + break; + } + else + break; + } + for (int i = 1; i < 8; i++) { + if(isMoveable(r+i, c-i)) { + road[idx][0] = r+i; + road[idx][1] = c-i; + idx++; + if (!board[r+i][c-i].getType().equals("")) + break; + } + else + break; + } + for (int i = 1; i < 8; i++) { + if(isMoveable(r-i, c+i)) { + road[idx][0] = r-i; + road[idx][1] = c+i; + idx++; + if (!board[r - i][c+i].getType().equals("")) + break; + } + else + break; + } + for (int i = 1; i < 8; i++) { + if(isMoveable(r-i, c-i)) { + road[idx][0] = r-i; + road[idx][1] = c-i; + idx++; + if (!board[r-i][c-i].getType().equals("")) + break; + } + else + break; + } + } + + else if(tmp.getType().equals(piecename[5])) { + int dr = 0; + int dr2 = 0; + idx = 0; + if (turn == 1) { + if (r == 6) + dr2 = -2; + dr = -1; + } + else if (turn == 2){ + if (r == 1) + dr2 = 2; + dr = 1; + } + if (isMoveable(r+dr, c) && board[r+dr][c].getType().equals("")) { + road[idx][0] = r+dr; + road[idx][1] = c; + idx++; + } + if (dr2 != 0) { + if (isMoveable(r+dr2, c) && board[r+dr2][c].getType().equals("")) { + road[idx][0] = r+dr2; + road[idx][1] = c; + idx++; + } + } + dr2 = 0; + if (isMoveable(r+dr, c-1)) { + if(!board[r+dr][c-1].getType().equals("")){ + + road[idx][0] = r+dr; + road[idx][1] = c-1; + idx++; + } + } + if (isMoveable(r+dr, c+1)) { + if(!board[r+dr][c+1].getType().equals("")) { + road[idx][0] = r+dr; + road[idx][1] = c+1; + idx++; + } + } + } + return road; + } + + public void changeTurn() { + if (turn == 1) { + turn = 2; + } + else if (turn == 2) + turn = 1; + } + public void movePiece(int r1, int c1, int r2, int c2) { + if (board[r2][c2].getType().equals("")) { + board[r2][c2].type = board[r1][c1].getType(); + board[r2][c2].player = board[r1][c1].getPlayerNum(); + board[r1][c1].type = ""; + board[r1][c1].player = 0; + + } + else { + killPiece(board[r2][c2], r2, c2); + board[r2][c2].type = board[r1][c1].getType(); + board[r2][c2].player = board[r1][c1].getPlayerNum(); + board[r1][c1].type = ""; + board[r1][c1].player = 0; + } + for(int i = 0;i < 8;i++) { + for (int j = 0;j < 8;j++) { + if(board[i][j].getType() == "road") + board[i][j].type = ""; + } + } + first++; + if (checkCheckMate(r2, c2)) { + JOptionPane.showMessageDialog(null, "CheckMate!"); + } + changeTurn(); + } + public void killPiece(BoardPiece b, int r, int c) { + if (b.getType().equals("King")) { + gameOver(b); + } + grave.pushGrave(b); + } + public BoardPiece getBoardPiece(int r, int c) { + return board[r][c]; + } + public boolean checkCheckMate(int r, int c) { + int[][] rb; + rb = new int[56][2]; + rb = calRoad(r,c); + for (int i = 0; i < 56; i++) { + if(rb[i][0] >= 0 && rb[i][0] >= 0) { + if (board[rb[i][0]][rb[i][1]].getType().equals("King")) { + return true; + } + } + + } + return false; + } + public void gameOver(BoardPiece b) { + if (b.getPlayerNum() == 1) { + victory = 1; + } + else { + victory = 2; + } + if (victory == 1) + JOptionPane.showMessageDialog(null, p1.getName() + "님 승리하셨습니다."); + else + JOptionPane.showMessageDialog(null, p2.getName() + "님 승리하셨습니다."); + p1.turn = false; + p2.turn = true; + turn = 2; + } + +} diff --git a/src/ChessFrame.java b/src/ChessFrame.java new file mode 100644 index 0000000..ef333d1 --- /dev/null +++ b/src/ChessFrame.java @@ -0,0 +1,172 @@ +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.WindowConstants; +import java.awt.*; +import javax.swing.ImageIcon; +import javax.swing.BoxLayout; + +public class ChessFrame extends JFrame { + private ChessBoard board; + private BoardButton[][] button_board; + private Grave grave; + public int[][] road = new int[56][2]; + public boolean show = true; + public int currow = 0; + public int curcol = 0; + ImageIcon img0 = new ImageIcon("./img/road.png"); + Image im0 = img0.getImage(); + Image updateImg0 = im0.getScaledInstance(40, 40, Image.SCALE_SMOOTH); + ImageIcon canroad = new ImageIcon(updateImg0); + ImageIcon img1 = new ImageIcon("./img/horse1.png"); + Image im1 = img1.getImage(); + Image updateImg1 = im1.getScaledInstance(40, 40, Image.SCALE_SMOOTH); + ImageIcon Knights1 = new ImageIcon(updateImg1); + ImageIcon img2 = new ImageIcon("./img/lock1.png"); + Image im2 = img2.getImage(); + Image updateImg2 = im2.getScaledInstance(40, 40, Image.SCALE_SMOOTH); + ImageIcon Rooks1 = new ImageIcon(updateImg2); + ImageIcon img3 = new ImageIcon("./img/porn1.png"); + Image im3 = img3.getImage(); + Image updateImg3 = im3.getScaledInstance(40, 40, Image.SCALE_SMOOTH); + ImageIcon Pawns1 = new ImageIcon(updateImg3); + ImageIcon img4 = new ImageIcon("./img/bs1.png"); + Image im4 = img4.getImage(); + Image updateImg4 = im4.getScaledInstance(40, 40, Image.SCALE_SMOOTH); + ImageIcon Bishops1 = new ImageIcon(updateImg4); + ImageIcon img5 = new ImageIcon("./img/king1.png"); + Image im5 = img5.getImage(); + Image updateImg5 = im5.getScaledInstance(40, 40, Image.SCALE_SMOOTH); + ImageIcon King1 = new ImageIcon(updateImg5); + ImageIcon img6 = new ImageIcon("./img/queen1.png"); + Image im6 = img6.getImage(); + Image updateImg6 = im6.getScaledInstance(40, 40, Image.SCALE_SMOOTH); + ImageIcon Queen1 = new ImageIcon(updateImg6); + ImageIcon img11 = new ImageIcon("./img/horse2.png"); + Image im11 = img11.getImage(); + Image updateImg11 = im11.getScaledInstance(40, 40, Image.SCALE_SMOOTH); + ImageIcon Knights2 = new ImageIcon(updateImg11); + ImageIcon img22 = new ImageIcon("./img/lock2.png"); + Image im22 = img22.getImage(); + Image updateImg22 = im22.getScaledInstance(40, 40, Image.SCALE_SMOOTH); + ImageIcon Rooks2 = new ImageIcon(updateImg22); + ImageIcon img33 = new ImageIcon("./img/porn2.png"); + Image im33 = img33.getImage(); + Image updateImg33 = im33.getScaledInstance(40, 40, Image.SCALE_SMOOTH); + ImageIcon Pawns2 = new ImageIcon(updateImg33); + ImageIcon img44 = new ImageIcon("./img/bs2.png"); + Image im44 = img44.getImage(); + Image updateImg44 = im44.getScaledInstance(40, 40, Image.SCALE_SMOOTH); + ImageIcon Bishops2 = new ImageIcon(updateImg44); + ImageIcon img55 = new ImageIcon("./img/king2.png"); + Image im55 = img55.getImage(); + Image updateImg55 = im55.getScaledInstance(40, 40, Image.SCALE_SMOOTH); + ImageIcon King2 = new ImageIcon(updateImg55); + ImageIcon img66 = new ImageIcon("./img/queen2.png"); + Image im66 = img66.getImage(); + Image updateImg66 = im66.getScaledInstance(40, 40, Image.SCALE_SMOOTH); + ImageIcon Queen2 = new ImageIcon(updateImg66); + public ChessFrame(ChessBoard b, Grave gv) { + board = b; + grave = gv; + + Color color = new Color(205,133,63); + board = b; + button_board = new BoardButton[8][8]; + Container c = getContentPane(); + JPanel p = new JPanel(new GridLayout(8,8)); + for (int row = 0; row < 8; row++) { + for (int col = 0; col < 8; col++) { + button_board[row][col] = new BoardButton(board,this, row, col); // 버튼에는 색이 안들어감,, + if ((row + col) % 2 == 0) + button_board[row][col].setBackground(color); + p.add(button_board[row][col]); + } + } + + c.add(p,BorderLayout.CENTER); + setTitle("Chess Game"); + setSize(600,600); + setVisible(true); + setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); + update(); + + } + public void showRoad() { + + for(int i = 0;i < 8;i++) { + for(int j = 0;j < 8;j++) { + if(board.getBoardPiece(i, j).getType() == "" || board.getBoardPiece(i, j).getType() == "road" ) + board.board[i][j].type = ""; + } + } + for (int i = 0;i < 56;i++) { + if(road[i][0] + road[i][1] > 0) { + if(board.getBoardPiece(road[i][0], road[i][1]).getType() == "") + board.board[road[i][0]][road[i][1]].type = "road"; + } + } + + } + public void update() { + for (int r = 0;r < 8;r++) { + for (int c = 0;c < 8;c++) { + if (board.getBoardPiece(r, c).getType() == "King") { + if(board.getBoardPiece(r, c).getPlayerNum() == 1) + button_board[r][c].setIcon(King1); + else + button_board[r][c].setIcon(King2); + } + else if (board.getBoardPiece(r, c).getType() == "Queen") { + if(board.getBoardPiece(r, c).getPlayerNum() == 1) + button_board[r][c].setIcon(Queen1); + else + button_board[r][c].setIcon(Queen2); + } + + else if (board.getBoardPiece(r, c).getType() == "Rooks") { + if(board.getBoardPiece(r, c).getPlayerNum() == 1) + button_board[r][c].setIcon(Rooks1); + else + button_board[r][c].setIcon(Rooks2); + } + else if (board.getBoardPiece(r, c).getType() == "Bishops") { + if(board.getBoardPiece(r, c).getPlayerNum() == 1) + button_board[r][c].setIcon(Bishops1); + else + button_board[r][c].setIcon(Bishops2); + } + else if (board.getBoardPiece(r, c).getType() == "Knights") { + if(board.getBoardPiece(r, c).getPlayerNum() == 1) + button_board[r][c].setIcon(Knights1); + else + button_board[r][c].setIcon(Knights2); + } + else if (board.getBoardPiece(r, c).getType() == "Pawns") { + if(board.getBoardPiece(r, c).getPlayerNum() == 1) + button_board[r][c].setIcon(Pawns1); + else + button_board[r][c].setIcon(Pawns2); + } + else if (board.getBoardPiece(r, c).getType() == "road") { + + button_board[r][c].setIcon(canroad); + } + else if (board.getBoardPiece(r, c).getType() == "") + button_board[r][c].setIcon(null); + } + } + if(board.victory != 0) { + int input = JOptionPane.showConfirmDialog(null, "다시 시작하시겠습니까?", "Game over", + JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE); + if (input == 0) { + board.victory = 0; + grave.index1 = 0; + grave.index2 = 0; + board.createBoard(); + update(); + } + } + } +} diff --git a/src/ChessGame.java b/src/ChessGame.java new file mode 100644 index 0000000..0a1600b --- /dev/null +++ b/src/ChessGame.java @@ -0,0 +1,6 @@ +public class ChessGame { + public static void main(String[] args) { + new ChessFrame(new ChessBoard(), new Grave()); + + } +} \ No newline at end of file diff --git a/src/Grave.java b/src/Grave.java new file mode 100644 index 0000000..9686ee4 --- /dev/null +++ b/src/Grave.java @@ -0,0 +1,23 @@ + +public class Grave { + BoardPiece[] p1; + BoardPiece[] p2; + public int index1=0; + public int index2=0; + + public Grave() { + p1 = new BoardPiece[16]; + p2 = new BoardPiece[16]; + } + void pushGrave(BoardPiece b) { + if (b.getPlayerNum() == 1) { + p1[index1] = b; + index1++; + } + else { + p2[index2] = b; + index2++; + } + } + +} diff --git a/src/Player.java b/src/Player.java new file mode 100644 index 0000000..a90f730 --- /dev/null +++ b/src/Player.java @@ -0,0 +1,19 @@ + +public class Player { + public int num; + public boolean turn; + private String name; + + public Player(String x, int n, boolean b){ + name = x; + num = n; + turn = b; + } + + public boolean isTurn() { + return turn; + } + public String getName() { + return name; + } +} diff --git a/README.md b/src/README.md similarity index 100% rename from README.md rename to src/README.md