From 1c1d899a4dc4144e6b8ec93c0afcda09b38b5f6f Mon Sep 17 00:00:00 2001 From: gotty Date: Fri, 19 Apr 2019 04:55:06 +0300 Subject: [PATCH] [LIB-9] Separate chesshog-uci module --- chesshog-uci/pom.xml | 56 ++++++++++++++++++ .../java/org/hedgecode/chess/uci/Acceptor.java | 0 .../org/hedgecode/chess/uci/AcceptorException.java | 0 .../org/hedgecode/chess/uci/AcceptorRunner.java | 0 .../java/org/hedgecode/chess/uci/AcceptorStub.java | 0 .../hedgecode/chess/uci/AcceptorStubRunner.java | 0 .../org/hedgecode/chess/uci/CommandDescriptor.java | 0 .../hedgecode/chess/uci/CommandEnvironment.java | 0 .../org/hedgecode/chess/uci/CommandException.java | 0 .../org/hedgecode/chess/uci/CommandExecutor.java | 0 .../org/hedgecode/chess/uci/ConsoleAcceptor.java | 0 .../hedgecode/chess/uci/ConsoleAcceptorRunner.java | 0 .../java/org/hedgecode/chess/uci/DebugMode.java | 0 .../main/java/org/hedgecode/chess/uci/Engine.java | 0 .../org/hedgecode/chess/uci/EngineException.java | 0 .../java/org/hedgecode/chess/uci/EngineRunner.java | 0 .../org/hedgecode/chess/uci/ExternalEngine.java | 0 .../hedgecode/chess/uci/ExternalEngineRunner.java | 0 .../chess/uci/ExternalEngineTransmitter.java | 0 .../main/java/org/hedgecode/chess/uci/Runner.java | 0 .../hedgecode/chess/uci/SyncCommandExecutor.java | 0 .../java/org/hedgecode/chess/uci/Transmitter.java | 0 .../java/org/hedgecode/chess/uci/UCICommand.java | 0 .../java/org/hedgecode/chess/uci/UCIConstants.java | 4 +- .../hedgecode/chess/uci/annotation/Command.java | 0 .../chess/uci/annotation/CommandDirection.java | 0 .../chess/uci/command/AbstractCommand.java | 0 .../hedgecode/chess/uci/command/CommandParams.java | 0 .../org/hedgecode/chess/uci/command/GoParams.java | 0 .../hedgecode/chess/uci/command/InfoParams.java | 66 ++++++++++++++++++++++ .../java/org/hedgecode/chess/uci/command/Move.java | 0 .../hedgecode/chess/uci/command/OptionParams.java | 0 .../hedgecode/chess/uci/command/OptionType.java | 0 .../chess/uci/command/from/BestMoveCommand.java | 0 .../uci/command/from/CopyProtectionCommand.java | 0 .../chess/uci/command/from/IdCommand.java | 0 .../chess/uci/command/from/InfoCommand.java | 0 .../chess/uci/command/from/OkCommand.java | 0 .../chess/uci/command/from/OptionCommand.java | 0 .../chess/uci/command/from/ReadyOkCommand.java | 0 .../uci/command/from/RegistrationCommand.java | 0 .../chess/uci/command/from/TerminateCommand.java | 0 .../chess/uci/command/to/DebugCommand.java | 0 .../hedgecode/chess/uci/command/to/GoCommand.java | 0 .../chess/uci/command/to/InitCommand.java | 0 .../chess/uci/command/to/IsReadyCommand.java | 0 .../chess/uci/command/to/NewGameCommand.java | 0 .../chess/uci/command/to/PonderHitCommand.java | 0 .../chess/uci/command/to/PositionCommand.java | 0 .../chess/uci/command/to/QuitCommand.java | 0 .../chess/uci/command/to/RegisterCommand.java | 0 .../chess/uci/command/to/SetOptionCommand.java | 0 .../chess/uci/command/to/StopCommand.java | 0 .../hedgecode/chess/uci/LocalStrings.properties | 0 .../hedgecode/chess/uci/LocalStrings_ru.properties | 0 .../chess/uci/command/AbstractCommandTest.java | 63 +++++++++++++++++++++ .../hedgecode/chess/uci/command/InfoParams.java | 27 --------- 57 files changed, 187 insertions(+), 29 deletions(-) create mode 100644 chesshog-uci/pom.xml rename {src => chesshog-uci/src}/main/java/org/hedgecode/chess/uci/Acceptor.java (100%) rename {src => chesshog-uci/src}/main/java/org/hedgecode/chess/uci/AcceptorException.java (100%) rename {src => chesshog-uci/src}/main/java/org/hedgecode/chess/uci/AcceptorRunner.java (100%) rename {src => chesshog-uci/src}/main/java/org/hedgecode/chess/uci/AcceptorStub.java (100%) rename {src => chesshog-uci/src}/main/java/org/hedgecode/chess/uci/AcceptorStubRunner.java (100%) rename {src => chesshog-uci/src}/main/java/org/hedgecode/chess/uci/CommandDescriptor.java (100%) rename {src => chesshog-uci/src}/main/java/org/hedgecode/chess/uci/CommandEnvironment.java (100%) rename {src => chesshog-uci/src}/main/java/org/hedgecode/chess/uci/CommandException.java (100%) rename {src => chesshog-uci/src}/main/java/org/hedgecode/chess/uci/CommandExecutor.java (100%) rename {src => chesshog-uci/src}/main/java/org/hedgecode/chess/uci/ConsoleAcceptor.java (100%) rename {src => chesshog-uci/src}/main/java/org/hedgecode/chess/uci/ConsoleAcceptorRunner.java (100%) rename {src => chesshog-uci/src}/main/java/org/hedgecode/chess/uci/DebugMode.java (100%) rename {src => chesshog-uci/src}/main/java/org/hedgecode/chess/uci/Engine.java (100%) rename {src => chesshog-uci/src}/main/java/org/hedgecode/chess/uci/EngineException.java (100%) rename {src => chesshog-uci/src}/main/java/org/hedgecode/chess/uci/EngineRunner.java (100%) rename {src => chesshog-uci/src}/main/java/org/hedgecode/chess/uci/ExternalEngine.java (100%) rename {src => chesshog-uci/src}/main/java/org/hedgecode/chess/uci/ExternalEngineRunner.java (100%) rename {src => chesshog-uci/src}/main/java/org/hedgecode/chess/uci/ExternalEngineTransmitter.java (100%) rename {src => chesshog-uci/src}/main/java/org/hedgecode/chess/uci/Runner.java (100%) rename {src => chesshog-uci/src}/main/java/org/hedgecode/chess/uci/SyncCommandExecutor.java (100%) rename {src => chesshog-uci/src}/main/java/org/hedgecode/chess/uci/Transmitter.java (100%) rename {src => chesshog-uci/src}/main/java/org/hedgecode/chess/uci/UCICommand.java (100%) rename {src => chesshog-uci/src}/main/java/org/hedgecode/chess/uci/UCIConstants.java (95%) rename {src => chesshog-uci/src}/main/java/org/hedgecode/chess/uci/annotation/Command.java (100%) rename {src => chesshog-uci/src}/main/java/org/hedgecode/chess/uci/annotation/CommandDirection.java (100%) rename {src => chesshog-uci/src}/main/java/org/hedgecode/chess/uci/command/AbstractCommand.java (100%) rename {src => chesshog-uci/src}/main/java/org/hedgecode/chess/uci/command/CommandParams.java (100%) rename {src => chesshog-uci/src}/main/java/org/hedgecode/chess/uci/command/GoParams.java (100%) create mode 100644 chesshog-uci/src/main/java/org/hedgecode/chess/uci/command/InfoParams.java rename {src => chesshog-uci/src}/main/java/org/hedgecode/chess/uci/command/Move.java (100%) rename {src => chesshog-uci/src}/main/java/org/hedgecode/chess/uci/command/OptionParams.java (100%) rename {src => chesshog-uci/src}/main/java/org/hedgecode/chess/uci/command/OptionType.java (100%) rename {src => chesshog-uci/src}/main/java/org/hedgecode/chess/uci/command/from/BestMoveCommand.java (100%) rename {src => chesshog-uci/src}/main/java/org/hedgecode/chess/uci/command/from/CopyProtectionCommand.java (100%) rename {src => chesshog-uci/src}/main/java/org/hedgecode/chess/uci/command/from/IdCommand.java (100%) rename {src => chesshog-uci/src}/main/java/org/hedgecode/chess/uci/command/from/InfoCommand.java (100%) rename {src => chesshog-uci/src}/main/java/org/hedgecode/chess/uci/command/from/OkCommand.java (100%) rename {src => chesshog-uci/src}/main/java/org/hedgecode/chess/uci/command/from/OptionCommand.java (100%) rename {src => chesshog-uci/src}/main/java/org/hedgecode/chess/uci/command/from/ReadyOkCommand.java (100%) rename {src => chesshog-uci/src}/main/java/org/hedgecode/chess/uci/command/from/RegistrationCommand.java (100%) rename {src => chesshog-uci/src}/main/java/org/hedgecode/chess/uci/command/from/TerminateCommand.java (100%) rename {src => chesshog-uci/src}/main/java/org/hedgecode/chess/uci/command/to/DebugCommand.java (100%) rename {src => chesshog-uci/src}/main/java/org/hedgecode/chess/uci/command/to/GoCommand.java (100%) rename {src => chesshog-uci/src}/main/java/org/hedgecode/chess/uci/command/to/InitCommand.java (100%) rename {src => chesshog-uci/src}/main/java/org/hedgecode/chess/uci/command/to/IsReadyCommand.java (100%) rename {src => chesshog-uci/src}/main/java/org/hedgecode/chess/uci/command/to/NewGameCommand.java (100%) rename {src => chesshog-uci/src}/main/java/org/hedgecode/chess/uci/command/to/PonderHitCommand.java (100%) rename {src => chesshog-uci/src}/main/java/org/hedgecode/chess/uci/command/to/PositionCommand.java (100%) rename {src => chesshog-uci/src}/main/java/org/hedgecode/chess/uci/command/to/QuitCommand.java (100%) rename {src => chesshog-uci/src}/main/java/org/hedgecode/chess/uci/command/to/RegisterCommand.java (100%) rename {src => chesshog-uci/src}/main/java/org/hedgecode/chess/uci/command/to/SetOptionCommand.java (100%) rename {src => chesshog-uci/src}/main/java/org/hedgecode/chess/uci/command/to/StopCommand.java (100%) rename {src => chesshog-uci/src}/main/resources/org/hedgecode/chess/uci/LocalStrings.properties (100%) rename {src => chesshog-uci/src}/main/resources/org/hedgecode/chess/uci/LocalStrings_ru.properties (100%) create mode 100644 chesshog-uci/src/test/java/org/hedgecode/chess/uci/command/AbstractCommandTest.java delete mode 100644 src/main/java/org/hedgecode/chess/uci/command/InfoParams.java diff --git a/chesshog-uci/pom.xml b/chesshog-uci/pom.xml new file mode 100644 index 0000000..09bcb27 --- /dev/null +++ b/chesshog-uci/pom.xml @@ -0,0 +1,56 @@ + + + + + + 4.0.0 + + + org.hedgecode.chess + chesshog + 0.1-SNAPSHOT + + + chesshog-uci + 0.1-SNAPSHOT + jar + + Hedgecode ChessHog UCI + + Hedgecode ChessHog UCI Module. + + + + 0.1-SNAPSHOT + + + + + org.hedgecode.chess + chesshog + ${chessHogVersion} + + + org.hedgecode.chess + chesshog-core + ${chessHogVersion} + + + + \ No newline at end of file diff --git a/src/main/java/org/hedgecode/chess/uci/Acceptor.java b/chesshog-uci/src/main/java/org/hedgecode/chess/uci/Acceptor.java similarity index 100% rename from src/main/java/org/hedgecode/chess/uci/Acceptor.java rename to chesshog-uci/src/main/java/org/hedgecode/chess/uci/Acceptor.java diff --git a/src/main/java/org/hedgecode/chess/uci/AcceptorException.java b/chesshog-uci/src/main/java/org/hedgecode/chess/uci/AcceptorException.java similarity index 100% rename from src/main/java/org/hedgecode/chess/uci/AcceptorException.java rename to chesshog-uci/src/main/java/org/hedgecode/chess/uci/AcceptorException.java diff --git a/src/main/java/org/hedgecode/chess/uci/AcceptorRunner.java b/chesshog-uci/src/main/java/org/hedgecode/chess/uci/AcceptorRunner.java similarity index 100% rename from src/main/java/org/hedgecode/chess/uci/AcceptorRunner.java rename to chesshog-uci/src/main/java/org/hedgecode/chess/uci/AcceptorRunner.java diff --git a/src/main/java/org/hedgecode/chess/uci/AcceptorStub.java b/chesshog-uci/src/main/java/org/hedgecode/chess/uci/AcceptorStub.java similarity index 100% rename from src/main/java/org/hedgecode/chess/uci/AcceptorStub.java rename to chesshog-uci/src/main/java/org/hedgecode/chess/uci/AcceptorStub.java diff --git a/src/main/java/org/hedgecode/chess/uci/AcceptorStubRunner.java b/chesshog-uci/src/main/java/org/hedgecode/chess/uci/AcceptorStubRunner.java similarity index 100% rename from src/main/java/org/hedgecode/chess/uci/AcceptorStubRunner.java rename to chesshog-uci/src/main/java/org/hedgecode/chess/uci/AcceptorStubRunner.java diff --git a/src/main/java/org/hedgecode/chess/uci/CommandDescriptor.java b/chesshog-uci/src/main/java/org/hedgecode/chess/uci/CommandDescriptor.java similarity index 100% rename from src/main/java/org/hedgecode/chess/uci/CommandDescriptor.java rename to chesshog-uci/src/main/java/org/hedgecode/chess/uci/CommandDescriptor.java diff --git a/src/main/java/org/hedgecode/chess/uci/CommandEnvironment.java b/chesshog-uci/src/main/java/org/hedgecode/chess/uci/CommandEnvironment.java similarity index 100% rename from src/main/java/org/hedgecode/chess/uci/CommandEnvironment.java rename to chesshog-uci/src/main/java/org/hedgecode/chess/uci/CommandEnvironment.java diff --git a/src/main/java/org/hedgecode/chess/uci/CommandException.java b/chesshog-uci/src/main/java/org/hedgecode/chess/uci/CommandException.java similarity index 100% rename from src/main/java/org/hedgecode/chess/uci/CommandException.java rename to chesshog-uci/src/main/java/org/hedgecode/chess/uci/CommandException.java diff --git a/src/main/java/org/hedgecode/chess/uci/CommandExecutor.java b/chesshog-uci/src/main/java/org/hedgecode/chess/uci/CommandExecutor.java similarity index 100% rename from src/main/java/org/hedgecode/chess/uci/CommandExecutor.java rename to chesshog-uci/src/main/java/org/hedgecode/chess/uci/CommandExecutor.java diff --git a/src/main/java/org/hedgecode/chess/uci/ConsoleAcceptor.java b/chesshog-uci/src/main/java/org/hedgecode/chess/uci/ConsoleAcceptor.java similarity index 100% rename from src/main/java/org/hedgecode/chess/uci/ConsoleAcceptor.java rename to chesshog-uci/src/main/java/org/hedgecode/chess/uci/ConsoleAcceptor.java diff --git a/src/main/java/org/hedgecode/chess/uci/ConsoleAcceptorRunner.java b/chesshog-uci/src/main/java/org/hedgecode/chess/uci/ConsoleAcceptorRunner.java similarity index 100% rename from src/main/java/org/hedgecode/chess/uci/ConsoleAcceptorRunner.java rename to chesshog-uci/src/main/java/org/hedgecode/chess/uci/ConsoleAcceptorRunner.java diff --git a/src/main/java/org/hedgecode/chess/uci/DebugMode.java b/chesshog-uci/src/main/java/org/hedgecode/chess/uci/DebugMode.java similarity index 100% rename from src/main/java/org/hedgecode/chess/uci/DebugMode.java rename to chesshog-uci/src/main/java/org/hedgecode/chess/uci/DebugMode.java diff --git a/src/main/java/org/hedgecode/chess/uci/Engine.java b/chesshog-uci/src/main/java/org/hedgecode/chess/uci/Engine.java similarity index 100% rename from src/main/java/org/hedgecode/chess/uci/Engine.java rename to chesshog-uci/src/main/java/org/hedgecode/chess/uci/Engine.java diff --git a/src/main/java/org/hedgecode/chess/uci/EngineException.java b/chesshog-uci/src/main/java/org/hedgecode/chess/uci/EngineException.java similarity index 100% rename from src/main/java/org/hedgecode/chess/uci/EngineException.java rename to chesshog-uci/src/main/java/org/hedgecode/chess/uci/EngineException.java diff --git a/src/main/java/org/hedgecode/chess/uci/EngineRunner.java b/chesshog-uci/src/main/java/org/hedgecode/chess/uci/EngineRunner.java similarity index 100% rename from src/main/java/org/hedgecode/chess/uci/EngineRunner.java rename to chesshog-uci/src/main/java/org/hedgecode/chess/uci/EngineRunner.java diff --git a/src/main/java/org/hedgecode/chess/uci/ExternalEngine.java b/chesshog-uci/src/main/java/org/hedgecode/chess/uci/ExternalEngine.java similarity index 100% rename from src/main/java/org/hedgecode/chess/uci/ExternalEngine.java rename to chesshog-uci/src/main/java/org/hedgecode/chess/uci/ExternalEngine.java diff --git a/src/main/java/org/hedgecode/chess/uci/ExternalEngineRunner.java b/chesshog-uci/src/main/java/org/hedgecode/chess/uci/ExternalEngineRunner.java similarity index 100% rename from src/main/java/org/hedgecode/chess/uci/ExternalEngineRunner.java rename to chesshog-uci/src/main/java/org/hedgecode/chess/uci/ExternalEngineRunner.java diff --git a/src/main/java/org/hedgecode/chess/uci/ExternalEngineTransmitter.java b/chesshog-uci/src/main/java/org/hedgecode/chess/uci/ExternalEngineTransmitter.java similarity index 100% rename from src/main/java/org/hedgecode/chess/uci/ExternalEngineTransmitter.java rename to chesshog-uci/src/main/java/org/hedgecode/chess/uci/ExternalEngineTransmitter.java diff --git a/src/main/java/org/hedgecode/chess/uci/Runner.java b/chesshog-uci/src/main/java/org/hedgecode/chess/uci/Runner.java similarity index 100% rename from src/main/java/org/hedgecode/chess/uci/Runner.java rename to chesshog-uci/src/main/java/org/hedgecode/chess/uci/Runner.java diff --git a/src/main/java/org/hedgecode/chess/uci/SyncCommandExecutor.java b/chesshog-uci/src/main/java/org/hedgecode/chess/uci/SyncCommandExecutor.java similarity index 100% rename from src/main/java/org/hedgecode/chess/uci/SyncCommandExecutor.java rename to chesshog-uci/src/main/java/org/hedgecode/chess/uci/SyncCommandExecutor.java diff --git a/src/main/java/org/hedgecode/chess/uci/Transmitter.java b/chesshog-uci/src/main/java/org/hedgecode/chess/uci/Transmitter.java similarity index 100% rename from src/main/java/org/hedgecode/chess/uci/Transmitter.java rename to chesshog-uci/src/main/java/org/hedgecode/chess/uci/Transmitter.java diff --git a/src/main/java/org/hedgecode/chess/uci/UCICommand.java b/chesshog-uci/src/main/java/org/hedgecode/chess/uci/UCICommand.java similarity index 100% rename from src/main/java/org/hedgecode/chess/uci/UCICommand.java rename to chesshog-uci/src/main/java/org/hedgecode/chess/uci/UCICommand.java diff --git a/src/main/java/org/hedgecode/chess/uci/UCIConstants.java b/chesshog-uci/src/main/java/org/hedgecode/chess/uci/UCIConstants.java similarity index 95% rename from src/main/java/org/hedgecode/chess/uci/UCIConstants.java rename to chesshog-uci/src/main/java/org/hedgecode/chess/uci/UCIConstants.java index e8e1bfc..1fb5004 100644 --- a/src/main/java/org/hedgecode/chess/uci/UCIConstants.java +++ b/chesshog-uci/src/main/java/org/hedgecode/chess/uci/UCIConstants.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018. Developed by Hedgecode. + * Copyright (c) 2018-2019. Developed by Hedgecode. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -58,7 +58,7 @@ public final class UCIConstants { private UCIConstants() { throw new AssertionError( - "No org.hedgecode.chess.uci.UCIConstants instances!" + "No UCIConstants instances!" ); } diff --git a/src/main/java/org/hedgecode/chess/uci/annotation/Command.java b/chesshog-uci/src/main/java/org/hedgecode/chess/uci/annotation/Command.java similarity index 100% rename from src/main/java/org/hedgecode/chess/uci/annotation/Command.java rename to chesshog-uci/src/main/java/org/hedgecode/chess/uci/annotation/Command.java diff --git a/src/main/java/org/hedgecode/chess/uci/annotation/CommandDirection.java b/chesshog-uci/src/main/java/org/hedgecode/chess/uci/annotation/CommandDirection.java similarity index 100% rename from src/main/java/org/hedgecode/chess/uci/annotation/CommandDirection.java rename to chesshog-uci/src/main/java/org/hedgecode/chess/uci/annotation/CommandDirection.java diff --git a/src/main/java/org/hedgecode/chess/uci/command/AbstractCommand.java b/chesshog-uci/src/main/java/org/hedgecode/chess/uci/command/AbstractCommand.java similarity index 100% rename from src/main/java/org/hedgecode/chess/uci/command/AbstractCommand.java rename to chesshog-uci/src/main/java/org/hedgecode/chess/uci/command/AbstractCommand.java diff --git a/src/main/java/org/hedgecode/chess/uci/command/CommandParams.java b/chesshog-uci/src/main/java/org/hedgecode/chess/uci/command/CommandParams.java similarity index 100% rename from src/main/java/org/hedgecode/chess/uci/command/CommandParams.java rename to chesshog-uci/src/main/java/org/hedgecode/chess/uci/command/CommandParams.java diff --git a/src/main/java/org/hedgecode/chess/uci/command/GoParams.java b/chesshog-uci/src/main/java/org/hedgecode/chess/uci/command/GoParams.java similarity index 100% rename from src/main/java/org/hedgecode/chess/uci/command/GoParams.java rename to chesshog-uci/src/main/java/org/hedgecode/chess/uci/command/GoParams.java diff --git a/chesshog-uci/src/main/java/org/hedgecode/chess/uci/command/InfoParams.java b/chesshog-uci/src/main/java/org/hedgecode/chess/uci/command/InfoParams.java new file mode 100644 index 0000000..da3c5d8 --- /dev/null +++ b/chesshog-uci/src/main/java/org/hedgecode/chess/uci/command/InfoParams.java @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2018. Developed by Hedgecode. + * + * 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 + * + * http://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. + */ + +package org.hedgecode.chess.uci.command; + +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * Container class for values of UCI command "info". + * + * @author Dmitry Samoshin aka gotty + */ +public final class InfoParams { + + + private static final Pattern INFO_PATTERN = + Pattern.compile( + String.format("^\\s*%s(.*)%s\\s+(%s)(.*)$" /*, ... */ ) + ); + + private InfoParams() { + + } + +/* + + depth|seldepth|time|nodes|pv|multipv|score...|currmove|currmovenumber|hashfull|nps + tbhits|sbhits|cpuload|string|refutation|currline + +*/ + + + public static final class Factory { + + public static InfoParams parse(String option) { + Matcher matcher = INFO_PATTERN.matcher(option); + if (matcher.find()) { +/* + return new InfoParams( + matcher.group(1).trim(), + matcher.group(2).trim(), + matcher.group(3).trim() + ); +*/ + } + return null; + } + + } + + +} diff --git a/src/main/java/org/hedgecode/chess/uci/command/Move.java b/chesshog-uci/src/main/java/org/hedgecode/chess/uci/command/Move.java similarity index 100% rename from src/main/java/org/hedgecode/chess/uci/command/Move.java rename to chesshog-uci/src/main/java/org/hedgecode/chess/uci/command/Move.java diff --git a/src/main/java/org/hedgecode/chess/uci/command/OptionParams.java b/chesshog-uci/src/main/java/org/hedgecode/chess/uci/command/OptionParams.java similarity index 100% rename from src/main/java/org/hedgecode/chess/uci/command/OptionParams.java rename to chesshog-uci/src/main/java/org/hedgecode/chess/uci/command/OptionParams.java diff --git a/src/main/java/org/hedgecode/chess/uci/command/OptionType.java b/chesshog-uci/src/main/java/org/hedgecode/chess/uci/command/OptionType.java similarity index 100% rename from src/main/java/org/hedgecode/chess/uci/command/OptionType.java rename to chesshog-uci/src/main/java/org/hedgecode/chess/uci/command/OptionType.java diff --git a/src/main/java/org/hedgecode/chess/uci/command/from/BestMoveCommand.java b/chesshog-uci/src/main/java/org/hedgecode/chess/uci/command/from/BestMoveCommand.java similarity index 100% rename from src/main/java/org/hedgecode/chess/uci/command/from/BestMoveCommand.java rename to chesshog-uci/src/main/java/org/hedgecode/chess/uci/command/from/BestMoveCommand.java diff --git a/src/main/java/org/hedgecode/chess/uci/command/from/CopyProtectionCommand.java b/chesshog-uci/src/main/java/org/hedgecode/chess/uci/command/from/CopyProtectionCommand.java similarity index 100% rename from src/main/java/org/hedgecode/chess/uci/command/from/CopyProtectionCommand.java rename to chesshog-uci/src/main/java/org/hedgecode/chess/uci/command/from/CopyProtectionCommand.java diff --git a/src/main/java/org/hedgecode/chess/uci/command/from/IdCommand.java b/chesshog-uci/src/main/java/org/hedgecode/chess/uci/command/from/IdCommand.java similarity index 100% rename from src/main/java/org/hedgecode/chess/uci/command/from/IdCommand.java rename to chesshog-uci/src/main/java/org/hedgecode/chess/uci/command/from/IdCommand.java diff --git a/src/main/java/org/hedgecode/chess/uci/command/from/InfoCommand.java b/chesshog-uci/src/main/java/org/hedgecode/chess/uci/command/from/InfoCommand.java similarity index 100% rename from src/main/java/org/hedgecode/chess/uci/command/from/InfoCommand.java rename to chesshog-uci/src/main/java/org/hedgecode/chess/uci/command/from/InfoCommand.java diff --git a/src/main/java/org/hedgecode/chess/uci/command/from/OkCommand.java b/chesshog-uci/src/main/java/org/hedgecode/chess/uci/command/from/OkCommand.java similarity index 100% rename from src/main/java/org/hedgecode/chess/uci/command/from/OkCommand.java rename to chesshog-uci/src/main/java/org/hedgecode/chess/uci/command/from/OkCommand.java diff --git a/src/main/java/org/hedgecode/chess/uci/command/from/OptionCommand.java b/chesshog-uci/src/main/java/org/hedgecode/chess/uci/command/from/OptionCommand.java similarity index 100% rename from src/main/java/org/hedgecode/chess/uci/command/from/OptionCommand.java rename to chesshog-uci/src/main/java/org/hedgecode/chess/uci/command/from/OptionCommand.java diff --git a/src/main/java/org/hedgecode/chess/uci/command/from/ReadyOkCommand.java b/chesshog-uci/src/main/java/org/hedgecode/chess/uci/command/from/ReadyOkCommand.java similarity index 100% rename from src/main/java/org/hedgecode/chess/uci/command/from/ReadyOkCommand.java rename to chesshog-uci/src/main/java/org/hedgecode/chess/uci/command/from/ReadyOkCommand.java diff --git a/src/main/java/org/hedgecode/chess/uci/command/from/RegistrationCommand.java b/chesshog-uci/src/main/java/org/hedgecode/chess/uci/command/from/RegistrationCommand.java similarity index 100% rename from src/main/java/org/hedgecode/chess/uci/command/from/RegistrationCommand.java rename to chesshog-uci/src/main/java/org/hedgecode/chess/uci/command/from/RegistrationCommand.java diff --git a/src/main/java/org/hedgecode/chess/uci/command/from/TerminateCommand.java b/chesshog-uci/src/main/java/org/hedgecode/chess/uci/command/from/TerminateCommand.java similarity index 100% rename from src/main/java/org/hedgecode/chess/uci/command/from/TerminateCommand.java rename to chesshog-uci/src/main/java/org/hedgecode/chess/uci/command/from/TerminateCommand.java diff --git a/src/main/java/org/hedgecode/chess/uci/command/to/DebugCommand.java b/chesshog-uci/src/main/java/org/hedgecode/chess/uci/command/to/DebugCommand.java similarity index 100% rename from src/main/java/org/hedgecode/chess/uci/command/to/DebugCommand.java rename to chesshog-uci/src/main/java/org/hedgecode/chess/uci/command/to/DebugCommand.java diff --git a/src/main/java/org/hedgecode/chess/uci/command/to/GoCommand.java b/chesshog-uci/src/main/java/org/hedgecode/chess/uci/command/to/GoCommand.java similarity index 100% rename from src/main/java/org/hedgecode/chess/uci/command/to/GoCommand.java rename to chesshog-uci/src/main/java/org/hedgecode/chess/uci/command/to/GoCommand.java diff --git a/src/main/java/org/hedgecode/chess/uci/command/to/InitCommand.java b/chesshog-uci/src/main/java/org/hedgecode/chess/uci/command/to/InitCommand.java similarity index 100% rename from src/main/java/org/hedgecode/chess/uci/command/to/InitCommand.java rename to chesshog-uci/src/main/java/org/hedgecode/chess/uci/command/to/InitCommand.java diff --git a/src/main/java/org/hedgecode/chess/uci/command/to/IsReadyCommand.java b/chesshog-uci/src/main/java/org/hedgecode/chess/uci/command/to/IsReadyCommand.java similarity index 100% rename from src/main/java/org/hedgecode/chess/uci/command/to/IsReadyCommand.java rename to chesshog-uci/src/main/java/org/hedgecode/chess/uci/command/to/IsReadyCommand.java diff --git a/src/main/java/org/hedgecode/chess/uci/command/to/NewGameCommand.java b/chesshog-uci/src/main/java/org/hedgecode/chess/uci/command/to/NewGameCommand.java similarity index 100% rename from src/main/java/org/hedgecode/chess/uci/command/to/NewGameCommand.java rename to chesshog-uci/src/main/java/org/hedgecode/chess/uci/command/to/NewGameCommand.java diff --git a/src/main/java/org/hedgecode/chess/uci/command/to/PonderHitCommand.java b/chesshog-uci/src/main/java/org/hedgecode/chess/uci/command/to/PonderHitCommand.java similarity index 100% rename from src/main/java/org/hedgecode/chess/uci/command/to/PonderHitCommand.java rename to chesshog-uci/src/main/java/org/hedgecode/chess/uci/command/to/PonderHitCommand.java diff --git a/src/main/java/org/hedgecode/chess/uci/command/to/PositionCommand.java b/chesshog-uci/src/main/java/org/hedgecode/chess/uci/command/to/PositionCommand.java similarity index 100% rename from src/main/java/org/hedgecode/chess/uci/command/to/PositionCommand.java rename to chesshog-uci/src/main/java/org/hedgecode/chess/uci/command/to/PositionCommand.java diff --git a/src/main/java/org/hedgecode/chess/uci/command/to/QuitCommand.java b/chesshog-uci/src/main/java/org/hedgecode/chess/uci/command/to/QuitCommand.java similarity index 100% rename from src/main/java/org/hedgecode/chess/uci/command/to/QuitCommand.java rename to chesshog-uci/src/main/java/org/hedgecode/chess/uci/command/to/QuitCommand.java diff --git a/src/main/java/org/hedgecode/chess/uci/command/to/RegisterCommand.java b/chesshog-uci/src/main/java/org/hedgecode/chess/uci/command/to/RegisterCommand.java similarity index 100% rename from src/main/java/org/hedgecode/chess/uci/command/to/RegisterCommand.java rename to chesshog-uci/src/main/java/org/hedgecode/chess/uci/command/to/RegisterCommand.java diff --git a/src/main/java/org/hedgecode/chess/uci/command/to/SetOptionCommand.java b/chesshog-uci/src/main/java/org/hedgecode/chess/uci/command/to/SetOptionCommand.java similarity index 100% rename from src/main/java/org/hedgecode/chess/uci/command/to/SetOptionCommand.java rename to chesshog-uci/src/main/java/org/hedgecode/chess/uci/command/to/SetOptionCommand.java diff --git a/src/main/java/org/hedgecode/chess/uci/command/to/StopCommand.java b/chesshog-uci/src/main/java/org/hedgecode/chess/uci/command/to/StopCommand.java similarity index 100% rename from src/main/java/org/hedgecode/chess/uci/command/to/StopCommand.java rename to chesshog-uci/src/main/java/org/hedgecode/chess/uci/command/to/StopCommand.java diff --git a/src/main/resources/org/hedgecode/chess/uci/LocalStrings.properties b/chesshog-uci/src/main/resources/org/hedgecode/chess/uci/LocalStrings.properties similarity index 100% rename from src/main/resources/org/hedgecode/chess/uci/LocalStrings.properties rename to chesshog-uci/src/main/resources/org/hedgecode/chess/uci/LocalStrings.properties diff --git a/src/main/resources/org/hedgecode/chess/uci/LocalStrings_ru.properties b/chesshog-uci/src/main/resources/org/hedgecode/chess/uci/LocalStrings_ru.properties similarity index 100% rename from src/main/resources/org/hedgecode/chess/uci/LocalStrings_ru.properties rename to chesshog-uci/src/main/resources/org/hedgecode/chess/uci/LocalStrings_ru.properties diff --git a/chesshog-uci/src/test/java/org/hedgecode/chess/uci/command/AbstractCommandTest.java b/chesshog-uci/src/test/java/org/hedgecode/chess/uci/command/AbstractCommandTest.java new file mode 100644 index 0000000..3ca6fd5 --- /dev/null +++ b/chesshog-uci/src/test/java/org/hedgecode/chess/uci/command/AbstractCommandTest.java @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2018-2019. Developed by Hedgecode. + * + * 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 + * + * http://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. + */ + +package org.hedgecode.chess.uci.command; + +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; + +import org.hedgecode.chess.uci.Acceptor; +import org.hedgecode.chess.uci.Engine; + +/** + * Tests for {@link AbstractCommand}. + * + * @author Dmitry Samoshin aka gotty + */ +@RunWith(JUnit4.class) +public class AbstractCommandTest extends Assert { + + @Test + public void testParseMove() throws Exception { + + String[] correctMoves = {"e2e4", "e7e5", "e1g1", "e7e8q", "0000"}; + for (String correctMove : correctMoves) { + Move move = new AbstractCommand() { + @Override + public void exec(Engine engine, Acceptor acceptor, String params) { + throw new RuntimeException("Don't supported in test class!"); + } + }.parseMove(correctMove); + + assertNotNull(move); + } + + String[] incorrectMoves = {"00e2", "e0e5", "e1j1", "a1a9", "e7e8k"}; + for (String incorrectMove : incorrectMoves) { + Move move = new AbstractCommand() { + @Override + public void exec(Engine engine, Acceptor acceptor, String params) { + throw new RuntimeException("Don't supported in test class!"); + } + }.parseMove(incorrectMove); + + assertNull(move); + } + } + +} \ No newline at end of file diff --git a/src/main/java/org/hedgecode/chess/uci/command/InfoParams.java b/src/main/java/org/hedgecode/chess/uci/command/InfoParams.java deleted file mode 100644 index c4d67d4..0000000 --- a/src/main/java/org/hedgecode/chess/uci/command/InfoParams.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2018. Developed by Hedgecode. - * - * 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 - * - * http://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. - */ - -package org.hedgecode.chess.uci.command; - -/** - * Container class for values of UCI command "info". - * - * @author Dmitry Samoshin aka gotty - */ -public final class InfoParams { - - -} -- 2.10.0