Compare commits
25 Commits
3be8e2170b
...
Menu_Featu
Author | SHA1 | Date | |
---|---|---|---|
|
9fb66b6755 | ||
6127e4cf37 | |||
|
8636bcfb0c | ||
|
b4c2f84ea0 | ||
|
c9f83c396f | ||
|
5a77578699 | ||
|
0fbe762391 | ||
|
85d22b4736 | ||
|
d1286469c3 | ||
|
de0cbf5a8b | ||
|
e24ebcfc0b | ||
c335ec2b7e | |||
1a6e52d52a
|
|||
2c8e62fef0
|
|||
6042e71c2d
|
|||
|
ccc955d0cb
|
||
|
8f64897bf6
|
||
|
69052504cc
|
||
|
a791970935
|
||
|
1c6baca895
|
||
|
06706ff640
|
||
|
f4bc9d371b
|
||
|
c1aff353b3
|
||
|
074cbef775
|
||
|
c7cb4b3fcb
|
8
.idea/.gitignore
generated
vendored
Normal file
8
.idea/.gitignore
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# Editor-based HTTP Client requests
|
||||||
|
/httpRequests/
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
2
.idea/TurboSchach.iml
generated
Normal file
2
.idea/TurboSchach.iml
generated
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module classpath="CIDR" type="CPP_MODULE" version="4" />
|
580
.idea/editor.xml
generated
Normal file
580
.idea/editor.xml
generated
Normal file
@@ -0,0 +1,580 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="BackendCodeEditorSettings">
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppClangFormat/EnableClangFormatSupport/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/EditorConfig/EnableClangFormatSupport/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_BINARY_EXPRESSIONS_CHAIN/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_CALLS_CHAIN/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_EXPRESSION/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_FOR_STMT/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTIPLE_DECLARATION/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_TERNARY/@EntryValue" value="ALIGN_ALL" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BLANK_LINES_AROUND_CLASS_DEFINITION/@EntryValue" value="1" type="int" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/KEEP_BLANK_LINES_IN_DECLARATIONS/@EntryValue" value="2" type="int" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/KEEP_BLANK_LINES_IN_CODE/@EntryValue" value="2" type="int" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/KEEP_USER_LINEBREAKS/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_CASE_FROM_SWITCH/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_COMMENT/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INT_ALIGN_EQ/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SIMPLE_BLOCK_STYLE/@EntryValue" value="DO_NOT_CHANGE" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_COMMA_IN_TEMPLATE_ARGS/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_COMMA_IN_TEMPLATE_PARAMS/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_FOR_SEMICOLON/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_FOR_SEMICOLON/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_UNARY_OPERATOR/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_ARRAY_ACCESS_BRACKETS/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_CAST_EXPRESSION_PARENTHESES/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_EMPTY_INITIALIZER_BRACES/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_EMPTY_METHOD_PARENTHESES/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_INITIALIZER_BRACES/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPECIAL_ELSE_IF_TREATMENT/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_CAST_EXPRESSION_PARENTHESES/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_AFTER_BINARY_OPSIGN/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_TERNARY_OPSIGNS/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/TYPE_DECLARATION_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/OTHER_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/CASE_BLOCK_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BLANK_LINES_AROUND_FUNCTION_DECLARATION/@EntryValue" value="1" type="int" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BLANK_LINES_AROUND_FUNCTION_DEFINITION/@EntryValue" value="1" type="int" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/PLACE_WHILE_ON_NEW_LINE/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/PLACE_ELSE_ON_NEW_LINE/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/PLACE_CATCH_ON_NEW_LINE/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/NAMESPACE_INDENTATION/@EntryValue" value="All" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_ARGUMENT/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_EXTENDS_LIST/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_PARAMETER/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_TYPE_ARGUMENT/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_TYPE_PARAMETER/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BLANK_LINES_AROUND_DECLARATIONS/@EntryValue" value="0" type="int" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_ACCESS_SPECIFIERS_FROM_CLASS/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_CLASS_MEMBERS_FROM_ACCESS_SPECIFIERS/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/LINE_BREAK_AFTER_COLON_IN_MEMBER_INITIALIZER_LISTS/@EntryValue" value="ON_SINGLE_LINE" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/MEMBER_INITIALIZER_LIST_STYLE/@EntryValue" value="DO_NOT_CHANGE" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/PLACE_NAMESPACE_DEFINITIONS_ON_SAME_LINE/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_COLON_IN_BITFIELD_DECLARATOR/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_COLON_IN_BITFIELD_DECLARATOR/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_EXTENDS_COLON/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_EXTENDS_COLON/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_FOR_COLON/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_FOR_COLON/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_PTR_IN_DATA_MEMBER/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_PTR_IN_DATA_MEMBERS/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_PTR_IN_METHOD/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_PTR_IN_NESTED_DECLARATOR/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_REF_IN_DATA_MEMBER/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_REF_IN_DATA_MEMBERS/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_REF_IN_METHOD/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_PTR_IN_ABSTRACT_DECL/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_PTR_IN_DATA_MEMBER/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_PTR_IN_DATA_MEMBERS/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_PTR_IN_METHOD/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_REF_IN_ABSTRACT_DECL/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_REF_IN_DATA_MEMBER/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_REF_IN_DATA_MEMBERS/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_REF_IN_METHOD/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_TEMPLATE_ARGS/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_TEMPLATE_PARAMS/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BETWEEN_CLOSING_ANGLE_BRACKETS_IN_TEMPLATE_ARGS/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_EMPTY_TEMPLATE_PARAMS/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_TEMPLATE_ARGS/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_TEMPLATE_PARAMS/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_DECLARATION_PARENTHESES/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_EMPTY_BLOCKS/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_INVOCATION_LPAR/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_AFTER_INVOCATION_LPAR/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_INVOCATION_RPAR/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_DECLARATION_LPAR/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_AFTER_DECLARATION_LPAR/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_DECLARATION_RPAR/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_ARGUMENTS_STYLE/@EntryValue" value="WRAP_IF_LONG" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_PARAMETERS_STYLE/@EntryValue" value="WRAP_IF_LONG" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BREAK_TEMPLATE_DECLARATION/@EntryValue" value="LINE_BREAK" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/NAMESPACE_DECLARATION_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/FREE_BLOCK_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INVOCABLE_DECLARATION_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ANONYMOUS_METHOD_DECLARATION_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INITIALIZER_BRACES/@EntryValue" value="END_OF_LINE_NO_SPACE" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_STYLE/@EntryValue" value="Space" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_SIZE/@EntryValue" value="4" type="int" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/CONTINUOUS_LINE_INDENT/@EntryValue" value="Double" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/TAB_WIDTH/@EntryValue" value="4" type="int" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppSmartPointerVsMakeFunction/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppCStyleCast/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFunctionalStyleCast/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppReinterpretCastFromVoidPtr/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonExplicitConvertingConstructor/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonExplicitConversionOperator/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDiscardedPostfixOperatorResult/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppConstValueFunctionReturnType/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMemberFunctionMayBeConst/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMemberFunctionMayBeStatic/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLocalVariableMayBeConst/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppParameterMayBeConst/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppVariableCanBeMadeConstexpr/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppParameterMayBeConstPtrOrRef/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPassValueParameterByConstReference/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppThrowExpressionCanBeReplacedWithRethrow/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppZeroConstantCanBeReplacedWithNullptr/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppCompileTimeConstantCanBeReplacedWithBooleanConstant/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIfCanBeReplacedByConstexprIf/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=IfStdIsConstantEvaluatedCanBeReplaced/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=StdIsConstantEvaluatedWillAlwaysEvaluateToConstant/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=ConstevalIfIsAlwaysConstant/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClassCanBeFinal/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseStructuredBinding/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseTypeTraitAlias/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseAlgorithmWithCount/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseRangeAlgorithm/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseElementsView/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseStdSize/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppForLoopCanBeReplacedWithWhile/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppJoinDeclarationAndAssignment/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppReplaceTieWithStructuredBinding/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppReplaceMemsetWithZeroInitialization/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseAssociativeContains/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseEraseAlgorithm/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseFamiliarTemplateSyntaxForGenericLambdas/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTooWideScope/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTooWideScopeInitStatement/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantNamespaceDefinition/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonInlineFunctionDefinitionInHeaderFile/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonInlineVariableDefinitionInHeaderFile/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFunctionIsNotImplemented/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrivateSpecialMemberFunctionIsNotImplemented/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppHiddenFunction/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppHidingFunction/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPolymorphicClassWithNonVirtualPublicDestructor/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAbstractClassWithoutSpecifier/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIncompleteSwitchStatement/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDefaultCaseNotHandledInSwitchStatement/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPossiblyErroneousEmptyStatements/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppExpressionWithoutSideEffects/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNoDiscardExpression/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFunctionResultShouldBeUsed/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMissingKeywordThrow/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDependentTypeWithoutTypenameKeyword/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDependentTemplateWithoutTemplateKeyword/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppImplicitDefaultConstructorNotAvailable/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClassNeedsConstructorBecauseOfUninitializedMember/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUninitializedNonStaticDataMember/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRangeBasedForIncompatibleReference/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppZeroValuedExpressionUsedAsNullPointer/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPossiblyUnintendedObjectSlicing/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPossiblyUninitializedMember/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclaratorDisambiguatedAsFunction/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppVirtualFunctionInFinalClass/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMustBePublicVirtualToImplementInterface/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclarationSpecifierWithoutDeclarators/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEmptyDeclaration/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclarationHidesLocal/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclarationHidesUncapturedLocal/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMismatchedClassTags/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUsingResultOfAssignmentAsCondition/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIntegralToPointerConversion/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPointerToIntegralConversion/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIncompatiblePointerConversion/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPointerConversionDropsQualifiers/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppStringLiteralToCharPointerConversion/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonExceptionSafeResourceAcquisition/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppVirtualFunctionCallInsideCtor/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAbstractVirtualFunctionCallInCtor/@EntryIndexedValue" value="ERROR" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppInvalidLineContinuation/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrintfBadFormat/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrintfRiskyFormat/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrintfMissedArg/@EntryIndexedValue" value="ERROR" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrintfExtraArg/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatBadCode/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatLegacyCode/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatMixedArgs/@EntryIndexedValue" value="ERROR" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatTooFewArgs/@EntryIndexedValue" value="ERROR" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatTooManyArgs/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeprecatedEntity/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMissingIncludeGuard/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDoxygenSyntaxError/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDoxygenUnresolvedReference/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDoxygenUndocumentedParameter/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeletingVoidPointer/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBooleanIncrementExpression/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeprecatedRegisterStorageClassSpecifier/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIdenticalOperandsInBinaryExpression/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEqualOperandsInBinaryExpression/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedefinitionOfDefaultArgumentInOverrideFunction/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnnamedNamespaceInHeaderFile/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppParameterNamesMismatch/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDefaultedSpecialMemberFunctionIsImplicitlyDeleted/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNodiscardFunctionWithoutReturnValue/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantComplexityInComparison/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAbstractFinalClass/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppSpecialFunctionWithoutNoexceptSpecification/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnsignedZeroComparison/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMultiCharacterLiteral/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMultiCharacterWideLiteral/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantQualifier/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantAccessSpecifier/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAccessSpecifierWithNoDeclarations/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantTypenameKeyword/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantTemplateKeyword/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantElseKeyword/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantElseKeywordInsideCompoundStatement/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantControlFlowJump/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantEmptyStatement/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantEmptyDeclaration/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantParentheses/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantLambdaParameterList/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantCastExpression/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppHeaderHasBeenAlreadyIncluded/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTemplateArgumentsCanBeDeduced/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantTemplateArguments/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppStaticSpecifierOnAnonymousNamespaceMember/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantStaticSpecifierOnMemberAllocationFunction/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantStaticSpecifierOnThreadLocalLocalVariable/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantBaseClassAccessSpecifier/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantInlineSpecifier/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantConstSpecifier/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantBooleanExpressionArgument/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantVoidArgumentList/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantMemberInitializer/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantBaseClassInitializer/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppConstParameterInDeclaration/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppVolatileParameterInDeclaration/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFinalFunctionInFinalClass/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFinalNonOverridingVirtualFunction/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantElaboratedTypeSpecifier/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantDereferencingAndTakingAddress/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantConditionalExpression/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppConditionalExpressionCanBeSimplified/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantExportKeyword/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantZeroInitializerInAggregateInitialization/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUserDefinedLiteralSuffixDoesNotStartWithUnderscore/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClassIsIncomplete/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTemplateParameterShadowing/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMutableSpecifierOnReferenceMember/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDefaultInitializationWithNoUserConstructor/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppExplicitSpecializationInNonNamespaceScope/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnionMemberOfReferenceType/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUninitializedDependentBaseClass/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrecompiledHeaderIsNotIncluded/@EntryIndexedValue" value="ERROR" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrecompiledHeaderNotFound/@EntryIndexedValue" value="ERROR" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppCoroutineCallResolveError/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAwaiterTypeIsNotClass/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppOutParameterMustBeWritten/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppWarningDirective/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppStaticAssertFailure/@EntryIndexedValue" value="ERROR" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEvaluationFailure/@EntryIndexedValue" value="ERROR" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclaratorNeverUsed/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTypeAliasNeverUsed/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppConceptNeverUsed/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClassNeverUsed/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnumeratorNeverUsed/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLambdaCaptureNeverUsed/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLocalVariableWithNonTrivialDtorIsNeverUsed/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppParameterNeverUsed/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTemplateParameterNeverUsed/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEntityAssignedButNoRead/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEntityUsedOnlyInUnevaluatedContext/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLocalVariableMightNotBeInitialized/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppObjectMemberMightNotBeInitialized/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppSomeObjectMembersMightNotBeInitialized/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclaratorUsedBeforeInitialization/@EntryIndexedValue" value="ERROR" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnusedIncludeDirective/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNotAllPathsReturnValue/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CDeclarationWithImplicitIntType/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFunctionDoesntReturnValue/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppReturnNoValueInNonVoidFunction/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppCVQualifierCanNotBeAppliedToReference/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDereferenceOperatorLimitExceeded/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppForwardEnumDeclarationWithoutUnderlyingType/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnmatchedPragmaRegionDirective/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnmatchedPragmaEndRegionDirective/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppStaticDataMemberInUnnamedStruct/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDefaultIsUsedAsIdentifier/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLongFloat/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtReinterpretCastFromNullptr/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtBindingRValueToLvalueReference/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtAddressOfClassRValue/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtDoubleUserConversionInCopyInit/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtCopyElisionInCopyInitDeclarator/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtNotInitializedStaticConstLocalVar/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRemoveRedundantBraces/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceIfStatementBraces/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceForStatementBraces/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceWhileStatementBraces/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceDoStatementBraces/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppWrongIncludesOrder/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppWrongSlashesInIncludeDirective/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceNestedNamespacesStyle/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceTypeAliasCodeStyle/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceFunctionDeclarationStyle/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMemberInitializersOrder/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceOverridingFunctionStyle/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceOverridingDestructorStyle/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseAuto/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseAutoForNumeric/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceCVQualifiersPlacement/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceCVQualifiersOrder/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnnecessaryWhitespace/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTabsAreDisallowed/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAConstantConditions/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFANullDereference/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFANotInitializedField/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFALoopConditionNotUpdated/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFADeletedPointer/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAMemoryLeak/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAInvalidatedMemory/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFALocalValueEscapesScope/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFALocalValueEscapesFunction/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAConstantParameter/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAConstantFunctionResult/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAArrayIndexOutOfBounds/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAUnreachableCode/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAUnreachableFunctionCall/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAEndlessLoop/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAInfiniteRecursion/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAUnusedValue/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAUnreadVariable/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFATimeOver/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppInconsistentNaming/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=StringLiteralTypo/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CommentTypo/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=IdentifierTypo/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppSmartPointerVsMakeFunction/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppCStyleCast/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFunctionalStyleCast/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppReinterpretCastFromVoidPtr/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonExplicitConvertingConstructor/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonExplicitConversionOperator/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDiscardedPostfixOperatorResult/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppConstValueFunctionReturnType/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMemberFunctionMayBeConst/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMemberFunctionMayBeStatic/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLocalVariableMayBeConst/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppParameterMayBeConst/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppVariableCanBeMadeConstexpr/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppParameterMayBeConstPtrOrRef/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPassValueParameterByConstReference/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppThrowExpressionCanBeReplacedWithRethrow/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppZeroConstantCanBeReplacedWithNullptr/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppCompileTimeConstantCanBeReplacedWithBooleanConstant/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIfCanBeReplacedByConstexprIf/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=IfStdIsConstantEvaluatedCanBeReplaced/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=StdIsConstantEvaluatedWillAlwaysEvaluateToConstant/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=ConstevalIfIsAlwaysConstant/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClassCanBeFinal/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseStructuredBinding/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseTypeTraitAlias/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseAlgorithmWithCount/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseRangeAlgorithm/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseElementsView/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseStdSize/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppForLoopCanBeReplacedWithWhile/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppJoinDeclarationAndAssignment/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppReplaceTieWithStructuredBinding/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppReplaceMemsetWithZeroInitialization/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseAssociativeContains/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseEraseAlgorithm/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseFamiliarTemplateSyntaxForGenericLambdas/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTooWideScope/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTooWideScopeInitStatement/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantNamespaceDefinition/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonInlineFunctionDefinitionInHeaderFile/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonInlineVariableDefinitionInHeaderFile/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFunctionIsNotImplemented/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrivateSpecialMemberFunctionIsNotImplemented/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppHiddenFunction/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppHidingFunction/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPolymorphicClassWithNonVirtualPublicDestructor/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAbstractClassWithoutSpecifier/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIncompleteSwitchStatement/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDefaultCaseNotHandledInSwitchStatement/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPossiblyErroneousEmptyStatements/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppExpressionWithoutSideEffects/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNoDiscardExpression/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFunctionResultShouldBeUsed/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMissingKeywordThrow/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDependentTypeWithoutTypenameKeyword/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDependentTemplateWithoutTemplateKeyword/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppImplicitDefaultConstructorNotAvailable/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClassNeedsConstructorBecauseOfUninitializedMember/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUninitializedNonStaticDataMember/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRangeBasedForIncompatibleReference/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppZeroValuedExpressionUsedAsNullPointer/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPossiblyUnintendedObjectSlicing/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPossiblyUninitializedMember/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclaratorDisambiguatedAsFunction/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppVirtualFunctionInFinalClass/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMustBePublicVirtualToImplementInterface/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclarationSpecifierWithoutDeclarators/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEmptyDeclaration/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclarationHidesLocal/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclarationHidesUncapturedLocal/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMismatchedClassTags/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUsingResultOfAssignmentAsCondition/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIntegralToPointerConversion/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPointerToIntegralConversion/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIncompatiblePointerConversion/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPointerConversionDropsQualifiers/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppStringLiteralToCharPointerConversion/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonExceptionSafeResourceAcquisition/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppVirtualFunctionCallInsideCtor/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAbstractVirtualFunctionCallInCtor/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppInvalidLineContinuation/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrintfBadFormat/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrintfRiskyFormat/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrintfMissedArg/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrintfExtraArg/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatBadCode/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatLegacyCode/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatMixedArgs/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatTooFewArgs/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatTooManyArgs/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeprecatedEntity/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMissingIncludeGuard/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDoxygenSyntaxError/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDoxygenUnresolvedReference/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDoxygenUndocumentedParameter/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeletingVoidPointer/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBooleanIncrementExpression/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeprecatedRegisterStorageClassSpecifier/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIdenticalOperandsInBinaryExpression/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEqualOperandsInBinaryExpression/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedefinitionOfDefaultArgumentInOverrideFunction/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnnamedNamespaceInHeaderFile/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppParameterNamesMismatch/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDefaultedSpecialMemberFunctionIsImplicitlyDeleted/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNodiscardFunctionWithoutReturnValue/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantComplexityInComparison/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAbstractFinalClass/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppSpecialFunctionWithoutNoexceptSpecification/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnsignedZeroComparison/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMultiCharacterLiteral/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMultiCharacterWideLiteral/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantQualifier/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantAccessSpecifier/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAccessSpecifierWithNoDeclarations/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantTypenameKeyword/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantTemplateKeyword/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantElseKeyword/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantElseKeywordInsideCompoundStatement/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantControlFlowJump/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantEmptyStatement/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantEmptyDeclaration/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantParentheses/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantLambdaParameterList/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantCastExpression/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppHeaderHasBeenAlreadyIncluded/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTemplateArgumentsCanBeDeduced/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantTemplateArguments/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppStaticSpecifierOnAnonymousNamespaceMember/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantStaticSpecifierOnMemberAllocationFunction/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantStaticSpecifierOnThreadLocalLocalVariable/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantBaseClassAccessSpecifier/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantInlineSpecifier/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantConstSpecifier/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantBooleanExpressionArgument/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantVoidArgumentList/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantMemberInitializer/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantBaseClassInitializer/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppConstParameterInDeclaration/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppVolatileParameterInDeclaration/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFinalFunctionInFinalClass/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFinalNonOverridingVirtualFunction/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantElaboratedTypeSpecifier/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantDereferencingAndTakingAddress/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantConditionalExpression/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppConditionalExpressionCanBeSimplified/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantExportKeyword/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantZeroInitializerInAggregateInitialization/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUserDefinedLiteralSuffixDoesNotStartWithUnderscore/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClassIsIncomplete/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTemplateParameterShadowing/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMutableSpecifierOnReferenceMember/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDefaultInitializationWithNoUserConstructor/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppExplicitSpecializationInNonNamespaceScope/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnionMemberOfReferenceType/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUninitializedDependentBaseClass/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrecompiledHeaderIsNotIncluded/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrecompiledHeaderNotFound/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppCoroutineCallResolveError/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAwaiterTypeIsNotClass/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppOutParameterMustBeWritten/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppWarningDirective/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppStaticAssertFailure/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEvaluationFailure/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclaratorNeverUsed/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTypeAliasNeverUsed/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppConceptNeverUsed/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClassNeverUsed/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnumeratorNeverUsed/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLambdaCaptureNeverUsed/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLocalVariableWithNonTrivialDtorIsNeverUsed/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppParameterNeverUsed/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTemplateParameterNeverUsed/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEntityAssignedButNoRead/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEntityUsedOnlyInUnevaluatedContext/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLocalVariableMightNotBeInitialized/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppObjectMemberMightNotBeInitialized/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppSomeObjectMembersMightNotBeInitialized/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclaratorUsedBeforeInitialization/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnusedIncludeDirective/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNotAllPathsReturnValue/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CDeclarationWithImplicitIntType/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFunctionDoesntReturnValue/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppReturnNoValueInNonVoidFunction/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppCVQualifierCanNotBeAppliedToReference/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDereferenceOperatorLimitExceeded/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppForwardEnumDeclarationWithoutUnderlyingType/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnmatchedPragmaRegionDirective/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnmatchedPragmaEndRegionDirective/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppStaticDataMemberInUnnamedStruct/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDefaultIsUsedAsIdentifier/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLongFloat/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtReinterpretCastFromNullptr/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtBindingRValueToLvalueReference/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtAddressOfClassRValue/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtDoubleUserConversionInCopyInit/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtCopyElisionInCopyInitDeclarator/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtNotInitializedStaticConstLocalVar/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRemoveRedundantBraces/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceIfStatementBraces/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceForStatementBraces/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceWhileStatementBraces/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceDoStatementBraces/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppWrongIncludesOrder/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppWrongSlashesInIncludeDirective/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceNestedNamespacesStyle/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceTypeAliasCodeStyle/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceFunctionDeclarationStyle/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMemberInitializersOrder/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceOverridingFunctionStyle/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceOverridingDestructorStyle/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseAuto/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseAutoForNumeric/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceCVQualifiersPlacement/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceCVQualifiersOrder/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnnecessaryWhitespace/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTabsAreDisallowed/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAConstantConditions/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFANullDereference/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFANotInitializedField/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFALoopConditionNotUpdated/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFADeletedPointer/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAMemoryLeak/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAInvalidatedMemory/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFALocalValueEscapesScope/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFALocalValueEscapesFunction/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAConstantParameter/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAConstantFunctionResult/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAArrayIndexOutOfBounds/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAUnreachableCode/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAUnreachableFunctionCall/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAEndlessLoop/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAInfiniteRecursion/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAUnusedValue/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAUnreadVariable/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFATimeOver/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppInconsistentNaming/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=StringLiteralTypo/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CommentTypo/@EntryIndexRemoved" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=IdentifierTypo/@EntryIndexRemoved" />
|
||||||
|
</component>
|
||||||
|
</project>
|
8
.idea/modules.xml
generated
Normal file
8
.idea/modules.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/TurboSchach.iml" filepath="$PROJECT_DIR$/.idea/TurboSchach.iml" />
|
||||||
|
</modules>
|
||||||
|
</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="" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
@@ -1,31 +1,24 @@
|
|||||||
#include "Bishop.hpp"
|
#include "Bishop.hpp"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new bishop with a specified color and position.
|
||||||
|
* @param color The color of the bishop.
|
||||||
|
* @param position The position of the bishop.
|
||||||
|
*/
|
||||||
Bishop::Bishop(ChessPieceColor color, ChessPiecePosition position) : ChessPiece(color, position) {
|
Bishop::Bishop(ChessPieceColor color, ChessPiecePosition position) : ChessPiece(color, position) {
|
||||||
|
this->_char = this->_CHAR_BISHOP;
|
||||||
|
this->_unicode = {"\u265D", "\u2657"};
|
||||||
}
|
}
|
||||||
|
|
||||||
char Bishop::GetAlgebraicNotationSymbol() {
|
/**
|
||||||
return 'B';
|
* Gets all chess piece positions the bishop can move next.
|
||||||
}
|
* It is also possible to ignore several chess pieces while the next positions are calculated.
|
||||||
|
* @param chessboard A pointer to the chessboard.
|
||||||
|
* @param ignore A set of chess piece positions to be ignored.
|
||||||
|
* @return A set of chess piece positions the bishop can move next.
|
||||||
|
*/
|
||||||
|
std::set<ChessPiecePosition> Bishop::GetNextPositions(Chessboard* chessboard, std::set<ChessPiecePosition> ignore) {
|
||||||
|
|
||||||
std::string Bishop::GetCharUnicode() {
|
// 3.2. The bishop may move to any square along a diagonal on which it stands.
|
||||||
return Bishop::GetCharUnicode(this->GetColor());
|
return this->GetDiagonalPositions(chessboard, ignore);
|
||||||
}
|
|
||||||
|
|
||||||
std::string Bishop::GetCharUnicode(ChessPieceColor color) {
|
|
||||||
switch (color) {
|
|
||||||
case ChessPieceColor::Black:
|
|
||||||
return "\u265D";
|
|
||||||
case ChessPieceColor::White:
|
|
||||||
return "\u2657";
|
|
||||||
default:
|
|
||||||
return "\0";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Bishop::UpdateNextPositions(Chessboard* chessboard) {
|
|
||||||
std::set<ChessPiecePosition> vertical = Bishop::GetVerticalMoves(chessboard);
|
|
||||||
std::set<ChessPiecePosition> positions;
|
|
||||||
positions.insert(vertical.begin(), vertical.end());
|
|
||||||
this->SetNextPositions(positions);
|
|
||||||
}
|
}
|
||||||
|
@@ -6,10 +6,7 @@
|
|||||||
class Bishop : public ChessPiece {
|
class Bishop : public ChessPiece {
|
||||||
public:
|
public:
|
||||||
Bishop(ChessPieceColor color, ChessPiecePosition position);
|
Bishop(ChessPieceColor color, ChessPiecePosition position);
|
||||||
char GetAlgebraicNotationSymbol();
|
std::set<ChessPiecePosition> GetNextPositions(Chessboard* chessboard, std::set<ChessPiecePosition> ignore = {});
|
||||||
std::string GetCharUnicode();
|
|
||||||
static std::string GetCharUnicode(ChessPieceColor color);
|
|
||||||
void UpdateNextPositions(Chessboard* chessboard);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -1,207 +1,307 @@
|
|||||||
#include "ChessPiece.hpp"
|
#include "../ChessPieces/ChessPiece.hpp"
|
||||||
#include "../Chessboard/Chessboard.hpp"
|
#include "../Chessboard/Chessboard.hpp"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new chess piece with a specific color and position.
|
||||||
|
* @param color The color of the chess piece.
|
||||||
|
* @param position The position of the chess piece.
|
||||||
|
*/
|
||||||
ChessPiece::ChessPiece(ChessPieceColor color, ChessPiecePosition position) {
|
ChessPiece::ChessPiece(ChessPieceColor color, ChessPiecePosition position) {
|
||||||
this->color = color;
|
this->SetColor(color);
|
||||||
this->SetPosition(position);
|
this->SetPosition(position);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the char symbol of the chess piece.
|
||||||
|
* @return The char symbol of the chess piece.
|
||||||
|
*/
|
||||||
|
char ChessPiece::GetChar() {
|
||||||
|
return this->_char;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the color of the chess piece.
|
||||||
|
* @return The color of the chess piece.
|
||||||
|
*/
|
||||||
ChessPieceColor ChessPiece::GetColor() {
|
ChessPieceColor ChessPiece::GetColor() {
|
||||||
return this->color;
|
return this->_color;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ChessPiece::GetColorName() {
|
/**
|
||||||
switch (this->GetColor()) {
|
* Gets a set of all positions along the diagonal.
|
||||||
case ChessPieceColor::Black: return "Black";
|
* @param chessboard A pointer to the chessboard.
|
||||||
case ChessPieceColor::White: return "White";
|
* @param ignore A set if chess piece positions to be ignored.
|
||||||
default: return "\0";
|
* @return A set of all positions along the diagonal.
|
||||||
|
*/
|
||||||
|
std::set<ChessPiecePosition> ChessPiece::GetDiagonalPositions(Chessboard* chessboard, std::set<ChessPiecePosition> ignore) {
|
||||||
|
std::set<ChessPiecePosition> positions;
|
||||||
|
ChessPiecePosition currentPosition = this->GetPosition();
|
||||||
|
|
||||||
|
for (std::string direction : {"T1L1", "T1R1", "B1L1", "B1R1"}) {
|
||||||
|
ChessPiecePosition* nextPosition = ¤tPosition;
|
||||||
|
|
||||||
|
while (nextPosition = nextPosition->NextFromString(direction)) {
|
||||||
|
if (chessboard->IsEmptyField(nextPosition) || ignore.count(*nextPosition) == 1) {
|
||||||
|
|
||||||
|
// 3.5. When making these moves, the bishop, rook or queen may not move over any intervening pieces.
|
||||||
|
positions.insert(*nextPosition);
|
||||||
|
} else {
|
||||||
|
ChessPiece* chessPiece = chessboard->GetChessPiece(nextPosition);
|
||||||
|
|
||||||
|
// 3.1. It is not permitted to move a piece to a square occupied by a piece of the same colour.
|
||||||
|
// 3.1.1. If a piece moves to a square occupied by an opponent's piece the latter is captured and removed from the chessboard as part of the same move.
|
||||||
|
if (chessPiece && chessPiece->GetColor() != this->GetColor()) {
|
||||||
|
positions.insert(*nextPosition);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return positions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a set of all positions along the file.
|
||||||
|
* @param chessboard A pointer to the chessboard.
|
||||||
|
* @param ignore A set if chess piece positions to be ignored.
|
||||||
|
* @return A set of all positions along the file.
|
||||||
|
*/
|
||||||
|
std::set<ChessPiecePosition> ChessPiece::GetFilePositions(Chessboard* chessboard, std::set<ChessPiecePosition> ignore) {
|
||||||
|
std::set<ChessPiecePosition> positions;
|
||||||
|
ChessPiecePosition currentPosition = this->GetPosition();
|
||||||
|
|
||||||
|
for (std::string direction : {"T1", "B1"}) {
|
||||||
|
ChessPiecePosition* nextPosition = ¤tPosition;
|
||||||
|
|
||||||
|
while (nextPosition = nextPosition->NextFromString(direction)) {
|
||||||
|
if (chessboard->IsEmptyField(nextPosition) || ignore.count(*nextPosition) == 1) {
|
||||||
|
|
||||||
|
// 3.5. When making these moves, the bishop, rook or queen may not move over any intervening pieces.
|
||||||
|
positions.insert(*nextPosition);
|
||||||
|
} else {
|
||||||
|
ChessPiece* chessPiece = chessboard->GetChessPiece(nextPosition);
|
||||||
|
|
||||||
|
// 3.1. It is not permitted to move a piece to a square occupied by a piece of the same colour.
|
||||||
|
// 3.1.1. If a piece moves to a square occupied by an opponent's piece the latter is captured and removed from the chessboard as part of the same move.
|
||||||
|
if (chessPiece && chessPiece->GetColor() != this->GetColor()) {
|
||||||
|
positions.insert(*nextPosition);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return positions;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a set of all positions the chess piece can move next.
|
||||||
|
* @return A set of all positions the chess piece can move next.
|
||||||
|
*/
|
||||||
|
std::set<ChessPiecePosition> ChessPiece::GetNextPositions() {
|
||||||
|
return this->_positions_next;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the number of moves of the chess piece.
|
||||||
|
* @return The number of moves of the chess piece.
|
||||||
|
*/
|
||||||
|
int ChessPiece::GetNumberOfMoves() {
|
||||||
|
int positions = this->_positions.size();
|
||||||
|
return (positions < 2) ? 0 : positions - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the position of the chess piece.
|
||||||
|
* @return The position of the chess piece.
|
||||||
|
* @throws std::out_of_range Thrown if the history of positions was not initialized properly.
|
||||||
|
*/
|
||||||
ChessPiecePosition ChessPiece::GetPosition() {
|
ChessPiecePosition ChessPiece::GetPosition() {
|
||||||
if (this->positions.empty() == false) {
|
if (this->_positions.empty() == false) {
|
||||||
return this->positions.back();
|
return this->_positions.back();
|
||||||
} else {
|
} else {
|
||||||
throw std::out_of_range("history was not initialized properly.");
|
throw std::out_of_range("history was not initialized properly.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a set of all positions along the rank.
|
||||||
|
* @param chessboard A pointer to the chessboard.
|
||||||
|
* @param ignore A set if chess piece positions to be ignored.
|
||||||
|
* @return A set of all positions along the rank.
|
||||||
|
*/
|
||||||
|
std::set<ChessPiecePosition> ChessPiece::GetRankPositions(Chessboard* chessboard, std::set<ChessPiecePosition> ignore) {
|
||||||
|
std::set<ChessPiecePosition> positions;
|
||||||
|
ChessPiecePosition currentPosition = this->GetPosition();
|
||||||
|
|
||||||
|
for (std::string direction : {"L1", "R1"}) {
|
||||||
|
ChessPiecePosition* nextPosition = ¤tPosition;
|
||||||
|
|
||||||
|
while (nextPosition = nextPosition->NextFromString(direction)) {
|
||||||
|
if (chessboard->IsEmptyField(nextPosition) || ignore.count(*nextPosition) == 1) {
|
||||||
|
|
||||||
|
// 3.5. When making these moves, the bishop, rook or queen may not move over any intervening pieces.
|
||||||
|
positions.insert(*nextPosition);
|
||||||
|
} else {
|
||||||
|
ChessPiece* chessPiece = chessboard->GetChessPiece(nextPosition);
|
||||||
|
|
||||||
|
// 3.1. It is not permitted to move a piece to a square occupied by a piece of the same colour.
|
||||||
|
// 3.1.1. If a piece moves to a square occupied by an opponent's piece the latter is captured and removed from the chessboard as part of the same move.
|
||||||
|
if (chessPiece && chessPiece->GetColor() != this->GetColor()) {
|
||||||
|
positions.insert(*nextPosition);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return positions;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the unicode symbol of the chess piece depending on the internal color.
|
||||||
|
* @return The unicode symbol of the chess piece.
|
||||||
|
*/
|
||||||
|
std::string ChessPiece::GetUnicode() {
|
||||||
|
return this->GetUnicode(this->GetColor());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the unicode symbol of the chess piece depending on the given color.
|
||||||
|
* @param color The color of the chess piece.
|
||||||
|
* @return The unicode symbol of the chess piece.
|
||||||
|
*/
|
||||||
|
std::string ChessPiece::GetUnicode(ChessPieceColor color) {
|
||||||
|
if (color == ChessPieceColor::Black) {
|
||||||
|
return std::get<ChessPieceColor::Black>(this->_unicode);
|
||||||
|
} else {
|
||||||
|
return std::get<ChessPieceColor::White>(this->_unicode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Status whether the chess piece is a bishop.
|
||||||
|
* @return Status whether the chess piece is a bishop.
|
||||||
|
*/
|
||||||
|
bool ChessPiece::IsBishop() {
|
||||||
|
return this->GetChar() == this->_CHAR_BISHOP;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Status whether the chess piece can still be moved the first time.
|
||||||
|
* @return Status whether the chess piece can still be moved the first time.
|
||||||
|
*/
|
||||||
bool ChessPiece::IsFirstMove() {
|
bool ChessPiece::IsFirstMove() {
|
||||||
return (this->positions.size() == 1);
|
return this->_positions.size() == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChessPiece::SetPosition(ChessPiecePosition position) {
|
/**
|
||||||
this->positions.push_back(position);
|
* Status whether the chess piece is a king.
|
||||||
|
* @return Status whether the chess piece is a king.
|
||||||
|
*/
|
||||||
|
bool ChessPiece::IsKing() {
|
||||||
|
return this->GetChar() == this->_CHAR_KING;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::set<ChessPiecePosition> ChessPiece::GetVerticalMoves(Chessboard* chessboard) {
|
/**
|
||||||
std::set<ChessPiecePosition> positions;
|
* Status whether the chess piece is a knight.
|
||||||
|
* @return Status whether the chess piece is a knight.
|
||||||
|
*/
|
||||||
ChessPiecePosition currentPosition = this->GetPosition();
|
bool ChessPiece::IsKnight() {
|
||||||
positions.insert(currentPosition);
|
return this->GetChar() == this->_CHAR_KNIGHT;
|
||||||
|
|
||||||
ChessPiecePosition* nextPosition = ¤tPosition;
|
|
||||||
|
|
||||||
while (nextPosition = nextPosition->NextTop()) {
|
|
||||||
if (chessboard->IsEmptyField(nextPosition)) {
|
|
||||||
positions.insert(*nextPosition);
|
|
||||||
} else {
|
|
||||||
ChessPiece* chessPiece = chessboard->GetChessPiece(nextPosition);
|
|
||||||
|
|
||||||
if (chessPiece->GetColor() == this->GetColor()) {
|
|
||||||
// Eigene Figur
|
|
||||||
} else {
|
|
||||||
positions.insert(*nextPosition); // Figur des Gegners
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
nextPosition = ¤tPosition;
|
|
||||||
while (nextPosition = nextPosition->NextBottom()) {
|
|
||||||
if (chessboard->IsEmptyField(nextPosition)) {
|
|
||||||
positions.insert(*nextPosition);
|
|
||||||
} else {
|
|
||||||
ChessPiece* chessPiece = chessboard->GetChessPiece(nextPosition);
|
|
||||||
|
|
||||||
if (chessPiece->GetColor() == this->GetColor()) {
|
|
||||||
// Eigene Figur
|
|
||||||
} else {
|
|
||||||
positions.insert(*nextPosition); // Figur des Gegners
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return positions;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::set<ChessPiecePosition> ChessPiece::GetHorizontalMoves(Chessboard* chessboard) {
|
/**
|
||||||
std::set<ChessPiecePosition> positions;
|
* Status whether the chess piece is a pawn.
|
||||||
|
* @return Status whether the chess piece is a pawn.
|
||||||
ChessPiecePosition currentPosition = this->GetPosition();
|
*/
|
||||||
positions.insert(currentPosition);
|
bool ChessPiece::IsPawn() {
|
||||||
|
return this->GetChar() == this->_CHAR_PAWN;
|
||||||
ChessPiecePosition* nextPosition = ¤tPosition;
|
|
||||||
|
|
||||||
while (nextPosition = nextPosition->NextLeft()) {
|
|
||||||
if (chessboard->IsEmptyField(nextPosition)) {
|
|
||||||
positions.insert(*nextPosition);
|
|
||||||
} else {
|
|
||||||
ChessPiece* chessPiece = chessboard->GetChessPiece(nextPosition);
|
|
||||||
|
|
||||||
if (chessPiece->GetColor() == this->GetColor()) {
|
|
||||||
// Eigene Figur
|
|
||||||
} else {
|
|
||||||
positions.insert(*nextPosition); // Figur des Gegners
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
nextPosition = ¤tPosition;
|
|
||||||
while (nextPosition = nextPosition->NextRight()) {
|
|
||||||
if (chessboard->IsEmptyField(nextPosition)) {
|
|
||||||
positions.insert(*nextPosition);
|
|
||||||
} else {
|
|
||||||
ChessPiece* chessPiece = chessboard->GetChessPiece(nextPosition);
|
|
||||||
|
|
||||||
if (chessPiece->GetColor() == this->GetColor()) {
|
|
||||||
// Eigene Figur
|
|
||||||
} else {
|
|
||||||
positions.insert(*nextPosition); // Figur des Gegners
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return positions;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::set<ChessPiecePosition> ChessPiece::GetDiagonalMoves(Chessboard* chessboard) {
|
/**
|
||||||
std::set<ChessPiecePosition> positions;
|
* Status whether the chess piece is a protective chess piece for the king.
|
||||||
|
* Any movement of a protective chess piece would lead to a checkmate.
|
||||||
|
* @param chessboard A pointer to the chessboard.
|
||||||
|
* @return Status whether the chess piece is a protective chess piece for the king.
|
||||||
|
*/
|
||||||
|
bool ChessPiece::IsProtective(Chessboard* chessboard) {
|
||||||
|
|
||||||
ChessPiecePosition currentPosition = this->GetPosition();
|
if (this->IsKing()) {
|
||||||
positions.insert(currentPosition);
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
ChessPiecePosition* nextPosition = ¤tPosition;
|
ChessPiece* chessPieceKing = chessboard->GetChessPieceKing(this->GetColor());
|
||||||
|
|
||||||
while (nextPosition = nextPosition->NextTopLeft()) {
|
// A chess piece is a protective chess piece if the chess piece exposes the king to an enemy chess piece after any movement.
|
||||||
if (chessboard->IsEmptyField(nextPosition)) {
|
// So we get all chess piece positions of the opponents chess pieces with and without the current chess piece.
|
||||||
positions.insert(*nextPosition);
|
// If any opponents chess piece can reach the king after movement the current chess piece is a protective chess piece.
|
||||||
} else {
|
for (ChessPiece* chessPiece : chessboard->GetChessPieces()) {
|
||||||
ChessPiece* chessPiece = chessboard->GetChessPiece(nextPosition);
|
if (chessPiece->GetColor() != this->GetColor()) {
|
||||||
|
std::set<ChessPiecePosition> positionsStay = chessPiece->GetNextPositions(chessboard, {});
|
||||||
|
std::set<ChessPiecePosition> positionsMove = chessPiece->GetNextPositions(chessboard, {this->GetPosition()});
|
||||||
|
|
||||||
if (chessPiece->GetColor() == this->GetColor()) {
|
if (positionsStay.count(chessPieceKing->GetPosition()) == 0 && positionsMove.count(chessPieceKing->GetPosition()) == 1) {
|
||||||
// Eigene Figur
|
return true;
|
||||||
} else {
|
|
||||||
positions.insert(*nextPosition); // Figur des Gegners
|
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nextPosition = ¤tPosition;
|
return false;
|
||||||
while (nextPosition = nextPosition->NextTopRight()) {
|
|
||||||
if (chessboard->IsEmptyField(nextPosition)) {
|
|
||||||
positions.insert(*nextPosition);
|
|
||||||
} else {
|
|
||||||
ChessPiece* chessPiece = chessboard->GetChessPiece(nextPosition);
|
|
||||||
|
|
||||||
if (chessPiece->GetColor() == this->GetColor()) {
|
|
||||||
// Eigene Figur
|
|
||||||
} else {
|
|
||||||
positions.insert(*nextPosition); // Figur des Gegners
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
nextPosition = ¤tPosition;
|
|
||||||
while (nextPosition = nextPosition->NextBottomLeft()) {
|
|
||||||
if (chessboard->IsEmptyField(nextPosition)) {
|
|
||||||
positions.insert(*nextPosition);
|
|
||||||
} else {
|
|
||||||
ChessPiece* chessPiece = chessboard->GetChessPiece(nextPosition);
|
|
||||||
|
|
||||||
if (chessPiece->GetColor() == this->GetColor()) {
|
|
||||||
// Eigene Figur
|
|
||||||
} else {
|
|
||||||
positions.insert(*nextPosition); // Figur des Gegners
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
nextPosition = ¤tPosition;
|
|
||||||
while (nextPosition = nextPosition->NextBottomRight()) {
|
|
||||||
if (chessboard->IsEmptyField(nextPosition)) {
|
|
||||||
positions.insert(*nextPosition);
|
|
||||||
} else {
|
|
||||||
ChessPiece* chessPiece = chessboard->GetChessPiece(nextPosition);
|
|
||||||
|
|
||||||
if (chessPiece->GetColor() == this->GetColor()) {
|
|
||||||
// Eigene Figur
|
|
||||||
} else {
|
|
||||||
positions.insert(*nextPosition); // Figur des Gegners
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return positions;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::set<ChessPiecePosition> ChessPiece::GetNextPositions() {
|
/**
|
||||||
return this->next_positions;
|
* Status whether the chess piece is a queen.
|
||||||
|
* @return Status whether the chess piece is a queen.
|
||||||
|
*/
|
||||||
|
bool ChessPiece::IsQueen() {
|
||||||
|
return this->GetChar() == this->_CHAR_QUEEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Status whether the chess piece is a rook.
|
||||||
|
* @return Status whether the chess piece is a rook.
|
||||||
|
*/
|
||||||
|
bool ChessPiece::IsRook() {
|
||||||
|
return this->GetChar() == this->_CHAR_ROOK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the color of the chess piece.
|
||||||
|
* @param color The color of the chess piece.
|
||||||
|
*/
|
||||||
|
void ChessPiece::SetColor(ChessPieceColor color) {
|
||||||
|
this->_color = color;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets a set of all positions the chess piece can move next.
|
||||||
|
* @param positions A set of all positions the chess piece can move next.
|
||||||
|
*/
|
||||||
void ChessPiece::SetNextPositions(std::set<ChessPiecePosition> positions) {
|
void ChessPiece::SetNextPositions(std::set<ChessPiecePosition> positions) {
|
||||||
this->next_positions = positions;
|
this->_positions_next = positions;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ChessPiece::GetCountMoves() {
|
/**
|
||||||
return this->positions.size() - 1;
|
* Sets the current position of the chess piece.
|
||||||
|
* @param position The current position to be set in the chess piece.
|
||||||
|
*/
|
||||||
|
void ChessPiece::SetPosition(ChessPiecePosition position) {
|
||||||
|
this->_positions.push_back(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the internal positions to which the chess piece can move next.
|
||||||
|
* @param chessboard A pointer to the chessboard.
|
||||||
|
*/
|
||||||
|
void ChessPiece::UpdateNextPositions(Chessboard* chessboard) {
|
||||||
|
if (this->IsProtective(chessboard)) {
|
||||||
|
this->SetNextPositions({});
|
||||||
|
} else {
|
||||||
|
this->SetNextPositions(this->GetNextPositions(chessboard));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -5,39 +5,52 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
#include "../ChessPieces/ChessPieceColor.hpp"
|
||||||
#include "../ChessPieces/ChessPiecePosition.hpp"
|
#include "../ChessPieces/ChessPiecePosition.hpp"
|
||||||
#include "../Chessboard/Chessboard.hpp"
|
#include "../Chessboard/Chessboard.hpp"
|
||||||
|
|
||||||
enum ChessPieceColor {
|
|
||||||
Black = 0,
|
|
||||||
White = 1
|
|
||||||
};
|
|
||||||
|
|
||||||
class ChessPiece {
|
class ChessPiece {
|
||||||
private:
|
private:
|
||||||
ChessPieceColor color;
|
ChessPieceColor _color;
|
||||||
std::vector<ChessPiecePosition> positions;
|
std::vector<ChessPiecePosition> _positions;
|
||||||
std::set<ChessPiecePosition> next_positions;
|
std::set<ChessPiecePosition> _positions_next;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
char _char = '\0';
|
||||||
|
std::pair<std::string, std::string> _unicode;
|
||||||
|
const char _CHAR_BISHOP = 'B';
|
||||||
|
const char _CHAR_KING = 'K';
|
||||||
|
const char _CHAR_KNIGHT = 'N';
|
||||||
|
const char _CHAR_PAWN = 'P';
|
||||||
|
const char _CHAR_QUEEN = 'Q';
|
||||||
|
const char _CHAR_ROOK = 'R';
|
||||||
|
ChessPiece(ChessPieceColor color, ChessPiecePosition position);
|
||||||
|
std::set<ChessPiecePosition> GetDiagonalPositions(Chessboard* chessboard, std::set<ChessPiecePosition> ignore = {});
|
||||||
|
std::set<ChessPiecePosition> GetFilePositions(Chessboard* chessboard, std::set<ChessPiecePosition> ignore = {});
|
||||||
|
std::set<ChessPiecePosition> GetRankPositions(Chessboard* chessboard, std::set<ChessPiecePosition> ignore = {});
|
||||||
|
void SetColor(ChessPieceColor color);
|
||||||
void SetNextPositions(std::set<ChessPiecePosition> positions);
|
void SetNextPositions(std::set<ChessPiecePosition> positions);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ChessPiece() = default;
|
ChessPiece() = default;
|
||||||
ChessPiece(ChessPieceColor color, ChessPiecePosition position);
|
char GetChar();
|
||||||
ChessPieceColor GetColor();
|
ChessPieceColor GetColor();
|
||||||
std::string GetColorName();
|
|
||||||
ChessPiecePosition GetPosition();
|
|
||||||
std::set<ChessPiecePosition> GetNextPositions();
|
std::set<ChessPiecePosition> GetNextPositions();
|
||||||
void SetPosition(ChessPiecePosition position);
|
virtual std::set<ChessPiecePosition> GetNextPositions(Chessboard* chessboard, std::set<ChessPiecePosition> ignore = {}) = 0;
|
||||||
|
int GetNumberOfMoves();
|
||||||
|
ChessPiecePosition GetPosition();
|
||||||
|
std::string GetUnicode();
|
||||||
|
std::string GetUnicode(ChessPieceColor color);
|
||||||
|
bool IsBishop();
|
||||||
bool IsFirstMove();
|
bool IsFirstMove();
|
||||||
virtual std::string GetCharUnicode() = 0;
|
bool IsKing();
|
||||||
virtual char GetAlgebraicNotationSymbol() = 0;
|
bool IsKnight();
|
||||||
std::set<ChessPiecePosition> GetVerticalMoves(Chessboard* chessboard);
|
bool IsPawn();
|
||||||
std::set<ChessPiecePosition> GetHorizontalMoves(Chessboard* chessboard);
|
bool IsProtective(Chessboard* chessboard);
|
||||||
std::set<ChessPiecePosition> GetDiagonalMoves(Chessboard* chessboard);
|
bool IsQueen();
|
||||||
virtual void UpdateNextPositions(Chessboard* chessboard) = 0;
|
bool IsRook();
|
||||||
int GetCountMoves();
|
void SetPosition(ChessPiecePosition position);
|
||||||
|
void UpdateNextPositions(Chessboard* chessboard);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
9
ChessPieces/ChessPieceColor.hpp
Normal file
9
ChessPieces/ChessPieceColor.hpp
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
#ifndef ChessPieceColor_H
|
||||||
|
#define ChessPieceColor_H
|
||||||
|
|
||||||
|
enum ChessPieceColor {
|
||||||
|
Black = 0,
|
||||||
|
White = 1
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
@@ -1,5 +1,9 @@
|
|||||||
#include "../ChessPieces/ChessPiecePosition.hpp"
|
#include "../ChessPieces/ChessPiecePosition.hpp"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new chess piece position.
|
||||||
|
* @param position The chess piece position as string.
|
||||||
|
*/
|
||||||
ChessPiecePosition::ChessPiecePosition(std::string position) {
|
ChessPiecePosition::ChessPiecePosition(std::string position) {
|
||||||
if (position.length() != 2) {
|
if (position.length() != 2) {
|
||||||
throw std::invalid_argument("invalid position");
|
throw std::invalid_argument("invalid position");
|
||||||
@@ -9,53 +13,140 @@ ChessPiecePosition::ChessPiecePosition(std::string position) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new chess piece position.
|
||||||
|
* @param file The file part of the chess piece position.
|
||||||
|
* @param rank The rank part of the chess piece position.
|
||||||
|
*/
|
||||||
ChessPiecePosition::ChessPiecePosition(char file, int rank) {
|
ChessPiecePosition::ChessPiecePosition(char file, int rank) {
|
||||||
this->SetFile(file);
|
this->SetFile(file);
|
||||||
this->SetRank(rank);
|
this->SetRank(rank);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compares the current chess piece position with another chess piece position.
|
||||||
|
* @param position The other chess piece position to be checked with the current chess piece position.
|
||||||
|
*/
|
||||||
bool ChessPiecePosition::operator< (ChessPiecePosition const position) const {
|
bool ChessPiecePosition::operator< (ChessPiecePosition const position) const {
|
||||||
if (this->file == position.file) {
|
if (this->_file == position._file) {
|
||||||
return this->rank < position.rank;
|
return this->_rank < position._rank;
|
||||||
} else {
|
} else {
|
||||||
return this->file < position.file;
|
return this->_file < position._file;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compares the current chess piece position with another chess piece position.
|
||||||
|
* @param position The other chess piece position to be checked with the current chess piece position.
|
||||||
|
*/
|
||||||
bool ChessPiecePosition::operator== (ChessPiecePosition const position) const {
|
bool ChessPiecePosition::operator== (ChessPiecePosition const position) const {
|
||||||
return this->file == position.file && this->rank == position.rank;
|
return this->_file == position._file && this->_rank == position._rank;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the moves to reach the target chess piece position from the starting chess piece position.
|
||||||
|
* @param fromPosition The starting chess piece position.
|
||||||
|
* @param toPosition The target chess piece position.
|
||||||
|
* @return A string with the moves to reach the target chess piece position from the starting chess piece position.
|
||||||
|
* An empty string if the starting chess piece position is the same as the target chess piece position.
|
||||||
|
*/
|
||||||
|
std::string ChessPiecePosition::GetDifference(ChessPiecePosition fromPosition, ChessPiecePosition toPosition) {
|
||||||
|
if (fromPosition == toPosition) {
|
||||||
|
return "";
|
||||||
|
} else {
|
||||||
|
std::string difference;
|
||||||
|
|
||||||
|
if (toPosition.GetFile() < fromPosition.GetFile()) {
|
||||||
|
difference.append(std::string(1, ChessPiecePosition::_MOVE_LEFT) + std::to_string(fromPosition.GetFile() - toPosition.GetFile()));
|
||||||
|
} else if (toPosition.GetFile() > fromPosition.GetFile()) {
|
||||||
|
difference.append(std::string(1, ChessPiecePosition::_MOVE_RIGHT) + std::to_string(toPosition.GetFile() - fromPosition.GetFile()));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (toPosition.GetRank() < fromPosition.GetRank()) {
|
||||||
|
difference.append(std::string(1, ChessPiecePosition::_MOVE_BOTTOM) + std::to_string(fromPosition.GetRank() - toPosition.GetRank()));
|
||||||
|
} else if (toPosition.GetRank() > fromPosition.GetRank()) {
|
||||||
|
difference.append(std::string(1, ChessPiecePosition::_MOVE_TOP) + std::to_string(toPosition.GetRank() - fromPosition.GetRank()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return difference;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the file part of the chess piece position.
|
||||||
|
* @return char The file part of the chess piece position.
|
||||||
|
*/
|
||||||
char ChessPiecePosition::GetFile() {
|
char ChessPiecePosition::GetFile() {
|
||||||
return this->file;
|
return this->_file;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the rank part of the chess piece position.
|
||||||
|
* @return int The rank part of the chess piece position.
|
||||||
|
*/
|
||||||
int ChessPiecePosition::GetRank() {
|
int ChessPiecePosition::GetRank() {
|
||||||
return this->rank;
|
return this->_rank;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChessPiecePosition::SetFile(char file) {
|
/**
|
||||||
|
* Gets the step to reach the target chess piece position from the starting chess piece position.
|
||||||
// convert lowercase to uppercase.
|
* The amount of steps to reach the target chess piece position is not known but the target chess piece position is reachable.
|
||||||
if (file >= 'a' && file <= 'h') {
|
* @param fromPosition The starting chess piece position.
|
||||||
file -= 32;
|
* @param toPosition The target chess piece position.
|
||||||
}
|
* @return A string with the step to reach the target chess piece position from the starting chess piece position.
|
||||||
|
* An empty string if the starting chess piece position is the same as the target chess piece position
|
||||||
if (file >= 'A' && file <= 'H') {
|
* or the target chess piece position is not reachable directly (vertical, horizontal, diagonal).
|
||||||
this->file = file;
|
*/
|
||||||
|
std::string ChessPiecePosition::GetStep(ChessPiecePosition fromPosition, ChessPiecePosition toPosition) {
|
||||||
|
if (fromPosition == toPosition) {
|
||||||
|
return "";
|
||||||
} else {
|
} else {
|
||||||
throw std::out_of_range("file is out of range");
|
if (fromPosition.GetRank() == toPosition.GetRank()) {
|
||||||
}
|
if (fromPosition.GetFile() > toPosition.GetFile()) {
|
||||||
}
|
return std::string(1, ChessPiecePosition::_MOVE_LEFT) + std::string(1, '1');
|
||||||
|
} else if (fromPosition.GetFile() < toPosition.GetFile()) {
|
||||||
void ChessPiecePosition::SetRank(int rank) {
|
return std::string(1, ChessPiecePosition::_MOVE_RIGHT) + std::string(1, '1');
|
||||||
if (rank >= 1 && rank <= 8) {
|
} else {
|
||||||
this->rank = rank;
|
return "";
|
||||||
} else {
|
}
|
||||||
throw std::out_of_range("rank is out of range");
|
} else if (fromPosition.GetFile() == toPosition.GetFile()) {
|
||||||
|
if (fromPosition.GetRank() > toPosition.GetRank()) {
|
||||||
|
return std::string(1, ChessPiecePosition::_MOVE_BOTTOM) + std::string(1, '1');
|
||||||
|
} else if (fromPosition.GetRank() < toPosition.GetRank()) {
|
||||||
|
return std::string(1, ChessPiecePosition::_MOVE_TOP) + std::string(1, '1');
|
||||||
|
} else {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
int rankDifference = fromPosition.GetRank() - toPosition.GetRank();
|
||||||
|
int fileDifference = fromPosition.GetFile() - toPosition.GetFile();
|
||||||
|
|
||||||
|
if (std::abs(rankDifference) != std::abs(fileDifference)) {
|
||||||
|
return "";
|
||||||
|
} else {
|
||||||
|
if (rankDifference < 0) {
|
||||||
|
if (fileDifference < 0) {
|
||||||
|
return std::string(1, ChessPiecePosition::_MOVE_TOP) + std::string(1, '1') + std::string(1, ChessPiecePosition::_MOVE_RIGHT) + std::string(1, '1');
|
||||||
|
} else {
|
||||||
|
return std::string(1, ChessPiecePosition::_MOVE_TOP) + std::string(1, '1') + std::string(1, ChessPiecePosition::_MOVE_LEFT) + std::string(1, '1');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (fileDifference < 0) {
|
||||||
|
return std::string(1, ChessPiecePosition::_MOVE_BOTTOM) + std::string(1, '1') + std::string(1, ChessPiecePosition::_MOVE_RIGHT) + std::string(1, '1');
|
||||||
|
} else {
|
||||||
|
return std::string(1, ChessPiecePosition::_MOVE_BOTTOM) + std::string(1, '1') + std::string(1, ChessPiecePosition::_MOVE_LEFT) + std::string(1, '1');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the next chess piece position below the current chess piece position.
|
||||||
|
* @return A pointer to the chess piece position below the current chess piece position.
|
||||||
|
* Returns a null pointer if the chess piece position is not available.
|
||||||
|
*/
|
||||||
ChessPiecePosition* ChessPiecePosition::NextBottom() {
|
ChessPiecePosition* ChessPiecePosition::NextBottom() {
|
||||||
try {
|
try {
|
||||||
return new ChessPiecePosition(this->GetFile(), this->GetRank() - 1);
|
return new ChessPiecePosition(this->GetFile(), this->GetRank() - 1);
|
||||||
@@ -64,6 +155,11 @@ ChessPiecePosition* ChessPiecePosition::NextBottom() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the next chess piece position below to the left of the current chess piece position.
|
||||||
|
* @return A pointer to the chess piece position below to the left of the current chess piece position.
|
||||||
|
* Returns a null pointer if the chess piece position is not available.
|
||||||
|
*/
|
||||||
ChessPiecePosition* ChessPiecePosition::NextBottomLeft() {
|
ChessPiecePosition* ChessPiecePosition::NextBottomLeft() {
|
||||||
try {
|
try {
|
||||||
return new ChessPiecePosition(this->GetFile() - 1, this->GetRank() - 1);
|
return new ChessPiecePosition(this->GetFile() - 1, this->GetRank() - 1);
|
||||||
@@ -72,6 +168,11 @@ ChessPiecePosition* ChessPiecePosition::NextBottomLeft() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the next chess piece position below to the right of the current chess piece position.
|
||||||
|
* @return A pointer to the chess piece position below to the right of the current chess piece position.
|
||||||
|
* Returns a null pointer if the chess piece position is not available.
|
||||||
|
*/
|
||||||
ChessPiecePosition* ChessPiecePosition::NextBottomRight() {
|
ChessPiecePosition* ChessPiecePosition::NextBottomRight() {
|
||||||
try {
|
try {
|
||||||
return new ChessPiecePosition(this->GetFile() + 1, this->GetRank() - 1);
|
return new ChessPiecePosition(this->GetFile() + 1, this->GetRank() - 1);
|
||||||
@@ -80,73 +181,37 @@ ChessPiecePosition* ChessPiecePosition::NextBottomRight() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ChessPiecePosition* ChessPiecePosition::NextLeft() {
|
/**
|
||||||
try {
|
* Gets the next chess piece position based on the current chess piece position and specified steps.
|
||||||
return new ChessPiecePosition(this->GetFile() - 1, this->GetRank());
|
* @param steps The steps to be added to the current chess piece position.
|
||||||
} catch (const std::out_of_range e) {
|
* @return A pointer to the chess piece position based on the current chess piece position and specified steps.
|
||||||
return nullptr;
|
* Returns a null pointer if the chess piece position is not available.
|
||||||
}
|
*/
|
||||||
}
|
|
||||||
|
|
||||||
ChessPiecePosition* ChessPiecePosition::NextRight() {
|
|
||||||
try {
|
|
||||||
return new ChessPiecePosition(this->GetFile() + 1, this->GetRank());
|
|
||||||
} catch (const std::out_of_range e) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ChessPiecePosition* ChessPiecePosition::NextTop() {
|
|
||||||
try {
|
|
||||||
return new ChessPiecePosition(this->GetFile(), this->GetRank() + 1);
|
|
||||||
} catch (const std::out_of_range e) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ChessPiecePosition* ChessPiecePosition::NextTopLeft() {
|
|
||||||
try {
|
|
||||||
return new ChessPiecePosition(this->GetFile() - 1, this->GetRank() + 1);
|
|
||||||
} catch (const std::out_of_range e) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ChessPiecePosition* ChessPiecePosition::NextTopRight() {
|
|
||||||
try {
|
|
||||||
return new ChessPiecePosition(this->GetFile() + 1, this->GetRank() + 1);
|
|
||||||
} catch (const std::out_of_range e) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ChessPiecePosition* ChessPiecePosition::NextFromString(std::string steps) {
|
ChessPiecePosition* ChessPiecePosition::NextFromString(std::string steps) {
|
||||||
if (steps.length() % 2 != 0) {
|
if (steps.length() % 2 != 0) return nullptr;
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
char nextFile = this->GetFile();
|
char nextFile = this->GetFile();
|
||||||
int nextRank = this->GetRank();
|
int nextRank = this->GetRank();
|
||||||
|
|
||||||
for (int i = 0; i < steps.length() / 2; i++) {
|
for (int step = 0; step < steps.length() / 2; step++) {
|
||||||
char direction = steps[0 + (i * 2)];
|
char direction = steps[0 + (step * 2)];
|
||||||
int moves = steps[1 + (i * 2)] - '0';
|
int moves = steps[1 + (step * 2)] - '0';
|
||||||
|
|
||||||
if (!(moves >= 1 && moves <= 8)) {
|
if (!(moves >= 1 && moves <= 8)) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (direction) {
|
switch (direction) {
|
||||||
case 'B':
|
case ChessPiecePosition::_MOVE_BOTTOM:
|
||||||
nextRank -= moves;
|
nextRank -= moves;
|
||||||
break;
|
break;
|
||||||
case 'L':
|
case ChessPiecePosition::_MOVE_LEFT:
|
||||||
nextFile -= moves;
|
nextFile -= moves;
|
||||||
break;
|
break;
|
||||||
case 'R':
|
case ChessPiecePosition::_MOVE_RIGHT:
|
||||||
nextFile += moves;
|
nextFile += moves;
|
||||||
break;
|
break;
|
||||||
case 'T':
|
case ChessPiecePosition::_MOVE_TOP:
|
||||||
nextRank += moves;
|
nextRank += moves;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -161,24 +226,104 @@ ChessPiecePosition* ChessPiecePosition::NextFromString(std::string steps) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the next chess piece position left of the current chess piece position.
|
||||||
|
* @return A pointer to the chess piece position left of the current chess piece position.
|
||||||
|
* Returns a null pointer if the chess piece position is not available.
|
||||||
|
*/
|
||||||
|
ChessPiecePosition* ChessPiecePosition::NextLeft() {
|
||||||
|
try {
|
||||||
|
return new ChessPiecePosition(this->GetFile() - 1, this->GetRank());
|
||||||
|
} catch (const std::out_of_range e) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the next chess piece position right of the current chess piece position.
|
||||||
|
* @return A pointer to the chess piece position right of the current chess piece position.
|
||||||
|
* Returns a null pointer if the chess piece position is not available.
|
||||||
|
*/
|
||||||
|
ChessPiecePosition* ChessPiecePosition::NextRight() {
|
||||||
|
try {
|
||||||
|
return new ChessPiecePosition(this->GetFile() + 1, this->GetRank());
|
||||||
|
} catch (const std::out_of_range e) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the next chess piece position above the current chess piece position.
|
||||||
|
* @return A pointer to the chess piece position above the current chess piece position.
|
||||||
|
* Returns a null pointer if the chess piece position is not available.
|
||||||
|
*/
|
||||||
|
ChessPiecePosition* ChessPiecePosition::NextTop() {
|
||||||
|
try {
|
||||||
|
return new ChessPiecePosition(this->GetFile(), this->GetRank() + 1);
|
||||||
|
} catch (const std::out_of_range e) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the next chess piece position above to the left of the current chess piece position.
|
||||||
|
* @return A pointer to the chess piece position above to the left of the current chess piece position.
|
||||||
|
* Returns a null pointer if the chess piece position is not available.
|
||||||
|
*/
|
||||||
|
ChessPiecePosition* ChessPiecePosition::NextTopLeft() {
|
||||||
|
try {
|
||||||
|
return new ChessPiecePosition(this->GetFile() - 1, this->GetRank() + 1);
|
||||||
|
} catch (const std::out_of_range e) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the next chess piece position above to the right of the current chess piece position.
|
||||||
|
* @return A pointer to the chess piece position above to the right of the current chess piece position.
|
||||||
|
* Returns a null pointer if the chess piece position is not available.
|
||||||
|
*/
|
||||||
|
ChessPiecePosition* ChessPiecePosition::NextTopRight() {
|
||||||
|
try {
|
||||||
|
return new ChessPiecePosition(this->GetFile() + 1, this->GetRank() + 1);
|
||||||
|
} catch (const std::out_of_range e) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the file part of the chess piece position.
|
||||||
|
* @param file The file part of the chess piece position.
|
||||||
|
*/
|
||||||
|
void ChessPiecePosition::SetFile(char file) {
|
||||||
|
|
||||||
|
if (file >= 'a' && file <= 'h') {
|
||||||
|
file = char(std::toupper(file));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (file >= 'A' && file <= 'H') {
|
||||||
|
this->_file = file;
|
||||||
|
} else {
|
||||||
|
throw std::out_of_range("file is out of range");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the rank part of the chess piece position.
|
||||||
|
* @param rank The rank part of the chess piece position.
|
||||||
|
*/
|
||||||
|
void ChessPiecePosition::SetRank(int rank) {
|
||||||
|
if (rank >= 1 && rank <= 8) {
|
||||||
|
this->_rank = rank;
|
||||||
|
} else {
|
||||||
|
throw std::out_of_range("rank is out of range");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the current chess piece position as string.
|
||||||
|
* @return The current chess piece position as string.
|
||||||
|
*/
|
||||||
std::string ChessPiecePosition::ToString() {
|
std::string ChessPiecePosition::ToString() {
|
||||||
return std::string(1, this->GetFile()) + std::to_string(this->GetRank());
|
return std::string(1, this->GetFile()) + std::to_string(this->GetRank());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ChessPiecePosition::GetDifference(ChessPiecePosition fromPosition, ChessPiecePosition toPosition) {
|
|
||||||
std::string difference;
|
|
||||||
|
|
||||||
if (toPosition.GetFile() < fromPosition.GetFile()) { // Links
|
|
||||||
difference.append(std::string(1, 'L') + std::to_string(fromPosition.GetFile() - toPosition.GetFile()));
|
|
||||||
} else if (toPosition.GetFile() > fromPosition.GetFile()) { // Rechts
|
|
||||||
difference.append(std::string(1, 'R') + std::to_string(toPosition.GetFile() - fromPosition.GetFile()));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (toPosition.GetRank() < fromPosition.GetRank()) { // Unten
|
|
||||||
difference.append(std::string(1, 'B') + std::to_string(fromPosition.GetRank() - toPosition.GetRank()));
|
|
||||||
} else if (toPosition.GetRank() > fromPosition.GetRank()) { // Oben
|
|
||||||
difference.append(std::string(1, 'T') + std::to_string(toPosition.GetRank() - fromPosition.GetRank()));
|
|
||||||
}
|
|
||||||
|
|
||||||
return difference;
|
|
||||||
}
|
|
||||||
|
@@ -6,8 +6,12 @@
|
|||||||
|
|
||||||
class ChessPiecePosition {
|
class ChessPiecePosition {
|
||||||
private:
|
private:
|
||||||
char file; // the vertical column (A to H).
|
char _file;
|
||||||
int rank; // the horizontal row (1 to 8).
|
int _rank;
|
||||||
|
static const char _MOVE_LEFT = 'L';
|
||||||
|
static const char _MOVE_RIGHT = 'R';
|
||||||
|
static const char _MOVE_TOP = 'T';
|
||||||
|
static const char _MOVE_BOTTOM = 'B';
|
||||||
void SetFile(char file);
|
void SetFile(char file);
|
||||||
void SetRank(int rank);
|
void SetRank(int rank);
|
||||||
|
|
||||||
@@ -16,18 +20,19 @@ class ChessPiecePosition {
|
|||||||
ChessPiecePosition(char file, int rank);
|
ChessPiecePosition(char file, int rank);
|
||||||
bool operator< (ChessPiecePosition const position) const;
|
bool operator< (ChessPiecePosition const position) const;
|
||||||
bool operator== (ChessPiecePosition const position) const;
|
bool operator== (ChessPiecePosition const position) const;
|
||||||
|
static std::string GetDifference(ChessPiecePosition fromPosition, ChessPiecePosition toPosition);
|
||||||
char GetFile();
|
char GetFile();
|
||||||
int GetRank();
|
int GetRank();
|
||||||
ChessPiecePosition* NextTop();
|
static std::string GetStep(ChessPiecePosition fromPosition, ChessPiecePosition toPosition);
|
||||||
ChessPiecePosition* NextBottom();
|
ChessPiecePosition* NextBottom();
|
||||||
ChessPiecePosition* NextLeft();
|
|
||||||
ChessPiecePosition* NextRight();
|
|
||||||
ChessPiecePosition* NextTopLeft();
|
|
||||||
ChessPiecePosition* NextTopRight();
|
|
||||||
ChessPiecePosition* NextBottomLeft();
|
ChessPiecePosition* NextBottomLeft();
|
||||||
ChessPiecePosition* NextBottomRight();
|
ChessPiecePosition* NextBottomRight();
|
||||||
ChessPiecePosition* NextFromString(std::string steps);
|
ChessPiecePosition* NextFromString(std::string steps);
|
||||||
static std::string GetDifference(ChessPiecePosition fromPosition, ChessPiecePosition toPosition);
|
ChessPiecePosition* NextLeft();
|
||||||
|
ChessPiecePosition* NextRight();
|
||||||
|
ChessPiecePosition* NextTop();
|
||||||
|
ChessPiecePosition* NextTopLeft();
|
||||||
|
ChessPiecePosition* NextTopRight();
|
||||||
std::string ToString();
|
std::string ToString();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -1,45 +1,43 @@
|
|||||||
#include "King.hpp"
|
#include "King.hpp"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new king with a specified color and position.
|
||||||
|
* @param color The color of the king.
|
||||||
|
* @param position The position of the king.
|
||||||
|
*/
|
||||||
King::King(ChessPieceColor color, ChessPiecePosition position) : ChessPiece(color, position) {
|
King::King(ChessPieceColor color, ChessPiecePosition position) : ChessPiece(color, position) {
|
||||||
|
this->_char = this->_CHAR_KING;
|
||||||
|
this->_unicode = {"\u265A", "\u2654"};
|
||||||
}
|
}
|
||||||
|
|
||||||
char King::GetAlgebraicNotationSymbol() {
|
/**
|
||||||
return 'K';
|
* Gets all chess piece positions the king can move next.
|
||||||
}
|
* The set of chess piece positions will be ignored, because the king has a fixed movement.
|
||||||
|
* @param chessboard A pointer to the chessboard.
|
||||||
std::string King::GetCharUnicode() {
|
* @param ignore A set of chess piece positions to be ignored.
|
||||||
return King::GetCharUnicode(this->GetColor());
|
* @return A set of chess piece positions the rook can move next.
|
||||||
}
|
*/
|
||||||
|
std::set<ChessPiecePosition> King::GetNextPositions(Chessboard* chessboard, std::set<ChessPiecePosition> ignore) {
|
||||||
std::string King::GetCharUnicode(ChessPieceColor color) {
|
|
||||||
switch (color) {
|
|
||||||
case ChessPieceColor::Black:
|
|
||||||
return "\u265A";
|
|
||||||
case ChessPieceColor::White:
|
|
||||||
return "\u2654";
|
|
||||||
default:
|
|
||||||
return "\0";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void King::UpdateNextPositions(Chessboard* chessboard) {
|
|
||||||
std::set<ChessPiecePosition> positions;
|
std::set<ChessPiecePosition> positions;
|
||||||
positions.insert(this->GetPosition());
|
|
||||||
|
|
||||||
std::string moves[8] = {"T1", "T1L1", "T1R1", "B1", "B1L1", "B1R1", "L1", "R1"};
|
// There are two different ways of moving the king:
|
||||||
|
// 3.8.1. by moving to an adjoining square.
|
||||||
for (std::string move : moves) {
|
// 3.8.2. by 'castling'. This is a move of the king and either rook of the same colour along the player's first rank,
|
||||||
|
// counting as a single move of the king and executed as follows: the king is transferred from its original square
|
||||||
|
// two squares towards the rook on its original square, then that rook is transferred to the square the king
|
||||||
|
// has just crossed. -> is implemented directly on the move function.
|
||||||
|
for (std::string move : {"T1", "T1L1", "T1R1", "B1", "B1L1", "B1R1", "L1", "R1"}) {
|
||||||
ChessPiecePosition* nextPosition = this->GetPosition().NextFromString(move);
|
ChessPiecePosition* nextPosition = this->GetPosition().NextFromString(move);
|
||||||
|
if (nextPosition == nullptr) continue;
|
||||||
|
|
||||||
if (nextPosition) {
|
if (chessboard->IsEmptyField(nextPosition) || chessboard->GetChessPiece(nextPosition)->GetColor() != this->GetColor()) {
|
||||||
if (chessboard->IsEmptyField(nextPosition)) {
|
ChessPieceColor opponentColor = (this->GetColor() == ChessPieceColor::Black) ? ChessPieceColor::White : ChessPieceColor::Black;
|
||||||
positions.insert(*nextPosition); // Leeres Feld
|
|
||||||
} else if (chessboard->GetChessPiece(nextPosition)->GetColor() != this->GetColor()) {
|
if (chessboard->IsPositionUnderAttack(*nextPosition, opponentColor) == false) {
|
||||||
positions.insert(*nextPosition); // Figur des Gegners
|
positions.insert(*nextPosition);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this->SetNextPositions(positions);
|
return positions;
|
||||||
}
|
}
|
||||||
|
@@ -6,10 +6,7 @@
|
|||||||
class King : public ChessPiece {
|
class King : public ChessPiece {
|
||||||
public:
|
public:
|
||||||
King(ChessPieceColor color, ChessPiecePosition position);
|
King(ChessPieceColor color, ChessPiecePosition position);
|
||||||
char GetAlgebraicNotationSymbol();
|
std::set<ChessPiecePosition> GetNextPositions(Chessboard* chessboard, std::set<ChessPiecePosition> ignore = {});
|
||||||
std::string GetCharUnicode();
|
|
||||||
static std::string GetCharUnicode(ChessPieceColor color);
|
|
||||||
void UpdateNextPositions(Chessboard* chessboard);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -1,45 +1,36 @@
|
|||||||
#include "Knight.hpp"
|
#include "Knight.hpp"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new knight with a specified color and position.
|
||||||
|
* @param color The color of the knight.
|
||||||
|
* @param position The position of the knight.
|
||||||
|
*/
|
||||||
Knight::Knight(ChessPieceColor color, ChessPiecePosition position) : ChessPiece(color, position) {
|
Knight::Knight(ChessPieceColor color, ChessPiecePosition position) : ChessPiece(color, position) {
|
||||||
|
this->_char = this->_CHAR_KNIGHT;
|
||||||
|
this->_unicode = {"\u265E", "\u2658"};
|
||||||
}
|
}
|
||||||
|
|
||||||
char Knight::GetAlgebraicNotationSymbol() {
|
/**
|
||||||
return 'N';
|
* Gets all chess piece positions the knight can move next.
|
||||||
}
|
* The set of chess piece positions will be ignored, because the knight has a fixed movement.
|
||||||
|
* @param chessboard A pointer to the chessboard.
|
||||||
std::string Knight::GetCharUnicode() {
|
* @param ignore A set of chess piece positions to be ignored.
|
||||||
return Knight::GetCharUnicode(this->GetColor());
|
* @return A set of chess piece positions the knight can move next.
|
||||||
}
|
*/
|
||||||
|
std::set<ChessPiecePosition> Knight::GetNextPositions(Chessboard* chessboard, std::set<ChessPiecePosition> ignore) {
|
||||||
std::string Knight::GetCharUnicode(ChessPieceColor color) {
|
|
||||||
switch (color) {
|
|
||||||
case ChessPieceColor::Black:
|
|
||||||
return "\u265E";
|
|
||||||
case ChessPieceColor::White:
|
|
||||||
return "\u2658";
|
|
||||||
default:
|
|
||||||
return "\0";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Knight::UpdateNextPositions(Chessboard* chessboard) {
|
|
||||||
std::set<ChessPiecePosition> positions;
|
std::set<ChessPiecePosition> positions;
|
||||||
positions.insert(this->GetPosition());
|
|
||||||
|
|
||||||
std::string moves[8] = {"T2L1", "T2R1", "L2T1", "L2B1", "B2L1", "B2R1", "R2T1", "R2B1"};
|
// 3.6. The knight may move to one of the squares nearest to that on which it stands but not on the same rank, file or diagonal.
|
||||||
|
for (std::string move : {"T2L1", "T2R1", "L2T1", "L2B1", "B2L1", "B2R1", "R2T1", "R2B1"}) {
|
||||||
for (std::string move : moves) {
|
|
||||||
ChessPiecePosition* nextPosition = this->GetPosition().NextFromString(move);
|
ChessPiecePosition* nextPosition = this->GetPosition().NextFromString(move);
|
||||||
|
if (nextPosition == nullptr) continue;
|
||||||
|
|
||||||
if (nextPosition) {
|
// 3.1. It is not permitted to move a piece to a square occupied by a piece of the same colour.
|
||||||
if (chessboard->IsEmptyField(nextPosition)) {
|
// 3.1.1. If a piece moves to a square occupied by an opponent's piece the latter is captured and removed from the chessboard as part of the same move.
|
||||||
positions.insert(*nextPosition); // Leeres Feld
|
if (chessboard->IsEmptyField(nextPosition) || chessboard->GetChessPiece(nextPosition)->GetColor() != this->GetColor()) {
|
||||||
} else if (chessboard->GetChessPiece(nextPosition)->GetColor() != this->GetColor()) {
|
positions.insert(*nextPosition);
|
||||||
positions.insert(*nextPosition); // Figur des Gegners
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this->SetNextPositions(positions);
|
return positions;
|
||||||
}
|
}
|
||||||
|
@@ -6,10 +6,7 @@
|
|||||||
class Knight : public ChessPiece {
|
class Knight : public ChessPiece {
|
||||||
public:
|
public:
|
||||||
Knight(ChessPieceColor color, ChessPiecePosition position);
|
Knight(ChessPieceColor color, ChessPiecePosition position);
|
||||||
char GetAlgebraicNotationSymbol();
|
std::set<ChessPiecePosition> GetNextPositions(Chessboard* chessboard, std::set<ChessPiecePosition> ignore = {});
|
||||||
std::string GetCharUnicode();
|
|
||||||
static std::string GetCharUnicode(ChessPieceColor color);
|
|
||||||
void UpdateNextPositions(Chessboard* chessboard);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -1,169 +1,174 @@
|
|||||||
#include "Pawn.hpp"
|
#include "Pawn.hpp"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new pawn with a specified color and position.
|
||||||
|
* @param color The color of the pawn.
|
||||||
|
* @param position The position of the pawn.
|
||||||
|
*/
|
||||||
Pawn::Pawn(ChessPieceColor color, ChessPiecePosition position) : ChessPiece(color, position) {
|
Pawn::Pawn(ChessPieceColor color, ChessPiecePosition position) : ChessPiece(color, position) {
|
||||||
|
this->_char = this->_CHAR_PAWN;
|
||||||
|
this->_unicode = {"\u265F", "\u2659"};
|
||||||
}
|
}
|
||||||
|
|
||||||
char Pawn::GetAlgebraicNotationSymbol() {
|
/**
|
||||||
return 'P';
|
* Gets all chess piece positions the pawn can move next.
|
||||||
}
|
* The set of chess piece positions will be ignored, because the pawn has a fixed movement.
|
||||||
|
* @param chessboard A pointer to the chessboard.
|
||||||
std::string Pawn::GetCharUnicode() {
|
* @param ignore A set of chess piece positions to be ignored.
|
||||||
return Pawn::GetCharUnicode(this->GetColor());
|
* @return A set of chess piece positions the pawn can move next.
|
||||||
}
|
*/
|
||||||
|
std::set<ChessPiecePosition> Pawn::GetNextPositions(Chessboard* chessboard, std::set<ChessPiecePosition> ignore) {
|
||||||
std::string Pawn::GetCharUnicode(ChessPieceColor color) {
|
|
||||||
switch (color) {
|
|
||||||
case ChessPieceColor::Black:
|
|
||||||
return "\u265F";
|
|
||||||
case ChessPieceColor::White:
|
|
||||||
return "\u2659";
|
|
||||||
default:
|
|
||||||
return "\0";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Pawn::UpdateNextPositions(Chessboard* chessboard) {
|
|
||||||
std::set<ChessPiecePosition> positions;
|
std::set<ChessPiecePosition> positions;
|
||||||
ChessPiecePosition currentPosition = this->GetPosition();
|
ChessPiecePosition currentPosition = this->GetPosition();
|
||||||
positions.insert(currentPosition); // Aktuelle Position
|
ChessPiecePosition* nextPosition = ¤tPosition;
|
||||||
|
|
||||||
if (this->GetColor() == ChessPieceColor::Black) { // Oben
|
if (this->GetColor() == ChessPieceColor::Black) {
|
||||||
ChessPiecePosition* nextPosition = ¤tPosition;
|
|
||||||
int moves = 0;
|
|
||||||
|
|
||||||
// 1 und 2 Schritte
|
// 3.7.1. The pawn may move forward to the square immediately in front of it on the same file, provided that this square is unoccupied.
|
||||||
while (nextPosition = nextPosition->NextBottom()) {
|
// 3.7.2. On its first move the pawn may move as in 3.7.1 or alternatively it may advance two squares along the same file, provided that both squares are unoccupied.
|
||||||
moves++;
|
for (int move = 1; move <= 2; move++) {
|
||||||
|
nextPosition = nextPosition->NextBottom();
|
||||||
|
|
||||||
if (chessboard->IsEmptyField(nextPosition) == false) {
|
if (nextPosition) {
|
||||||
|
if (chessboard->IsEmptyField(nextPosition) == false) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (move == 1) {
|
||||||
|
positions.insert(*nextPosition);
|
||||||
|
} else if (move == 2 && this->IsFirstMove()) {
|
||||||
|
positions.insert(*nextPosition);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (moves == 1) { // 1 Schritt
|
|
||||||
positions.insert(*nextPosition);
|
|
||||||
continue;
|
|
||||||
} else if (moves == 2 && this->IsFirstMove()) {
|
|
||||||
positions.insert(*nextPosition);
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Quer schlagen
|
// 3.7.3. the pawn may move to a square occupied by an opponent's piece diagonally in front of it on an adjacent file, capturing that piece.
|
||||||
ChessPiecePosition* bottomLeftPosition = currentPosition.NextBottomLeft();
|
for (std::string move : {"B1L1", "B1R1"}) {
|
||||||
ChessPiecePosition* bottomRightPosition = currentPosition.NextBottomRight();
|
nextPosition = ¤tPosition;
|
||||||
|
nextPosition = nextPosition->NextFromString(move);
|
||||||
|
|
||||||
if (bottomLeftPosition) {
|
if (nextPosition && chessboard->IsEmptyField(nextPosition) == false) {
|
||||||
if (chessboard->IsEmptyField(bottomLeftPosition) == false && chessboard->GetChessPiece(bottomLeftPosition)->GetColor() != this->GetColor()) {
|
ChessPiece* chessPiece = chessboard->GetChessPiece(nextPosition);
|
||||||
positions.insert(*bottomLeftPosition);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (bottomRightPosition) {
|
|
||||||
if (chessboard->IsEmptyField(bottomRightPosition) == false && chessboard->GetChessPiece(bottomRightPosition)->GetColor() != this->GetColor()) {
|
|
||||||
positions.insert(*bottomRightPosition);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// En Passant
|
if (chessPiece->GetColor() != this->GetColor()) {
|
||||||
// - Letzter Zug des Gegners war ein Bauer mit zwei 2-Felder-Sprung
|
positions.insert(*nextPosition);
|
||||||
// - Dieser Bauer befindet sich direkt neben dem eigenen Bauern.
|
}
|
||||||
// - Nur im folgenden Zug darf En Passant durchgeführt werden.
|
|
||||||
if (chessboard->GetCountMoves() > 0) {
|
|
||||||
if (this->GetPosition().ToString() == "B4") {
|
|
||||||
std::cout << "Hier";
|
|
||||||
}
|
}
|
||||||
ChessPiecePosition *leftPosition = currentPosition.NextLeft();
|
}
|
||||||
ChessPiecePosition *rightPosition = currentPosition.NextRight();
|
|
||||||
std::pair<ChessPiecePosition, ChessPiecePosition> move = chessboard->GetLastMove();
|
|
||||||
std::string difference = ChessPiecePosition::GetDifference(move.first, move.second);
|
|
||||||
|
|
||||||
if (leftPosition && chessboard->IsEmptyField(leftPosition) == false) {
|
// 3.7.3.1. A pawn occupying a square on the same rank as and on an adjacent file to an opponent's pawn which has just advanced two squares
|
||||||
ChessPiece *piece = chessboard->GetChessPiece(leftPosition);
|
// in one move from its original square may capture this opponent's pawn as though the latter had been moved only one square.
|
||||||
if (chessboard->IsEmptyField(leftPosition) == false && piece->GetColor() != this->GetColor() && piece->GetAlgebraicNotationSymbol() == 'P') {
|
// 3.7.3.2. This capture is only legal on the move following this advance and is called an "en passant" capture.
|
||||||
if (piece->GetCountMoves() == 1 && difference == "T2" && piece->GetPosition() == move.second) {
|
if (chessboard->GetCountMoves() > 0) {
|
||||||
positions.insert(*bottomLeftPosition);
|
std::pair<ChessPiecePosition, ChessPiecePosition> lastMove = chessboard->GetLastMove();
|
||||||
|
std::string moveDifference = ChessPiecePosition::GetDifference(lastMove.first, lastMove.second);
|
||||||
|
ChessPiecePosition* leftPosition = currentPosition.NextLeft();
|
||||||
|
ChessPiecePosition* rightPosition = currentPosition.NextRight();
|
||||||
|
|
||||||
|
if (leftPosition && chessboard->IsEmptyField(leftPosition) == false) {
|
||||||
|
ChessPiece* chessPiece = chessboard->GetChessPiece(leftPosition);
|
||||||
|
|
||||||
|
if (chessPiece->GetColor() != this->GetColor() && chessPiece->IsPawn()) {
|
||||||
|
if (chessPiece->GetNumberOfMoves() == 1 && moveDifference == "T2" && chessPiece->GetPosition() == lastMove.second) {
|
||||||
|
ChessPiecePosition* bottomLeftPosition = currentPosition.NextFromString("B1L1");
|
||||||
|
|
||||||
|
if (bottomLeftPosition && chessboard->IsEmptyField(bottomLeftPosition)) {
|
||||||
|
positions.insert(*bottomLeftPosition);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rightPosition && chessboard->IsEmptyField(rightPosition) == false) {
|
if (rightPosition && chessboard->IsEmptyField(rightPosition) == false) {
|
||||||
ChessPiece *piece = chessboard->GetChessPiece(rightPosition);
|
ChessPiece* chessPiece = chessboard->GetChessPiece(rightPosition);
|
||||||
if (chessboard->IsEmptyField(rightPosition) == false && piece->GetColor() != this->GetColor() && piece->GetAlgebraicNotationSymbol() == 'P') {
|
|
||||||
if (piece->GetCountMoves() == 1 && difference == "T2" && piece->GetPosition() == move.second) {
|
if (chessPiece->GetColor() != this->GetColor() && chessPiece->IsPawn()) {
|
||||||
|
if (chessPiece->GetNumberOfMoves() == 1 && moveDifference == "T2" && chessPiece->GetPosition() == lastMove.second) {
|
||||||
|
ChessPiecePosition* bottomRightPosition = currentPosition.NextFromString("B1R1");
|
||||||
|
|
||||||
|
if (bottomRightPosition && chessboard->IsEmptyField(bottomRightPosition)) {
|
||||||
positions.insert(*bottomRightPosition);
|
positions.insert(*bottomRightPosition);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (this->GetColor() == ChessPieceColor::White) {
|
||||||
|
|
||||||
if (this->GetColor() == ChessPieceColor::White) { // Unten
|
// 3.7.1. The pawn may move forward to the square immediately in front of it on the same file, provided that this square is unoccupied.
|
||||||
ChessPiecePosition* nextPosition = ¤tPosition;
|
// 3.7.2. On its first move the pawn may move as in 3.7.1 or alternatively it may advance two squares along the same file, provided that both squares are unoccupied.
|
||||||
int moves = 0;
|
for (int move = 1; move <= 2; move++) {
|
||||||
|
nextPosition = nextPosition->NextTop();
|
||||||
|
|
||||||
// 1 und 2 Schritte
|
if (nextPosition) {
|
||||||
while (nextPosition = nextPosition->NextTop()) {
|
if (chessboard->IsEmptyField(nextPosition) == false) {
|
||||||
moves++;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (chessboard->IsEmptyField(nextPosition) == false) {
|
if (move == 1) {
|
||||||
|
positions.insert(*nextPosition);
|
||||||
|
} else if (move == 2 && this->IsFirstMove()) {
|
||||||
|
positions.insert(*nextPosition);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (moves == 1) { // 1 Schritt
|
|
||||||
positions.insert(*nextPosition);
|
|
||||||
continue;
|
|
||||||
} else if (moves == 2 && this->IsFirstMove()) {
|
|
||||||
positions.insert(*nextPosition);
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Quer schlagen
|
// 3.7.3. the pawn may move to a square occupied by an opponent's piece diagonally in front of it on an adjacent file, capturing that piece.
|
||||||
ChessPiecePosition* topLeftPosition = currentPosition.NextTopLeft();
|
for (std::string move : {"T1L1", "T1R1"}) {
|
||||||
ChessPiecePosition* topRightPosition = currentPosition.NextTopRight();
|
nextPosition = ¤tPosition;
|
||||||
|
nextPosition = nextPosition->NextFromString(move);
|
||||||
|
|
||||||
if (topLeftPosition) {
|
if (nextPosition && chessboard->IsEmptyField(nextPosition) == false) {
|
||||||
if (chessboard->IsEmptyField(topLeftPosition) == false && chessboard->GetChessPiece(topLeftPosition)->GetColor() != this->GetColor()) {
|
ChessPiece* chessPiece = chessboard->GetChessPiece(nextPosition);
|
||||||
positions.insert(*topLeftPosition);
|
|
||||||
|
if (chessPiece->GetColor() != this->GetColor()) {
|
||||||
|
positions.insert(*nextPosition);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (topRightPosition) {
|
|
||||||
if (chessboard->IsEmptyField(topRightPosition) == false && chessboard->GetChessPiece(topRightPosition)->GetColor() != this->GetColor()) {
|
|
||||||
positions.insert(*topRightPosition);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// En Passant
|
// 3.7.3.1. A pawn occupying a square on the same rank as and on an adjacent file to an opponent's pawn which has just advanced two squares
|
||||||
// - Letzter Zug des Gegners war ein Bauer mit zwei 2-Felder-Sprung
|
// in one move from its original square may capture this opponent's pawn as though the latter had been moved only one square.
|
||||||
// - Dieser Bauer befindet sich direkt neben dem eigenen Bauern.
|
// 3.7.3.2. This capture is only legal on the move following this advance and is called an "en passant" capture.
|
||||||
// - Nur im folgenden Zug darf En Passant durchgeführt werden.
|
if (chessboard->GetCountMoves() > 0) {
|
||||||
if (chessboard->GetCountMoves() > 0) {
|
std::pair<ChessPiecePosition, ChessPiecePosition> lastMove = chessboard->GetLastMove();
|
||||||
ChessPiecePosition *leftPosition = currentPosition.NextLeft();
|
std::string moveDifference = ChessPiecePosition::GetDifference(lastMove.first, lastMove.second);
|
||||||
ChessPiecePosition *rightPosition = currentPosition.NextRight();
|
ChessPiecePosition* leftPosition = currentPosition.NextLeft();
|
||||||
std::pair<ChessPiecePosition, ChessPiecePosition> move = chessboard->GetLastMove();
|
ChessPiecePosition* rightPosition = currentPosition.NextRight();
|
||||||
std::string difference = ChessPiecePosition::GetDifference(move.first, move.second);
|
|
||||||
|
|
||||||
if (leftPosition && chessboard->IsEmptyField(leftPosition) == false) {
|
if (leftPosition && chessboard->IsEmptyField(leftPosition) == false) {
|
||||||
ChessPiece *piece = chessboard->GetChessPiece(leftPosition);
|
ChessPiece* chessPiece = chessboard->GetChessPiece(leftPosition);
|
||||||
if (chessboard->IsEmptyField(leftPosition) == false && piece->GetColor() != this->GetColor() && piece->GetAlgebraicNotationSymbol() == 'P') {
|
|
||||||
if (piece->GetCountMoves() == 1 && difference == "B2" && piece->GetPosition() == move.second) {
|
if (chessPiece->GetColor() != this->GetColor() && chessPiece->IsPawn()) {
|
||||||
positions.insert(*topLeftPosition);
|
if (chessPiece->GetNumberOfMoves() == 1 && moveDifference == "B2" && chessPiece->GetPosition() == lastMove.second) {
|
||||||
|
ChessPiecePosition* topLeftPosition = currentPosition.NextFromString("T1L1");
|
||||||
|
|
||||||
|
if (topLeftPosition && chessboard->IsEmptyField(topLeftPosition)) {
|
||||||
|
positions.insert(*topLeftPosition);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rightPosition && chessboard->IsEmptyField(rightPosition) == false) {
|
if (rightPosition && chessboard->IsEmptyField(rightPosition) == false) {
|
||||||
ChessPiece *piece = chessboard->GetChessPiece(rightPosition);
|
ChessPiece* chessPiece = chessboard->GetChessPiece(rightPosition);
|
||||||
if (chessboard->IsEmptyField(rightPosition) == false && piece->GetColor() != this->GetColor() && piece->GetAlgebraicNotationSymbol() == 'P') {
|
|
||||||
if (piece->GetCountMoves() == 1 && difference == "B2" && piece->GetPosition() == move.second) {
|
if (chessPiece->GetColor() != this->GetColor() && chessPiece->IsPawn()) {
|
||||||
positions.insert(*topRightPosition);
|
if (chessPiece->GetNumberOfMoves() == 1 && moveDifference == "B2" && chessPiece->GetPosition() == lastMove.second) {
|
||||||
|
ChessPiecePosition* topRightPosition = currentPosition.NextFromString("T1R1");
|
||||||
|
|
||||||
|
if (topRightPosition && chessboard->IsEmptyField(topRightPosition)) {
|
||||||
|
positions.insert(*topRightPosition);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this->SetNextPositions(positions);
|
return positions;
|
||||||
}
|
}
|
||||||
|
@@ -6,10 +6,7 @@
|
|||||||
class Pawn : public ChessPiece {
|
class Pawn : public ChessPiece {
|
||||||
public:
|
public:
|
||||||
Pawn(ChessPieceColor color, ChessPiecePosition position);
|
Pawn(ChessPieceColor color, ChessPiecePosition position);
|
||||||
char GetAlgebraicNotationSymbol();
|
std::set<ChessPiecePosition> GetNextPositions(Chessboard* chessboard, std::set<ChessPiecePosition> ignore = {});
|
||||||
std::string GetCharUnicode();
|
|
||||||
static std::string GetCharUnicode(ChessPieceColor color);
|
|
||||||
void UpdateNextPositions(Chessboard* chessboard);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -1,35 +1,28 @@
|
|||||||
#include "Queen.hpp"
|
#include "Queen.hpp"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new queen with a specified color and position.
|
||||||
|
* @param color The color of the queen.
|
||||||
|
* @param position The position of the queen.
|
||||||
|
*/
|
||||||
Queen::Queen(ChessPieceColor color, ChessPiecePosition position) : ChessPiece(color, position) {
|
Queen::Queen(ChessPieceColor color, ChessPiecePosition position) : ChessPiece(color, position) {
|
||||||
|
this->_char = this->_CHAR_QUEEN;
|
||||||
|
this->_unicode = {"\u265B", "\u2655"};
|
||||||
}
|
}
|
||||||
|
|
||||||
char Queen::GetAlgebraicNotationSymbol() {
|
/**
|
||||||
return 'Q';
|
* Gets all chess piece positions the queen can move next.
|
||||||
}
|
* It is also possible to ignore several chess pieces while the next positions are calculated.
|
||||||
|
* @param chessboard A pointer to the chessboard.
|
||||||
|
* @param ignore A set of chess piece positions to be ignored.
|
||||||
|
* @return A set of chess piece positions the queen can move next.
|
||||||
|
*/
|
||||||
|
std::set<ChessPiecePosition> Queen::GetNextPositions(Chessboard* chessboard, std::set<ChessPiecePosition> ignore) {
|
||||||
|
|
||||||
std::string Queen::GetCharUnicode() {
|
// 3.4. The queen may move to any square along the file, the rank or a diagonal on which it stands.
|
||||||
return Queen::GetCharUnicode(this->GetColor());
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string Queen::GetCharUnicode(ChessPieceColor color) {
|
|
||||||
switch (color) {
|
|
||||||
case ChessPieceColor::Black:
|
|
||||||
return "\u265B";
|
|
||||||
case ChessPieceColor::White:
|
|
||||||
return "\u2655";
|
|
||||||
default:
|
|
||||||
return "\0";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Queen::UpdateNextPositions(Chessboard* chessboard) {
|
|
||||||
std::set<ChessPiecePosition> vertical = Queen::GetVerticalMoves(chessboard);
|
|
||||||
std::set<ChessPiecePosition> horizontal = Queen::GetHorizontalMoves(chessboard);
|
|
||||||
std::set<ChessPiecePosition> diagonal = Queen::GetDiagonalMoves(chessboard);
|
|
||||||
std::set<ChessPiecePosition> positions;
|
std::set<ChessPiecePosition> positions;
|
||||||
positions.insert(vertical.begin(), vertical.end());
|
positions.merge(this->GetFilePositions(chessboard, ignore));
|
||||||
positions.insert(horizontal.begin(), horizontal.end());
|
positions.merge(this->GetRankPositions(chessboard, ignore));
|
||||||
positions.insert(diagonal.begin(), diagonal.end());
|
positions.merge(this->GetDiagonalPositions(chessboard, ignore));
|
||||||
this->SetNextPositions(positions);
|
return positions;
|
||||||
}
|
}
|
||||||
|
@@ -6,10 +6,7 @@
|
|||||||
class Queen : public ChessPiece {
|
class Queen : public ChessPiece {
|
||||||
public:
|
public:
|
||||||
Queen(ChessPieceColor color, ChessPiecePosition position);
|
Queen(ChessPieceColor color, ChessPiecePosition position);
|
||||||
char GetAlgebraicNotationSymbol();
|
std::set<ChessPiecePosition> GetNextPositions(Chessboard* chessboard, std::set<ChessPiecePosition> ignore = {});
|
||||||
std::string GetCharUnicode();
|
|
||||||
static std::string GetCharUnicode(ChessPieceColor color);
|
|
||||||
void UpdateNextPositions(Chessboard* chessboard);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -1,89 +1,27 @@
|
|||||||
#include "Rook.hpp"
|
#include "Rook.hpp"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new rook with a specified color and position.
|
||||||
|
* @param color The color of the rook.
|
||||||
|
* @param position The position of the rook.
|
||||||
|
*/
|
||||||
Rook::Rook(ChessPieceColor color, ChessPiecePosition position) : ChessPiece(color, position) {
|
Rook::Rook(ChessPieceColor color, ChessPiecePosition position) : ChessPiece(color, position) {
|
||||||
|
this->_char = this->_CHAR_ROOK;
|
||||||
|
this->_unicode = {"\u265C", "\u2656"};
|
||||||
}
|
}
|
||||||
|
|
||||||
char Rook::GetAlgebraicNotationSymbol() {
|
/**
|
||||||
return 'R';
|
* Gets all chess piece positions the rook can move next.
|
||||||
}
|
* It is also possible to ignore several chess pieces while the next positions are calculated.
|
||||||
|
* @param chessboard A pointer to the chessboard.
|
||||||
|
* @param ignore A set of chess piece positions to be ignored.
|
||||||
|
* @return A set of chess piece positions the rook can move next.
|
||||||
|
*/
|
||||||
|
std::set<ChessPiecePosition> Rook::GetNextPositions(Chessboard* chessboard, std::set<ChessPiecePosition> ignore) {
|
||||||
|
|
||||||
std::string Rook::GetCharUnicode() {
|
// 3.3 The rook may move to any square along the file or the rank on which it stands.
|
||||||
return Rook::GetCharUnicode(this->GetColor());
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string Rook::GetCharUnicode(ChessPieceColor color) {
|
|
||||||
switch (color) {
|
|
||||||
case ChessPieceColor::Black:
|
|
||||||
return "\u265C";
|
|
||||||
case ChessPieceColor::White:
|
|
||||||
return "\u2656";
|
|
||||||
default:
|
|
||||||
return "\0";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Rook::UpdateNextPositions(Chessboard* chessboard) {
|
|
||||||
std::set<ChessPiecePosition> vertical = Rook::GetVerticalMoves(chessboard);
|
|
||||||
std::set<ChessPiecePosition> horizontal = Rook::GetHorizontalMoves(chessboard);
|
|
||||||
std::set<ChessPiecePosition> positions;
|
std::set<ChessPiecePosition> positions;
|
||||||
positions.insert(vertical.begin(), vertical.end());
|
positions.merge(this->GetFilePositions(chessboard, ignore));
|
||||||
positions.insert(horizontal.begin(), horizontal.end());
|
positions.merge(this->GetRankPositions(chessboard, ignore));
|
||||||
|
return positions;
|
||||||
// Rochade
|
|
||||||
// König noch nicht gezogen!
|
|
||||||
// Turm noch nicht gezogen!
|
|
||||||
// König über kein Feld gezogen wird, welches bedroht ist.
|
|
||||||
// König steht nicht vorher und nicht nachher im Schach.
|
|
||||||
|
|
||||||
ChessPiecePosition currentPosition = this->GetPosition();
|
|
||||||
ChessPiecePosition* nextPosition = ¤tPosition;
|
|
||||||
ChessPiecePosition* targetPositionRook = currentPosition.NextFromString("L2");
|
|
||||||
|
|
||||||
// Kurze Rochade
|
|
||||||
if (currentPosition.GetFile() == 'H') { // Kurze Rochade
|
|
||||||
if (this->IsFirstMove()) { // Turm noch nicht gezogen!
|
|
||||||
bool valid = false;
|
|
||||||
while(nextPosition = nextPosition->NextLeft()) {
|
|
||||||
if (chessboard->IsEmptyField(nextPosition) == false) {
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
//Die Position ist leer darf aber nicht bedroht sein.
|
|
||||||
//König und Turm dürfen immer nur am Ende berechnet werden.
|
|
||||||
}
|
|
||||||
if (*nextPosition == *targetPositionRook) {
|
|
||||||
valid = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (valid) { // Die Felder bis zur neuen Position sind frei!
|
|
||||||
ChessPiecePosition* kingsPosition = targetPositionRook->NextLeft();
|
|
||||||
ChessPiecePosition* targetPositionKing = kingsPosition->NextFromString("R2");
|
|
||||||
ChessPiece* king = chessboard->GetChessPiece(kingsPosition);
|
|
||||||
|
|
||||||
if (king && king->IsFirstMove()) {
|
|
||||||
if (king->GetNextPositions().count(*targetPositionKing) == 1) {
|
|
||||||
positions.insert(*targetPositionRook);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Lange Rochade
|
|
||||||
if (this->GetPosition().GetFile() == 'A') { // Lange Rochade
|
|
||||||
if (this->IsFirstMove()) { // Turm noch nicht gezogen!
|
|
||||||
// Ähnlich zur kurzen. Es müssen aber erst noch die Grundlagen gecheckt werden.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Rochade
|
|
||||||
// Nicht möglich wenn König im Schach
|
|
||||||
// Die beteiligten Figuren dürfen nicht bewegt worden sein.
|
|
||||||
// König darf auch nicht durch ein Feld "rutschen" welches für ihn bedroht ist.
|
|
||||||
|
|
||||||
this->SetNextPositions(positions);
|
|
||||||
}
|
}
|
||||||
|
@@ -6,10 +6,7 @@
|
|||||||
class Rook : public ChessPiece {
|
class Rook : public ChessPiece {
|
||||||
public:
|
public:
|
||||||
Rook(ChessPieceColor color, ChessPiecePosition position);
|
Rook(ChessPieceColor color, ChessPiecePosition position);
|
||||||
char GetAlgebraicNotationSymbol() override;
|
std::set<ChessPiecePosition> GetNextPositions(Chessboard* chessboard, std::set<ChessPiecePosition> ignore = {});
|
||||||
std::string GetCharUnicode() override;
|
|
||||||
static std::string GetCharUnicode(ChessPieceColor color);
|
|
||||||
void UpdateNextPositions(Chessboard* chessboard);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -111,16 +111,6 @@ void Chessboard::draw (const std::vector<std::vector<char>>& chessboard) {
|
|||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ToDo:
|
|
||||||
// Methode um mögliche Züge anzuzeigen
|
|
||||||
// Rochade
|
|
||||||
// Mate
|
|
||||||
// Schachmate
|
|
||||||
// En Passond
|
|
||||||
// Restlichen moves
|
|
||||||
// Angabe mit Menü Optionen als Zahlen
|
|
||||||
// Figuren wählen mit Schachnotation
|
|
||||||
|
|
||||||
void Chessboard::init() {
|
void Chessboard::init() {
|
||||||
Chessboard::initPieces();
|
Chessboard::initPieces();
|
||||||
}
|
}
|
||||||
@@ -204,9 +194,6 @@ char Chessboard::getCorrectPiece(char pieceIdentifier) {
|
|||||||
|
|
||||||
//
|
//
|
||||||
void Chessboard::move(std::string move) {
|
void Chessboard::move(std::string move) {
|
||||||
// ToDo:
|
|
||||||
// add move to history queue
|
|
||||||
|
|
||||||
std::vector<std::string> splitMove;
|
std::vector<std::string> splitMove;
|
||||||
|
|
||||||
if (move.find('#') != std::string::npos) {
|
if (move.find('#') != std::string::npos) {
|
||||||
|
10
Chessboard.h
10
Chessboard.h
@@ -111,16 +111,6 @@ class Chessboard {
|
|||||||
|
|
||||||
void draw (const std::vector<std::vector<char>>& chessboard);
|
void draw (const std::vector<std::vector<char>>& chessboard);
|
||||||
|
|
||||||
// ToDo:
|
|
||||||
// Methode um mögliche Züge anzuzeigen
|
|
||||||
// Rochade
|
|
||||||
// Mate
|
|
||||||
// Schachmate
|
|
||||||
// En Passond
|
|
||||||
// Restlichen moves
|
|
||||||
// Angabe mit Menü Optionen als Zahlen
|
|
||||||
// Figuren wählen mit Schachnotation
|
|
||||||
|
|
||||||
void init();
|
void init();
|
||||||
|
|
||||||
void initPieces();
|
void initPieces();
|
||||||
|
@@ -1,11 +1,57 @@
|
|||||||
|
#include <memory>
|
||||||
|
#include <set>
|
||||||
#include "../Chessboard/Chessboard.hpp"
|
#include "../Chessboard/Chessboard.hpp"
|
||||||
#include "../ChessPieces/ChessPiece.hpp"
|
#include "../ChessPieces/ChessPiece.hpp"
|
||||||
|
#include "../ChessPieces/Knight.hpp"
|
||||||
|
#include "../ChessPieces/Bishop.hpp"
|
||||||
|
#include "../ChessPieces/King.hpp"
|
||||||
|
#include "../ChessPieces/Pawn.hpp"
|
||||||
|
#include "../ChessPieces/Queen.hpp"
|
||||||
|
#include "../ChessPieces/Rook.hpp"
|
||||||
|
|
||||||
void Chessboard::SetChessPiece(ChessPiece* const &chesspiece) {
|
void Chessboard::InitializeStartBoard() {
|
||||||
this->chessboard[chesspiece->GetPosition()] = chesspiece;
|
Chessboard::InitializeBoard(defaultBoard);
|
||||||
std::cout << "Chess Piece " << chesspiece->GetAlgebraicNotationSymbol() << " placed at " << chesspiece->GetPosition().ToString() << std::endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Chessboard::InitializeBoard(std::set<Board_ChessPiece> board) {
|
||||||
|
for (const auto& piece : board) {
|
||||||
|
ChessPiecePosition pos = ChessPiecePosition(piece.position.first, piece.position.second);
|
||||||
|
ChessPieceColor color = (piece.color == 0) ? ChessPieceColor::Black : ChessPieceColor::White;
|
||||||
|
|
||||||
|
switch (piece.type) {
|
||||||
|
case 'R':
|
||||||
|
SetChessPiece(new Rook(color, pos));
|
||||||
|
break;
|
||||||
|
case 'N':
|
||||||
|
SetChessPiece(new Knight(color, pos));
|
||||||
|
break;
|
||||||
|
case 'B':
|
||||||
|
SetChessPiece(new Bishop(color, pos));
|
||||||
|
break;
|
||||||
|
case 'Q':
|
||||||
|
SetChessPiece(new Queen(color, pos));
|
||||||
|
break;
|
||||||
|
case 'K':
|
||||||
|
SetChessPiece(new King(color, pos));
|
||||||
|
break;
|
||||||
|
case 'P':
|
||||||
|
SetChessPiece(new Pawn(color, pos));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
std::cout << "Invalid ChessPieceType!" << std::endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Chessboard::SetChessPiece(ChessPiece* chesspiece) {
|
||||||
|
this->chessboard[chesspiece->GetPosition()] = chesspiece;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*void Chessboard::SetChessPiece(std::unique_ptr<ChessPiece> piece) {
|
||||||
|
this->chessboard[piece->GetPosition()] = piece.release();
|
||||||
|
}*/
|
||||||
|
|
||||||
bool Chessboard::IsEmptyField(ChessPiecePosition* position) {
|
bool Chessboard::IsEmptyField(ChessPiecePosition* position) {
|
||||||
return (this->chessboard.count(*position) == 0);
|
return (this->chessboard.count(*position) == 0);
|
||||||
}
|
}
|
||||||
@@ -14,13 +60,6 @@ ChessPiece* Chessboard::GetChessPiece(ChessPiecePosition* position) {
|
|||||||
return this->chessboard.at(*position);
|
return this->chessboard.at(*position);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Chessboard::UpdateChessPieces() {
|
|
||||||
for (auto const& field : chessboard) {
|
|
||||||
field.second->UpdateNextPositions(this);
|
|
||||||
std::cout << "calculated moves of " << field.second->GetAlgebraicNotationSymbol() << " at position " << field.second->GetPosition().ToString() << ": " << field.second->GetNextPositions().size() << std::endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Chessboard::MoveChessPiece(std::string move) {
|
void Chessboard::MoveChessPiece(std::string move) {
|
||||||
if (move.length() == 5) {
|
if (move.length() == 5) {
|
||||||
ChessPiecePosition* fromPosition = new ChessPiecePosition(move.substr(0, 2));
|
ChessPiecePosition* fromPosition = new ChessPiecePosition(move.substr(0, 2));
|
||||||
@@ -28,15 +67,22 @@ void Chessboard::MoveChessPiece(std::string move) {
|
|||||||
|
|
||||||
ChessPiece* piece = this->GetChessPiece(fromPosition);
|
ChessPiece* piece = this->GetChessPiece(fromPosition);
|
||||||
|
|
||||||
|
if (piece->GetColor() != this->GetCurrentPlayer()->GetColor()) {
|
||||||
|
return; // wrong player
|
||||||
|
}
|
||||||
|
|
||||||
if (piece->GetNextPositions().count(*toPosition) == 1) {
|
if (piece->GetNextPositions().count(*toPosition) == 1) {
|
||||||
this->chessboard[*toPosition] = this->chessboard[*fromPosition];
|
this->chessboard[*toPosition] = this->chessboard[*fromPosition];
|
||||||
this->chessboard.erase(*fromPosition);
|
this->chessboard.erase(*fromPosition);
|
||||||
piece->SetPosition(*toPosition);
|
piece->SetPosition(*toPosition);
|
||||||
this->SetToHistory(*fromPosition, *toPosition);
|
this->SetToHistory(*fromPosition, *toPosition);
|
||||||
|
} else {
|
||||||
|
return; // wrong or invalid move
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this->UpdateChessPieces();
|
this->UpdateChessPieces();
|
||||||
|
this->SwitchCurrentPlayer();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Chessboard::SetToHistory(ChessPiecePosition fromPosition, ChessPiecePosition toPosition) {
|
void Chessboard::SetToHistory(ChessPiecePosition fromPosition, ChessPiecePosition toPosition) {
|
||||||
@@ -51,15 +97,245 @@ std::pair<ChessPiecePosition, ChessPiecePosition> Chessboard::GetLastMove() {
|
|||||||
return this->history.back();
|
return this->history.back();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Chessboard::IsCheck() {
|
std::vector<ChessPiece*> Chessboard::GetChessPieces() {
|
||||||
|
std::vector<ChessPiece*> chessPieces;
|
||||||
|
|
||||||
|
for (std::pair<ChessPiecePosition, ChessPiece*> field : this->chessboard) {
|
||||||
|
chessPieces.push_back(field.second);
|
||||||
|
}
|
||||||
|
|
||||||
|
return chessPieces;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Chessboard::IsCheck() {
|
||||||
|
ChessPiece* chessPieceKing = this->GetChessPieceKing(this->GetCurrentPlayer()->GetColor());
|
||||||
|
|
||||||
|
for (std::pair<ChessPiecePosition, ChessPiece*> field : this->chessboard) {
|
||||||
|
if (field.second->GetColor() == this->GetOpponentPlayer()->GetColor()) {
|
||||||
|
if (field.second->GetNextPositions().count(chessPieceKing->GetPosition()) == 1) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Chessboard::IsCheckmate() {
|
bool Chessboard::IsCheckmate() {
|
||||||
|
|
||||||
|
if (this->IsCheck() == false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
ChessPiece* chessPieceKing = this->GetChessPieceKing(this->GetCurrentPlayer()->GetColor());
|
||||||
|
|
||||||
|
if (chessPieceKing->GetNextPositions().size() > 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int cntAttacker = 0;
|
||||||
|
|
||||||
|
for (ChessPiece* chessPieceOpponent : this->GetChessPieces()) {
|
||||||
|
if (chessPieceOpponent->GetColor() == this->GetOpponentPlayer()->GetColor()) {
|
||||||
|
if (chessPieceOpponent->GetNextPositions().count(chessPieceKing->GetPosition()) == 1) { // Is an attacker
|
||||||
|
cntAttacker++;
|
||||||
|
|
||||||
|
bool deniable = false;
|
||||||
|
|
||||||
|
// remove attacker
|
||||||
|
for (ChessPiece* chessPieceCurrent : this->GetChessPieces()) {
|
||||||
|
if (chessPieceCurrent->GetColor() == this->GetCurrentPlayer()->GetColor()) {
|
||||||
|
if (chessPieceCurrent->GetNextPositions().count(chessPieceOpponent->GetPosition()) == 1) {
|
||||||
|
deniable = true; // blocked attack because current player can remove attacker
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (deniable == false) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// move between attacker and king
|
||||||
|
// this is not possible for pawn, knight and king because they beat on next field.
|
||||||
|
|
||||||
|
std::string step = ChessPiecePosition::GetStep(chessPieceOpponent->GetPosition(), chessPieceKing->GetPosition());
|
||||||
|
|
||||||
|
ChessPiecePosition currentPosition = chessPieceOpponent->GetPosition();
|
||||||
|
ChessPiecePosition* nextPosition = ¤tPosition;
|
||||||
|
deniable = false;
|
||||||
|
|
||||||
|
while (nextPosition = nextPosition->NextFromString(step)) {
|
||||||
|
for (ChessPiece* chessPieceCurrent : this->GetChessPieces()) {
|
||||||
|
if (chessPieceCurrent->GetColor() == this->GetCurrentPlayer()->GetColor()) {
|
||||||
|
if (chessPieceCurrent->GetNextPositions().count(*nextPosition) == 1) {
|
||||||
|
deniable = true; // blocked attack because current player can block between attacker and king
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (deniable == false) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cntAttacker > 1) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Chessboard::IsStalemate() {
|
bool Chessboard::IsStalemate() {
|
||||||
// Der König steht nicht im Schach oder Schachmatt.
|
ChessPieceColor currentColor = this->GetCurrentPlayer()->GetColor();
|
||||||
|
ChessPieceColor opponentColor = this->GetOpponentPlayer()->GetColor();
|
||||||
|
ChessPiece* chessPieceKing;
|
||||||
|
|
||||||
|
for (std::pair<ChessPiecePosition, ChessPiece*> field : this->chessboard) {
|
||||||
|
if (field.second->IsKing() && field.second->GetColor() == currentColor) {
|
||||||
|
chessPieceKing = field.second;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Der König hat aber auch keine validen Züge mehr.
|
// Der König hat aber auch keine validen Züge mehr.
|
||||||
|
if (chessPieceKing->GetNextPositions().size() > 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Man hat selbst keine Figuren mehr welche noch ziehen könnten.
|
||||||
|
for (std::pair<ChessPiecePosition, ChessPiece*> field : this->chessboard) {
|
||||||
|
if (field.second->GetColor() == currentColor) {
|
||||||
|
if (field.second->GetNextPositions().size() > 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// König wird nicht direkt attackiert.
|
||||||
|
for (std::pair<ChessPiecePosition, ChessPiece*> field : this->chessboard) {
|
||||||
|
if (field.second->GetColor() == opponentColor) {
|
||||||
|
if (field.second->GetNextPositions().count(chessPieceKing->GetPosition()) == 1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the current player.
|
||||||
|
*/
|
||||||
|
Player* Chessboard::GetCurrentPlayer() {
|
||||||
|
return this->currentPlayer;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the opponent player.
|
||||||
|
*/
|
||||||
|
Player* Chessboard::GetOpponentPlayer() {
|
||||||
|
if (this->GetCurrentPlayer()->GetColor() == ChessPieceColor::Black) {
|
||||||
|
return this->GetPlayer(ChessPieceColor::White);
|
||||||
|
} else {
|
||||||
|
return this->GetPlayer(ChessPieceColor::Black);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a player by color.
|
||||||
|
* @return Player* The player who is associated with the given color.
|
||||||
|
*/
|
||||||
|
Player* Chessboard::GetPlayer(ChessPieceColor color) {
|
||||||
|
if (color == ChessPieceColor::Black) {
|
||||||
|
return std::get<ChessPieceColor::Black>(this->players);
|
||||||
|
} else {
|
||||||
|
return std::get<ChessPieceColor::White>(this->players);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the players to the chessboard.
|
||||||
|
* This function also determines the starting player.
|
||||||
|
* @param Player* playerA The first player.
|
||||||
|
* @param Player* playerB The second player.
|
||||||
|
*/
|
||||||
|
void Chessboard::SetPlayers(Player* playerA, Player* playerB) {
|
||||||
|
std::random_device rngdevice;
|
||||||
|
std::mt19937 generator(rngdevice());
|
||||||
|
std::uniform_int_distribution<int> distr(0, 1);
|
||||||
|
|
||||||
|
if (distr(generator) == 0) { // 0 = A starts (white)
|
||||||
|
this->players = {playerB, playerA};
|
||||||
|
} else { // 1 = B starts (white)
|
||||||
|
this->players = {playerA, playerB};
|
||||||
|
}
|
||||||
|
|
||||||
|
this->GetPlayer(ChessPieceColor::White)->SetColor(ChessPieceColor::White);
|
||||||
|
this->GetPlayer(ChessPieceColor::Black)->SetColor(ChessPieceColor::Black);
|
||||||
|
this->currentPlayer = this->GetPlayer(ChessPieceColor::White);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Switch the current player.
|
||||||
|
*/
|
||||||
|
void Chessboard::SwitchCurrentPlayer() {
|
||||||
|
if (this->GetCurrentPlayer()->GetColor() == ChessPieceColor::White) {
|
||||||
|
this->currentPlayer = this->GetPlayer(ChessPieceColor::Black);
|
||||||
|
} else {
|
||||||
|
this->currentPlayer = this->GetPlayer(ChessPieceColor::White);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the next positions of all chess pieces.
|
||||||
|
*/
|
||||||
|
void Chessboard::UpdateChessPieces() {
|
||||||
|
for (char chessPieceCode : {'B', 'N', 'P', 'Q', 'R', 'K'}) {
|
||||||
|
for (std::pair<ChessPiecePosition, ChessPiece*> field : this->chessboard) {
|
||||||
|
if (field.second->GetChar() == chessPieceCode) {
|
||||||
|
field.second->UpdateNextPositions(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check whether a given position is under attack.
|
||||||
|
* @param ChessPiecePosition position The position which should be checked.
|
||||||
|
* @param ChessPieceColor color The color that attacks (opponent color).
|
||||||
|
* @return bool The status whether the given position is under attack.
|
||||||
|
*/
|
||||||
|
bool Chessboard::IsPositionUnderAttack(ChessPiecePosition position, ChessPieceColor color) {
|
||||||
|
for (std::pair<ChessPiecePosition, ChessPiece*> field : this->chessboard) {
|
||||||
|
if (field.second->GetColor() == color && field.second->GetNextPositions().count(position) == 1) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Chessboard::~Chessboard() {
|
||||||
|
for (std::pair<ChessPiecePosition, ChessPiece*> field : this->chessboard) {
|
||||||
|
delete field.second;
|
||||||
|
}
|
||||||
|
this->chessboard.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
ChessPiece* Chessboard::GetChessPieceKing(ChessPieceColor color) {
|
||||||
|
ChessPiece* chessPieceKing;
|
||||||
|
|
||||||
|
for (ChessPiece* chessPiece : this->GetChessPieces()) {
|
||||||
|
if (chessPiece->IsKing() && chessPiece->GetColor() == color) {
|
||||||
|
chessPieceKing = chessPiece;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return chessPieceKing;
|
||||||
}
|
}
|
||||||
|
@@ -3,9 +3,14 @@
|
|||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <random>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <set>
|
||||||
|
#include <memory>
|
||||||
|
#include "../Player/Player.hpp"
|
||||||
|
#include "../ChessPieces/ChessPieceColor.hpp"
|
||||||
#include "../ChessPieces/ChessPiecePosition.hpp"
|
#include "../ChessPieces/ChessPiecePosition.hpp"
|
||||||
|
|
||||||
class ChessPiece;
|
class ChessPiece;
|
||||||
@@ -14,11 +19,70 @@ class Chessboard {
|
|||||||
private:
|
private:
|
||||||
std::map<ChessPiecePosition, ChessPiece*> chessboard;
|
std::map<ChessPiecePosition, ChessPiece*> chessboard;
|
||||||
std::vector<std::pair<ChessPiecePosition, ChessPiecePosition>> history;
|
std::vector<std::pair<ChessPiecePosition, ChessPiecePosition>> history;
|
||||||
|
std::pair<Player*, Player*> players;
|
||||||
|
Player* currentPlayer;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void SetChessPiece(ChessPiece* const &chesspiece);
|
struct Board_ChessPiece {
|
||||||
|
int color;
|
||||||
|
char type;
|
||||||
|
std::pair<char, int> position;
|
||||||
|
|
||||||
|
Board_ChessPiece(const int& c, const char& t, std::pair<char,int> p) : color(c), type(t), position(p) {}
|
||||||
|
|
||||||
|
bool operator<(const Board_ChessPiece& other) const {
|
||||||
|
if (position != other.position) {
|
||||||
|
return position < other.position;
|
||||||
|
}
|
||||||
|
if (color != other.color) {
|
||||||
|
return color < other.color;
|
||||||
|
}
|
||||||
|
return type < other.type;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
inline static const std::set<Board_ChessPiece> defaultBoard = {
|
||||||
|
{0, 'P', {'A', 7}},
|
||||||
|
{0, 'P', {'B', 7}},
|
||||||
|
{0, 'P', {'C', 7}},
|
||||||
|
{0, 'P', {'D', 7}},
|
||||||
|
{0, 'P', {'E', 7}},
|
||||||
|
{0, 'P', {'F', 7}},
|
||||||
|
{0, 'P', {'G', 7}},
|
||||||
|
{0, 'P', {'H', 7}},
|
||||||
|
{0, 'R', {'A', 8}},
|
||||||
|
{0, 'K', {'B', 8}},
|
||||||
|
{0, 'B', {'C', 8}},
|
||||||
|
{0, 'Q', {'D', 8}},
|
||||||
|
{0, 'K', {'E', 8}},
|
||||||
|
{0, 'B', {'F', 8}},
|
||||||
|
{0, 'K', {'G', 8}},
|
||||||
|
{0, 'R', {'H', 8}},
|
||||||
|
|
||||||
|
{1, 'P', {'A', 2}},
|
||||||
|
{1, 'P', {'B', 2}},
|
||||||
|
{1, 'P', {'C', 2}},
|
||||||
|
{1, 'P', {'D', 2}},
|
||||||
|
{1, 'P', {'E', 2}},
|
||||||
|
{1, 'P', {'F', 2}},
|
||||||
|
{1, 'P', {'G', 2}},
|
||||||
|
{1, 'P', {'H', 2}},
|
||||||
|
{1, 'R', {'A', 1}},
|
||||||
|
{1, 'N', {'B', 1}},
|
||||||
|
{1, 'B', {'C', 1}},
|
||||||
|
{1, 'Q', {'D', 1}},
|
||||||
|
{1, 'K', {'E', 1}},
|
||||||
|
{1, 'B', {'F', 1}},
|
||||||
|
{1, 'K', {'G', 1}},
|
||||||
|
{1, 'R', {'H', 1}}
|
||||||
|
};
|
||||||
|
~Chessboard();
|
||||||
|
void InitializeStartBoard();
|
||||||
|
void InitializeBoard(std::set<Board_ChessPiece> board);
|
||||||
|
//void SetChessPiece(std::unique_ptr<ChessPiece> piece);
|
||||||
|
void SetChessPiece(ChessPiece* chesspiece);
|
||||||
bool IsEmptyField(ChessPiecePosition* position);
|
bool IsEmptyField(ChessPiecePosition* position);
|
||||||
ChessPiece* GetChessPiece(ChessPiecePosition* position);
|
ChessPiece* GetChessPiece(ChessPiecePosition* position);
|
||||||
|
std::vector<ChessPiece*> GetChessPieces();
|
||||||
void UpdateChessPieces();
|
void UpdateChessPieces();
|
||||||
void MoveChessPiece(std::string move);
|
void MoveChessPiece(std::string move);
|
||||||
void SetToHistory(ChessPiecePosition fromPosition, ChessPiecePosition toPosition);
|
void SetToHistory(ChessPiecePosition fromPosition, ChessPiecePosition toPosition);
|
||||||
@@ -27,6 +91,13 @@ class Chessboard {
|
|||||||
bool IsCheckmate();
|
bool IsCheckmate();
|
||||||
bool IsCheck();
|
bool IsCheck();
|
||||||
bool IsStalemate();
|
bool IsStalemate();
|
||||||
|
bool IsPositionUnderAttack(ChessPiecePosition position, ChessPieceColor color);
|
||||||
|
Player* GetCurrentPlayer();
|
||||||
|
Player* GetOpponentPlayer();
|
||||||
|
void SetPlayers(Player* playerA, Player* playerB);
|
||||||
|
void SwitchCurrentPlayer();
|
||||||
|
Player* GetPlayer(ChessPieceColor color);
|
||||||
|
ChessPiece* GetChessPieceKing(ChessPieceColor color);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
1
Chessboard/ChessboardVisualizer.cpp
Normal file
1
Chessboard/ChessboardVisualizer.cpp
Normal file
@@ -0,0 +1 @@
|
|||||||
|
//#include "../Chessboard/ChessboardVisualizer.hpp"
|
13
Chessboard/ChessboardVisualizer.hpp
Normal file
13
Chessboard/ChessboardVisualizer.hpp
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
/*#ifndef ChessboardVisualizer_H
|
||||||
|
#define ChessboardVisualizer_H
|
||||||
|
|
||||||
|
#include "../ChessPieces/ChessPiece.hpp"
|
||||||
|
#include "../Chessboard/Chessboard.hpp"
|
||||||
|
|
||||||
|
class ChessboardVisualizer {
|
||||||
|
public:
|
||||||
|
ChessboardVisualizer() = default;
|
||||||
|
virtual void Draw(Chessboard* chessboard) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif*/
|
317
Chessboard/ChessboardVisualizerGraphic.cpp
Normal file
317
Chessboard/ChessboardVisualizerGraphic.cpp
Normal file
@@ -0,0 +1,317 @@
|
|||||||
|
#include "../Chessboard/ChessboardVisualizerGraphic.hpp"
|
||||||
|
#include "../ChessPieces/ChessPiecePosition.hpp"
|
||||||
|
#include "../Visualizer/HistorieVisualizer.hpp"
|
||||||
|
#include "../Visualizer/BaseVisualizer.hpp"
|
||||||
|
|
||||||
|
/*void ChessboardVisualizerGraphic::SetConsoleColor(Colors foreground, Colors background) {
|
||||||
|
const std::string SEQ_FOREGROUND = "\x1b[3";
|
||||||
|
const std::string SEQ_FOREGROUND_LIGHT = "\x1b[9";
|
||||||
|
const std::string SEQ_BACKGROUND = "\x1b[4";
|
||||||
|
const std::string SEQ_BACKGROUND_LIGHT = "\x1b[10";
|
||||||
|
|
||||||
|
// set foreground color
|
||||||
|
switch (foreground) {
|
||||||
|
case BLACK:
|
||||||
|
case RED:
|
||||||
|
case GREEN:
|
||||||
|
case YELLOW:
|
||||||
|
case BLUE:
|
||||||
|
case MAGENTA:
|
||||||
|
case CYAN:
|
||||||
|
case WHITE:
|
||||||
|
std::cout << SEQ_FOREGROUND << foreground << "m";
|
||||||
|
break;
|
||||||
|
case LIGHT_BLACK:
|
||||||
|
case LIGHT_RED:
|
||||||
|
case LIGHT_GREEN:
|
||||||
|
case LIGHT_YELLOW:
|
||||||
|
case LIGHT_BLUE:
|
||||||
|
case LIGHT_MAGENTA:
|
||||||
|
case LIGHT_CYAN:
|
||||||
|
case LIGHT_WHITE:
|
||||||
|
std::cout << SEQ_FOREGROUND_LIGHT << foreground << "m";
|
||||||
|
break;
|
||||||
|
case DEFAULT:
|
||||||
|
default:
|
||||||
|
std::cout << SEQ_FOREGROUND << foreground << "m";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// set background color
|
||||||
|
switch (background) {
|
||||||
|
case BLACK:
|
||||||
|
case RED:
|
||||||
|
case GREEN:
|
||||||
|
case YELLOW:
|
||||||
|
case BLUE:
|
||||||
|
case MAGENTA:
|
||||||
|
case CYAN:
|
||||||
|
case WHITE:
|
||||||
|
std::cout << SEQ_BACKGROUND << background << "m";
|
||||||
|
break;
|
||||||
|
case LIGHT_BLACK:
|
||||||
|
case LIGHT_RED:
|
||||||
|
case LIGHT_GREEN:
|
||||||
|
case LIGHT_YELLOW:
|
||||||
|
case LIGHT_BLUE:
|
||||||
|
case LIGHT_MAGENTA:
|
||||||
|
case LIGHT_CYAN:
|
||||||
|
case LIGHT_WHITE:
|
||||||
|
std::cout << SEQ_BACKGROUND_LIGHT << background << "m";
|
||||||
|
break;
|
||||||
|
case DEFAULT:
|
||||||
|
default:
|
||||||
|
std::cout << SEQ_BACKGROUND << background << "m";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ChessboardVisualizerGraphic::temp(Chessboard* chessboard) {
|
||||||
|
for (int rank = 8; rank >= 1; rank--) {
|
||||||
|
if (rank == 8) GenerateTopOrBottomBorder(true);
|
||||||
|
|
||||||
|
std::vector<std::string> temp;
|
||||||
|
|
||||||
|
for (int heightOfField = 0; heightOfField < 3; heightOfField++) {
|
||||||
|
for (char file = 'A'; file <= 'H'; file++) {
|
||||||
|
if (file == 'A') {
|
||||||
|
temp.push_back((heightOfField == 1) ? " " + std::to_string(rank) + " " : " ");
|
||||||
|
temp.push_back(ChessboardVisualizerGraphic::VERTICAL_LINE);
|
||||||
|
}
|
||||||
|
|
||||||
|
temp.push_back(GenerateBoardField(chessboard, file, rank, heightOfField));
|
||||||
|
|
||||||
|
if (file == 'H') {
|
||||||
|
this->SetConsoleColor(DEFAULT, DEFAULT);
|
||||||
|
temp.push_back(ChessboardVisualizerGraphic::VERTICAL_LINE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
AddRowToBoard(temp);
|
||||||
|
temp.clear();
|
||||||
|
this->SetConsoleColor(DEFAULT, DEFAULT);
|
||||||
|
}
|
||||||
|
if (rank == 1) GenerateTopOrBottomBorder(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ChessboardVisualizerGraphic::AddMenusToChessboard() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void ChessboardVisualizerGraphic::GenerateChessboard(Chessboard* chessboard) {
|
||||||
|
ClearTerminal();
|
||||||
|
|
||||||
|
board.clear();
|
||||||
|
|
||||||
|
GeneratePlayers(chessboard);
|
||||||
|
|
||||||
|
temp(chessboard);
|
||||||
|
|
||||||
|
AddMenusToChessboard();
|
||||||
|
|
||||||
|
/*HistorieVisualizer history = HistorieVisualizer(15, 3, "Me", "Me");
|
||||||
|
|
||||||
|
std::vector<std::vector<std::string>> historyDisplayVector = history.GetDisplayVector();
|
||||||
|
std::vector<std::vector<std::string>> currentBoard = board;
|
||||||
|
|
||||||
|
for (size_t i = 0; i < historyDisplayVector.size(); i++) {
|
||||||
|
for (size_t j = 0; j < historyDisplayVector[i].size(); j++) {
|
||||||
|
board[i].push_back(" " + historyDisplayVector[i][j]);
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*this->SetConsoleColor(DEFAULT, DEFAULT);
|
||||||
|
DrawFromVector();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ChessboardVisualizerGraphic::Draw(Chessboard* chessboard) {
|
||||||
|
ClearTerminal();
|
||||||
|
|
||||||
|
DrawPlayers(chessboard);
|
||||||
|
|
||||||
|
for (int rank = 8; rank >= 1; rank--) {
|
||||||
|
if (rank == 8) DrawTopOrBottomBorder(true);
|
||||||
|
|
||||||
|
for (int heightOfField = 0; heightOfField < 3; heightOfField++) {
|
||||||
|
for (char file = 'A'; file <= 'H'; file++) {
|
||||||
|
if (file == 'A') {
|
||||||
|
(heightOfField == 1) ? std::cout << " " << rank << " " : std::cout << " ";
|
||||||
|
std::cout << ChessboardVisualizerGraphic::VERTICAL_LINE;
|
||||||
|
}
|
||||||
|
|
||||||
|
DrawBoardField(chessboard, file, rank, heightOfField);
|
||||||
|
|
||||||
|
if (file == 'H') {
|
||||||
|
this->SetConsoleColor(DEFAULT, DEFAULT);
|
||||||
|
std::cout << ChessboardVisualizerGraphic::VERTICAL_LINE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this->SetConsoleColor(DEFAULT, DEFAULT);
|
||||||
|
std::cout << std::endl;
|
||||||
|
}
|
||||||
|
if (rank == 1) DrawTopOrBottomBorder(false);
|
||||||
|
}
|
||||||
|
this->SetConsoleColor(DEFAULT, DEFAULT);
|
||||||
|
std::cout << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ChessboardVisualizerGraphic::GenerateTopOrBottomBorder(bool top) {
|
||||||
|
std::vector<std::string> temp;
|
||||||
|
|
||||||
|
temp.push_back(" ");
|
||||||
|
|
||||||
|
std::string left = (top) ? ChessboardVisualizerGraphic::TOP_LEFT_CORNER : ChessboardVisualizerGraphic::BOTTOM_LEFT_CORNER;
|
||||||
|
temp.push_back(left);
|
||||||
|
|
||||||
|
for (int i = 0; i < 8; i++) {
|
||||||
|
temp.push_back(ChessboardVisualizerGraphic::HORIZONTAL_LINE + ChessboardVisualizerGraphic::HORIZONTAL_LINE + ChessboardVisualizerGraphic::HORIZONTAL_LINE + ChessboardVisualizerGraphic::HORIZONTAL_LINE + ChessboardVisualizerGraphic::HORIZONTAL_LINE + ChessboardVisualizerGraphic::HORIZONTAL_LINE + ChessboardVisualizerGraphic::HORIZONTAL_LINE);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string right = (top) ? ChessboardVisualizerGraphic::TOP_RIGHT_CORNER : ChessboardVisualizerGraphic::BOTTOM_RIGHT_CORNER;
|
||||||
|
temp.push_back(right);
|
||||||
|
|
||||||
|
AddRowToBoard(temp);
|
||||||
|
if (!top) GenerateFiles();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ChessboardVisualizerGraphic::DrawTopOrBottomBorder(bool top) {
|
||||||
|
std::cout << " ";
|
||||||
|
|
||||||
|
std::string left = (top) ? ChessboardVisualizerGraphic::TOP_LEFT_CORNER : ChessboardVisualizerGraphic::BOTTOM_LEFT_CORNER;
|
||||||
|
std::cout << left;
|
||||||
|
|
||||||
|
for (int i = 0; i < 8; i++) {
|
||||||
|
std::cout << ChessboardVisualizerGraphic::HORIZONTAL_LINE << ChessboardVisualizerGraphic::HORIZONTAL_LINE << ChessboardVisualizerGraphic::HORIZONTAL_LINE << ChessboardVisualizerGraphic::HORIZONTAL_LINE << ChessboardVisualizerGraphic::HORIZONTAL_LINE << ChessboardVisualizerGraphic::HORIZONTAL_LINE << ChessboardVisualizerGraphic::HORIZONTAL_LINE;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string right = (top) ? ChessboardVisualizerGraphic::TOP_RIGHT_CORNER : ChessboardVisualizerGraphic::BOTTOM_RIGHT_CORNER;
|
||||||
|
std::cout << right;
|
||||||
|
|
||||||
|
std::cout << std::endl;
|
||||||
|
if (!top) DrawFiles();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ChessboardVisualizerGraphic::GenerateFiles() {
|
||||||
|
std::vector<std::string> temp;
|
||||||
|
|
||||||
|
for (char file = 'A'; file <= 'H'; file++) {
|
||||||
|
if (file == 'A') {
|
||||||
|
temp.push_back(" ");
|
||||||
|
}
|
||||||
|
|
||||||
|
temp.push_back(" " + std::string(1, file) + " ");
|
||||||
|
|
||||||
|
if (file == 'H') {
|
||||||
|
temp.push_back(" ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
AddRowToBoard(temp);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ChessboardVisualizerGraphic::DrawFiles() {
|
||||||
|
for (char file = 'A'; file <= 'H'; file++) {
|
||||||
|
if (file == 'A') {
|
||||||
|
std::cout << " ";
|
||||||
|
}
|
||||||
|
|
||||||
|
std::cout << " " << file << " ";
|
||||||
|
|
||||||
|
if (file == 'H') {
|
||||||
|
std::cout << " ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
std::cout << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string ChessboardVisualizerGraphic::GenerateBoardField(Chessboard* chessboard, char file, int rank, int height) {
|
||||||
|
if (height == 1) {
|
||||||
|
ChessPiecePosition* position = new ChessPiecePosition(file, rank);
|
||||||
|
|
||||||
|
if (chessboard->IsEmptyField(position)) {
|
||||||
|
return " ";
|
||||||
|
} else {
|
||||||
|
ChessPiece* piece = chessboard->GetChessPiece(position);
|
||||||
|
return " " + piece->GetUnicode() + " ";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return " ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ChessboardVisualizerGraphic::DrawBoardField(Chessboard* chessboard, char file, int rank, int height) {
|
||||||
|
if (file % 2 == (rank % 2)) {
|
||||||
|
this->SetConsoleColor(BLACK, WHITE);
|
||||||
|
} else {
|
||||||
|
this->SetConsoleColor(WHITE, BLACK);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (height == 1) {
|
||||||
|
ChessPiecePosition* position = new ChessPiecePosition(file, rank);
|
||||||
|
|
||||||
|
if (chessboard->IsEmptyField(position)) {
|
||||||
|
std::cout << " ";
|
||||||
|
} else {
|
||||||
|
ChessPiece* piece = chessboard->GetChessPiece(position);
|
||||||
|
std::cout << " " << piece->GetUnicode() << " ";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
std::cout << " ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ChessboardVisualizerGraphic::ClearTerminal() {
|
||||||
|
//std::cout << "\033[2J"; // clear the console
|
||||||
|
system("cls");
|
||||||
|
}
|
||||||
|
|
||||||
|
void ChessboardVisualizerGraphic::GeneratePlayers(Chessboard* chessboard) {
|
||||||
|
std::vector<std::string> temp;
|
||||||
|
temp.push_back(" ");
|
||||||
|
temp.push_back(chessboard->GetPlayer(ChessPieceColor::White)->GetName() + " vs. " + chessboard->GetPlayer(ChessPieceColor::Black)->GetName());
|
||||||
|
AddRowToBoard(temp);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ChessboardVisualizerGraphic::DrawPlayers(Chessboard* chessboard) {
|
||||||
|
std::cout << " ";
|
||||||
|
std::cout << chessboard->GetPlayer(ChessPieceColor::White)->GetName() + " vs. " + chessboard->GetPlayer(ChessPieceColor::Black)->GetName();
|
||||||
|
std::cout << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ChessboardVisualizerGraphic::AddRowToBoard(const std::vector<std::string>& row) {
|
||||||
|
board.push_back(row);
|
||||||
|
}
|
||||||
|
|
||||||
|
// board[2] bis board[25] Feld des Schachbretts
|
||||||
|
// in vectoren von 2 bis 25 index von 2 bis 9
|
||||||
|
void ChessboardVisualizerGraphic::DrawFromVector() {
|
||||||
|
size_t lengthOfBoard = BaseVisualizer::GetSumAllCharsFromVector(board[1]);
|
||||||
|
for (int row = 0; row < board.size(); ++row) {
|
||||||
|
for (int column = 0; column < board[row].size(); ++column) {
|
||||||
|
if (row >= 2 && row <= 25 && column >= 2 && column <= 9) {
|
||||||
|
bool isSecondRowOfField = (row % 3 == 2);
|
||||||
|
bool isBlackWhite = (column % 2 == row % 2);
|
||||||
|
|
||||||
|
if ((row - 1) % 3 == 0) { // Change after 3 rows
|
||||||
|
if (isSecondRowOfField) {
|
||||||
|
this->SetConsoleColor(isBlackWhite ? WHITE : BLACK, isBlackWhite ? BLACK : WHITE);
|
||||||
|
} else {
|
||||||
|
this->SetConsoleColor(isBlackWhite ? BLACK : WHITE, isBlackWhite ? WHITE : BLACK);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (isSecondRowOfField) {
|
||||||
|
this->SetConsoleColor(isBlackWhite ? BLACK : WHITE, isBlackWhite ? WHITE : BLACK);
|
||||||
|
} else {
|
||||||
|
this->SetConsoleColor(isBlackWhite ? WHITE : BLACK, isBlackWhite ? BLACK : WHITE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//std::cout << std::setw(lengthOfBoard) << board[row][column];
|
||||||
|
|
||||||
|
this->SetConsoleColor(DEFAULT, DEFAULT);
|
||||||
|
}
|
||||||
|
this->SetConsoleColor(DEFAULT, DEFAULT);
|
||||||
|
std::cout << std::endl;
|
||||||
|
}
|
||||||
|
}*/
|
48
Chessboard/ChessboardVisualizerGraphic.hpp
Normal file
48
Chessboard/ChessboardVisualizerGraphic.hpp
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
/*#ifndef ChessboardVisualizerGraphic_H
|
||||||
|
#define ChessboardVisualizerGraphic_H
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
#include "../Chessboard/ChessboardVisualizer.hpp"*/
|
||||||
|
|
||||||
|
/*enum Colors {
|
||||||
|
BLACK = 0, RED = 1, GREEN = 2, YELLOW = 3, BLUE = 4, MAGENTA = 5, CYAN = 6, WHITE = 7,
|
||||||
|
LIGHT_BLACK = 10, LIGHT_RED = 11, LIGHT_GREEN = 12, LIGHT_YELLOW = 13, LIGHT_BLUE = 14,
|
||||||
|
LIGHT_MAGENTA = 15, LIGHT_CYAN = 16, LIGHT_WHITE = 17, DEFAULT = 9
|
||||||
|
};*/
|
||||||
|
|
||||||
|
/*class ChessboardVisualizerGraphic : public ChessboardVisualizer {
|
||||||
|
protected:
|
||||||
|
inline static const std::string TOP_LEFT_CORNER = "\u2554";
|
||||||
|
inline static const std::string TOP_RIGHT_CORNER = "\u2557";
|
||||||
|
inline static const std::string HORIZONTAL_LINE = "\u2550";
|
||||||
|
inline static const std::string VERTICAL_LINE = "\u2551";
|
||||||
|
inline static const std::string BOTTOM_LEFT_CORNER = "\u255A";
|
||||||
|
inline static const std::string BOTTOM_RIGHT_CORNER = "\u255D";
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::vector<std::vector<std::string>> board;
|
||||||
|
void ClearTerminal();
|
||||||
|
void DrawTopOrBottomBorder(bool top);
|
||||||
|
void GenerateTopOrBottomBorder(bool top);
|
||||||
|
void DrawPlayers(Chessboard* chessboard);
|
||||||
|
void GeneratePlayers(Chessboard* chessboard);
|
||||||
|
std::string GenerateBoardField(Chessboard* chessboard, char file, int rank, int height);
|
||||||
|
void DrawBoardField(Chessboard* chessboard, char file, int rank, int height);
|
||||||
|
void DrawFiles();
|
||||||
|
void GenerateFiles();
|
||||||
|
//void SetConsoleColor(Colors foreground, Colors background);
|
||||||
|
void SetColorsForField();
|
||||||
|
void temp(Chessboard* chessboard);
|
||||||
|
void AddMenusToChessboard();
|
||||||
|
|
||||||
|
public:
|
||||||
|
ChessboardVisualizerGraphic() = default;
|
||||||
|
void Draw(Chessboard* chessboard);
|
||||||
|
void GenerateChessboard(Chessboard* chessboard);
|
||||||
|
void DrawFromVector();
|
||||||
|
void AddRowToBoard(const std::vector<std::string>& row);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
*/
|
92
Chessboard/ChessboardVisualizerText.cpp
Normal file
92
Chessboard/ChessboardVisualizerText.cpp
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
#include "../Chessboard/ChessboardVisualizerText.hpp"
|
||||||
|
#include "../ChessPieces/ChessPiecePosition.hpp"
|
||||||
|
|
||||||
|
/*void ChessboardVisualizerText::Draw(Chessboard* chessboard) {
|
||||||
|
std::cout << "\033[2J"; // clear the console
|
||||||
|
|
||||||
|
std::cout << std::endl;
|
||||||
|
std::cout << " " << chessboard->GetPlayer(ChessPieceColor::White)->GetName() << " vs. " << chessboard->GetPlayer(ChessPieceColor::Black)->GetName();
|
||||||
|
std::cout << std::endl;
|
||||||
|
|
||||||
|
for (int rank = 8; rank >= 1; rank--) {
|
||||||
|
if (rank == 8) {
|
||||||
|
for (int i = 0; i < 8; i++) {
|
||||||
|
if (i == 0) {
|
||||||
|
std::cout << " " << " " << " ";
|
||||||
|
std::cout << "\u250F";
|
||||||
|
} else {
|
||||||
|
std::cout << "\u2533";
|
||||||
|
}
|
||||||
|
std::cout << "\u2501" << "\u2501" << "\u2501";
|
||||||
|
if (i == 7) {
|
||||||
|
std::cout << "\u2513";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
std::cout << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (char file = 'A'; file <= 'H'; file++) {
|
||||||
|
if (file == 'A') { // Beginn der Zeile
|
||||||
|
std::cout << " " << rank << " ";
|
||||||
|
std::cout << "\u2503";
|
||||||
|
}
|
||||||
|
|
||||||
|
ChessPiecePosition* position = new ChessPiecePosition(file, rank);
|
||||||
|
|
||||||
|
if (chessboard->IsEmptyField(position)) {
|
||||||
|
std::cout << " " << " " << " ";
|
||||||
|
} else {
|
||||||
|
ChessPiece* piece = chessboard->GetChessPiece(position);
|
||||||
|
std::cout << " " << piece->GetUnicode() << " ";
|
||||||
|
}
|
||||||
|
|
||||||
|
std::cout << "\u2503";
|
||||||
|
}
|
||||||
|
std::cout << std::endl;
|
||||||
|
|
||||||
|
if (rank != 1) {
|
||||||
|
for (int i = 0; i < 8; i++) {
|
||||||
|
if (i == 0) {
|
||||||
|
std::cout << " " << " " << " ";
|
||||||
|
std::cout << "\u2523";
|
||||||
|
} else {
|
||||||
|
std::cout << "\u254B";
|
||||||
|
}
|
||||||
|
std::cout << "\u2501" << "\u2501" << "\u2501";
|
||||||
|
if (i == 7) {
|
||||||
|
std::cout << "\u252B";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
std::cout << std::endl;
|
||||||
|
} else {
|
||||||
|
for (int i = 0; i < 8; i++) {
|
||||||
|
if (i == 0) {
|
||||||
|
std::cout << " " << " " << " ";
|
||||||
|
std::cout << "\u2517";
|
||||||
|
} else {
|
||||||
|
std::cout << "\u253B";
|
||||||
|
}
|
||||||
|
std::cout << "\u2501" << "\u2501" << "\u2501";
|
||||||
|
if (i == 7) {
|
||||||
|
std::cout << "\u251B";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
std::cout << std::endl;
|
||||||
|
for (char file = 'A'; file <= 'H'; file++) {
|
||||||
|
if (file == 'A') {
|
||||||
|
std::cout << " " << " " << " ";
|
||||||
|
std::cout << " ";
|
||||||
|
} else {
|
||||||
|
std::cout << " ";
|
||||||
|
}
|
||||||
|
std::cout << " " << file << " ";
|
||||||
|
if (file == 'H') {
|
||||||
|
std::cout << " ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
std::cout << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
std::cout << std::endl;
|
||||||
|
}
|
||||||
|
*/
|
16
Chessboard/ChessboardVisualizerText.hpp
Normal file
16
Chessboard/ChessboardVisualizerText.hpp
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
/*#ifndef ChessboardVisualizerText_H
|
||||||
|
#define ChessboardVisualizerText_H
|
||||||
|
|
||||||
|
#include "../Chessboard/ChessboardVisualizer.hpp"
|
||||||
|
|
||||||
|
class ChessboardVisualizerText : public ChessboardVisualizer {
|
||||||
|
private:
|
||||||
|
void Clear();
|
||||||
|
|
||||||
|
public:
|
||||||
|
ChessboardVisualizerText() = default;
|
||||||
|
void Draw(Chessboard* chessboard);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
*/
|
96
MoveList.cpp
96
MoveList.cpp
@@ -1,96 +0,0 @@
|
|||||||
// #include "MoveList.h"
|
|
||||||
|
|
||||||
// MoveList::MoveList() {
|
|
||||||
// this->head->next = nullptr;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// MoveList::~MoveList() {
|
|
||||||
// Node *current = head;
|
|
||||||
// std::cout << "Destructor: " << std::endl;
|
|
||||||
|
|
||||||
// while (current != nullptr) {
|
|
||||||
// Node *nextNode = current->next;
|
|
||||||
// std::cout << " delete on " << current->data.first << " " << current->data.second << std::endl;
|
|
||||||
// delete current;
|
|
||||||
// current = nextNode;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// MoveList &display() {
|
|
||||||
// Node *currentNode = this->head;
|
|
||||||
|
|
||||||
// while (currentNode->next != nullptr) {
|
|
||||||
// currentNode = currentNode->next;
|
|
||||||
// std::cout << "[" << currentNode->data.first << " " << currentNode->data.second << " | " << currentNode->next << ((currentNode->next != nullptr) ? "] ---> " : "] ");
|
|
||||||
// }
|
|
||||||
// std::cout << std::endl;
|
|
||||||
|
|
||||||
// return *this;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// MoveList &append(const std::pair<int, int> &data) {
|
|
||||||
// if(this->head->next == nullptr) {
|
|
||||||
// Node *node = new Node;
|
|
||||||
// node->data = data;
|
|
||||||
// this->head->next = node;
|
|
||||||
// } else {
|
|
||||||
// Node *newNode = new Node;
|
|
||||||
|
|
||||||
// newNode->data = data;
|
|
||||||
// newNode->next = nullptr;
|
|
||||||
|
|
||||||
// Node *currentNode = this->head;
|
|
||||||
|
|
||||||
// while (currentNode->next != nullptr) {
|
|
||||||
// currentNode = currentNode->next;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// currentNode->next = newNode;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// return *this;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// MoveList &insert(const std::pair<int, int> &data) {
|
|
||||||
// Node *newNode = new Node;
|
|
||||||
// newNode->data = data;
|
|
||||||
// newNode->next = this->head->next;
|
|
||||||
// this->head->next = newNode;
|
|
||||||
|
|
||||||
// return *this;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Node* MoveList::search(const std::pair<int, int> &data) const {
|
|
||||||
// Node *currentNode = this->head;
|
|
||||||
|
|
||||||
// do {
|
|
||||||
// if (currentNode->data == data) {
|
|
||||||
// return currentNode;
|
|
||||||
// }
|
|
||||||
// } while(currentNode = currentNode->next);
|
|
||||||
|
|
||||||
// return nullptr;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// MoveList &remove(const std::pair<int, int> &data) {
|
|
||||||
// Node *currentNode = this->head;
|
|
||||||
|
|
||||||
// do {
|
|
||||||
// if (currentNode->next->data == data) {
|
|
||||||
// Node *temp = currentNode->next;
|
|
||||||
// currentNode->next = currentNode->next->next;
|
|
||||||
// delete temp;
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// } while((currentNode = currentNode->next) && (currentNode->next != nullptr));
|
|
||||||
|
|
||||||
// return *this;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// void MoveList::removeTail(const std::pair<int, int> &data) {
|
|
||||||
// Node *found = search(data);
|
|
||||||
|
|
||||||
// if(found != nullptr) {
|
|
||||||
// found->next = nullptr;
|
|
||||||
// }
|
|
||||||
// }
|
|
38
MoveList.h
38
MoveList.h
@@ -1,38 +0,0 @@
|
|||||||
//
|
|
||||||
// Created by hamac on 20.12.2024.
|
|
||||||
//
|
|
||||||
|
|
||||||
#ifndef MOVELIST_H
|
|
||||||
#define MOVELIST_H
|
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
struct Node {
|
|
||||||
std::pair<int, int> data;
|
|
||||||
Node *next;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class MoveList {
|
|
||||||
private:
|
|
||||||
Node *head;
|
|
||||||
|
|
||||||
public:
|
|
||||||
MoveList();
|
|
||||||
~MoveList();
|
|
||||||
|
|
||||||
MoveList &display();
|
|
||||||
|
|
||||||
MoveList &append(const std::pair<int, int> &data);
|
|
||||||
|
|
||||||
MoveList &insert(const std::pair<int, int> &data);
|
|
||||||
|
|
||||||
Node* search(const std::pair<int, int> &data) const;
|
|
||||||
|
|
||||||
MoveList &remove(const std::pair<int, int> &data);
|
|
||||||
|
|
||||||
void removeTail(const std::pair<int, int> &data);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif //MOVELIST_H
|
|
26
Pawn.cpp
26
Pawn.cpp
@@ -1,26 +0,0 @@
|
|||||||
//
|
|
||||||
// Created by hamac on 19.12.2024.
|
|
||||||
//
|
|
||||||
|
|
||||||
#include "Chesspiece.h"
|
|
||||||
#include "Pawn.h"
|
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
/* methods */
|
|
||||||
std::vector<std::string> Pawn::calcAvaibleMoves() {
|
|
||||||
std::pair<int, int> pos = Chesspiece::getPosition();
|
|
||||||
std::vector<std::string> moves;
|
|
||||||
|
|
||||||
//current
|
|
||||||
|
|
||||||
if (this->firstMove) {
|
|
||||||
//vector[8] => MoveList(1-1;2-2+)
|
|
||||||
//moves.
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
std::cout << "Hello World!\n" << std::endl;
|
|
||||||
return moves;
|
|
||||||
}
|
|
||||||
|
|
||||||
Pawn::Pawn(char color, std::pair<int, int> position): Chesspiece(color, position) {}
|
|
28
Pawn.h
28
Pawn.h
@@ -1,28 +0,0 @@
|
|||||||
//
|
|
||||||
// Created by hamac on 20.12.2024.
|
|
||||||
//
|
|
||||||
|
|
||||||
#ifndef PAWN_H
|
|
||||||
#define PAWN_H
|
|
||||||
|
|
||||||
//
|
|
||||||
// Created by hamac on 19.12.2024.
|
|
||||||
//
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
#include "Chesspiece.h"
|
|
||||||
|
|
||||||
class Pawn: public Chesspiece {
|
|
||||||
private:
|
|
||||||
/* fields */
|
|
||||||
bool firstMove = true;
|
|
||||||
bool movedTwoFields = false;
|
|
||||||
|
|
||||||
/* methods */
|
|
||||||
std::vector<std::string> calcAvaibleMoves() override ;
|
|
||||||
public:
|
|
||||||
Pawn(char color, std::pair<int, int> position);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif //PAWN_H
|
|
33
Player/Player.cpp
Normal file
33
Player/Player.cpp
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
#include "../Player/Player.hpp"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new player with a specific name.
|
||||||
|
* @param name The name of the player.
|
||||||
|
*/
|
||||||
|
Player::Player(std::string name) {
|
||||||
|
this->_name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the color of the player.
|
||||||
|
* @return The color of the player.
|
||||||
|
*/
|
||||||
|
ChessPieceColor Player::GetColor() {
|
||||||
|
return this->_color;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the name of the player.
|
||||||
|
* @return The name of the player.
|
||||||
|
*/
|
||||||
|
std::string Player::GetName() {
|
||||||
|
return this->_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the color of the player.
|
||||||
|
* @param color The color of the player.
|
||||||
|
*/
|
||||||
|
void Player::SetColor(ChessPieceColor color) {
|
||||||
|
this->_color = color;
|
||||||
|
}
|
20
Player/Player.hpp
Normal file
20
Player/Player.hpp
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
#ifndef Player_H
|
||||||
|
#define Player_H
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include "../ChessPieces/ChessPieceColor.hpp"
|
||||||
|
|
||||||
|
class Player {
|
||||||
|
private:
|
||||||
|
ChessPieceColor _color;
|
||||||
|
std::string _name;
|
||||||
|
|
||||||
|
public:
|
||||||
|
Player() = default;
|
||||||
|
Player(std::string name);
|
||||||
|
ChessPieceColor GetColor();
|
||||||
|
std::string GetName();
|
||||||
|
void SetColor(ChessPieceColor color);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
36
README.md
36
README.md
@@ -80,10 +80,40 @@
|
|||||||
- Array von Linked Lists
|
- Array von Linked Lists
|
||||||
- Array Index steht für Richtung von Bewegungen (diagonalen, L, Gerade)
|
- Array Index steht für Richtung von Bewegungen (diagonalen, L, Gerade)
|
||||||
- alles droppen, was nach pos mit Figur kommt
|
- alles droppen, was nach pos mit Figur kommt
|
||||||
-
|
|
||||||
|
|
||||||
|
## Figuren
|
||||||
|
|
||||||
|
- Läufer (Bishop)
|
||||||
|
- König (King)
|
||||||
|
- Königin (Queen)
|
||||||
|
- Turm (Rook)
|
||||||
|
- Bauer (Pawn)
|
||||||
|
- Pferd (Knight)
|
||||||
|
|
||||||
|
## ToDo
|
||||||
|
- Speicherfunktion
|
||||||
|
- ToDos abarbeiten
|
||||||
|
- Anleitung schreiben
|
||||||
|
- Befehlen während des Spiel implementieren
|
||||||
|
- Bewegen funktioniert nicht -> Fixen!!!!
|
||||||
|
- Historie -> Spielzüge speichern und anzeigen
|
||||||
|
- Meldung für falschen Zug (Fehlermeldungen beim Spielen)
|
||||||
|
- Nach Beenden nicht Pfad in Anzeige stehen lassen
|
||||||
|
- Dark Mode
|
||||||
|
|
||||||
|
## Erledigt
|
||||||
|
- Schachnotation (Lange)
|
||||||
|
- Menü (ASCII Art of TurboSchach)
|
||||||
|
- Startmenü
|
||||||
|
- Spielmenü mit Historie, Kommand
|
||||||
|
- Plattformunabhängiges CMD clearing vor dem Zeichnen
|
||||||
|
- Spezialbewegung (Rochade, Umwandlung, En passant)
|
||||||
|
|
||||||
## Build
|
## Build
|
||||||
```
|
```
|
||||||
g++ -o chess.exe main.cpp ChessPieces/*.cpp Chessboard/*.cpp
|
g++ -o chess.exe main.cpp ChessPieces/*.cpp Chessboard/*.cpp Player/*.cpp Visualizer/*.cpp
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Voraussetzungen
|
||||||
|
|
||||||
|
- C++ 17
|
259
Visualizer/BaseVisualizer.cpp
Normal file
259
Visualizer/BaseVisualizer.cpp
Normal file
@@ -0,0 +1,259 @@
|
|||||||
|
#include "BaseVisualizer.hpp"
|
||||||
|
|
||||||
|
void BaseVisualizer::ClearTerminal() {
|
||||||
|
//std::cout << "\033[2J";
|
||||||
|
system("cls");
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<std::vector<std::string>>* BaseVisualizer::GetDisplayVector() {
|
||||||
|
return &display_vector;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t BaseVisualizer::CountVisibleCharacters(const std::string& str) {
|
||||||
|
size_t count = 0;
|
||||||
|
size_t i = 0;
|
||||||
|
|
||||||
|
while (i < str.size()) {
|
||||||
|
if (str[i] == '\x1B' && i + 1 < str.size() && str[i + 1] == '[') {
|
||||||
|
// ANSI-Escape-Sequenz erkennen und überspringen
|
||||||
|
i += 2; // Überspringe '\x1B['
|
||||||
|
while (i < str.size() && !std::isalpha(str[i])) {
|
||||||
|
++i; // Fortsetzung der Sequenz überspringen
|
||||||
|
}
|
||||||
|
if (i < str.size() && std::isalpha(str[i])) {
|
||||||
|
++i; // Buchstaben am Ende der Sequenz überspringen
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// UTF-8 Startbytes zählen (kein Fortsetzungsbyte)
|
||||||
|
if ((str[i] & 0b11000000) != 0b10000000) {
|
||||||
|
++count;
|
||||||
|
}
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t BaseVisualizer::GetSumAllCharsFromVector(const std::vector<std::string>& vec) {
|
||||||
|
size_t sum = 0;
|
||||||
|
for (const std::string& str : vec) {
|
||||||
|
sum += CountVisibleCharacters(str);
|
||||||
|
}
|
||||||
|
return sum;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BaseVisualizer::GenerateEmptyLine(const int lengthOfMenu, const bool single) {
|
||||||
|
std::string result = "";
|
||||||
|
for (int i = 0; i < lengthOfMenu; ++i) {
|
||||||
|
if (i == 0) {
|
||||||
|
result += ((single) ? BaseVisualizer::VERTICAL_LINE_SINGLE : BaseVisualizer::VERTICAL_LINE);
|
||||||
|
} else if (i == lengthOfMenu-1) {
|
||||||
|
result += ((single) ? BaseVisualizer::VERTICAL_LINE_SINGLE : BaseVisualizer::VERTICAL_LINE);
|
||||||
|
} else {
|
||||||
|
result += " ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
display_vector.push_back({result});
|
||||||
|
}
|
||||||
|
|
||||||
|
// ToDo: Auf Max länge bringen
|
||||||
|
void BaseVisualizer::GenerateBoxMenuLine(const size_t length, const std::string& str, const bool single, const size_t padding) {
|
||||||
|
std::string result = ((single) ? BaseVisualizer::VERTICAL_LINE_SINGLE : BaseVisualizer::VERTICAL_LINE) + std::string(padding, ' ') + str;
|
||||||
|
while (CountVisibleCharacters(result) < length-1) {
|
||||||
|
result += " ";
|
||||||
|
}
|
||||||
|
display_vector.push_back({result.append(((single) ? BaseVisualizer::VERTICAL_LINE_SINGLE : BaseVisualizer::VERTICAL_LINE))});
|
||||||
|
}
|
||||||
|
|
||||||
|
void BaseVisualizer::GenerateCenteredString(const size_t widthOfMenu, const std::string& str, const bool single) {
|
||||||
|
std::string result = (single) ? BaseVisualizer::VERTICAL_LINE_SINGLE : BaseVisualizer::VERTICAL_LINE;
|
||||||
|
|
||||||
|
float newLength = widthOfMenu - CountVisibleCharacters(str) - 2;
|
||||||
|
|
||||||
|
int firstHalfLength = std::floor(newLength / 2);
|
||||||
|
int secondHalfLength = std::ceil(newLength / 2);
|
||||||
|
|
||||||
|
for (int i = 0; i < firstHalfLength; ++i) {
|
||||||
|
result += " ";
|
||||||
|
}
|
||||||
|
|
||||||
|
result += str;
|
||||||
|
|
||||||
|
for (int i = 0; i < secondHalfLength; ++i) {
|
||||||
|
result += " ";
|
||||||
|
}
|
||||||
|
|
||||||
|
display_vector.push_back({result+ ((single) ? BaseVisualizer::VERTICAL_LINE_SINGLE : BaseVisualizer::VERTICAL_LINE)});
|
||||||
|
}
|
||||||
|
|
||||||
|
void BaseVisualizer::DisplayElement() {
|
||||||
|
int temp;
|
||||||
|
for (const auto& row : display_vector) {
|
||||||
|
for (const auto& cell : row) {
|
||||||
|
std::cout << cell;
|
||||||
|
}
|
||||||
|
std::cout << std::endl;
|
||||||
|
}
|
||||||
|
std::cout << "\x1B[u";
|
||||||
|
//std::cout << "Select option" << std::endl;
|
||||||
|
std::cin >> temp;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t BaseVisualizer::CalculateMaxMenuWidth(const size_t longestStringLength, const size_t padding) {
|
||||||
|
return longestStringLength + 2*padding + 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BaseVisualizer::GenerateTopBottomBorder(const size_t totalLength, const bool top, const bool single) {
|
||||||
|
std::string result = (top) ? ((single) ? BaseVisualizer::TOP_LEFT_CORNER_SINGLE : BaseVisualizer::TOP_LEFT_CORNER) : ((single) ? BaseVisualizer::BOTTOM_LEFT_CORNER_SINGLE : BaseVisualizer::BOTTOM_LEFT_CORNER);
|
||||||
|
for (size_t i = 0; i < totalLength-2; ++i) {
|
||||||
|
result += (single) ? BaseVisualizer::HORIZONTAL_LINE_SINGLE : BaseVisualizer::HORIZONTAL_LINE;
|
||||||
|
}
|
||||||
|
display_vector.push_back({result + ((top) ? ((single) ? BaseVisualizer::TOP_RIGHT_CORNER_SINGLE : BaseVisualizer::TOP_RIGHT_CORNER) : ((single) ? BaseVisualizer::BOTTOM_RIGHT_CORNER_SINGLE : BaseVisualizer::BOTTOM_RIGHT_CORNER))});
|
||||||
|
}
|
||||||
|
|
||||||
|
void BaseVisualizer::AddEmptyLines(const size_t lines, const size_t length, const bool sinlge) {
|
||||||
|
for (size_t i = 0; i < lines; ++i) {
|
||||||
|
BaseVisualizer::GenerateEmptyLine(length, sinlge);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void BaseVisualizer::GenerateTableTopBottom(const size_t totalLength, const bool top, const bool single) {
|
||||||
|
int firstHalfLength = std::floor(totalLength / 2);
|
||||||
|
|
||||||
|
std::string result = (top) ? ((single) ? BaseVisualizer::TOP_LEFT_CORNER_SINGLE : BaseVisualizer::TOP_LEFT_CORNER) : ((single) ? BaseVisualizer::BOTTOM_LEFT_CORNER_SINGLE : BaseVisualizer::BOTTOM_LEFT_CORNER);
|
||||||
|
|
||||||
|
for (size_t i = 0; i < firstHalfLength-1; ++i) {
|
||||||
|
result += (single) ? BaseVisualizer::HORIZONTAL_LINE_SINGLE : BaseVisualizer::HORIZONTAL_LINE;
|
||||||
|
}
|
||||||
|
|
||||||
|
result += (top) ? ((single) ? BaseVisualizer::TOP_CROSS_SINGLE : BaseVisualizer::TOP_CROSS) : ((single) ? BaseVisualizer::BOTTOM_CROSS_SINGLE : BaseVisualizer::BOTTOM_CROSS);
|
||||||
|
|
||||||
|
for (size_t i = 0; i < firstHalfLength-1; ++i) {
|
||||||
|
result += (single) ? BaseVisualizer::HORIZONTAL_LINE_SINGLE : BaseVisualizer::HORIZONTAL_LINE;
|
||||||
|
}
|
||||||
|
|
||||||
|
display_vector.push_back({result + ((top) ? ((single) ? BaseVisualizer::TOP_RIGHT_CORNER_SINGLE : BaseVisualizer::TOP_RIGHT_CORNER) : ((single) ? BaseVisualizer::BOTTOM_RIGHT_CORNER_SINGLE : BaseVisualizer::BOTTOM_RIGHT_CORNER))});
|
||||||
|
}
|
||||||
|
|
||||||
|
void BaseVisualizer::GenerateTableLine(const float length, const std::vector<std::string>& str, const bool single) {
|
||||||
|
int firstHalfLength = std::floor(length / 2);
|
||||||
|
std::string result = ((single) ? BaseVisualizer::VERTICAL_LINE_SINGLE : BaseVisualizer::VERTICAL_LINE);
|
||||||
|
std::string temp;
|
||||||
|
|
||||||
|
for (size_t i = 0; i < 2; ++i) {
|
||||||
|
temp += " " + str[i];
|
||||||
|
|
||||||
|
while (CountVisibleCharacters(temp) < firstHalfLength-1) {
|
||||||
|
temp += " ";
|
||||||
|
}
|
||||||
|
temp += ((single) ? BaseVisualizer::VERTICAL_LINE_SINGLE : BaseVisualizer::VERTICAL_LINE);
|
||||||
|
result += temp;
|
||||||
|
temp = "";
|
||||||
|
}
|
||||||
|
display_vector.push_back({result});
|
||||||
|
}
|
||||||
|
|
||||||
|
void BaseVisualizer::GenerateTableSeperator(const float length, const bool single) {
|
||||||
|
int firstHalfLength = std::floor(length / 2);
|
||||||
|
std::string result = ((single) ? BaseVisualizer::RIGHT_CROSS_SINGLE : BaseVisualizer::RIGHT_CROSS);
|
||||||
|
std::string temp;
|
||||||
|
|
||||||
|
for (size_t i = 0; i < 2; ++i) {
|
||||||
|
while (CountVisibleCharacters(temp) < firstHalfLength-1) {
|
||||||
|
temp += ((single) ? BaseVisualizer::HORIZONTAL_LINE_SINGLE : BaseVisualizer::HORIZONTAL_LINE);
|
||||||
|
}
|
||||||
|
temp += (i != 1) ? ((single) ? BaseVisualizer::CROSS_SINGLE : BaseVisualizer::CROSS) : "";
|
||||||
|
result += temp;
|
||||||
|
temp = "";
|
||||||
|
}
|
||||||
|
result += ((single) ? BaseVisualizer::LEFT_CROSS_SINGLE : BaseVisualizer::LEFT_CROSS);
|
||||||
|
|
||||||
|
display_vector.push_back({result});
|
||||||
|
}
|
||||||
|
|
||||||
|
void BaseVisualizer::GenerateBoxSeperator(const float length, const bool single) {
|
||||||
|
std::string result = ((single) ? BaseVisualizer::RIGHT_CROSS_SINGLE : BaseVisualizer::RIGHT_CROSS);
|
||||||
|
|
||||||
|
while (CountVisibleCharacters(result) < length-1) {
|
||||||
|
result += ((single) ? BaseVisualizer::HORIZONTAL_LINE_SINGLE : BaseVisualizer::HORIZONTAL_LINE);
|
||||||
|
}
|
||||||
|
|
||||||
|
result += ((single) ? BaseVisualizer::LEFT_CROSS_SINGLE : BaseVisualizer::LEFT_CROSS);
|
||||||
|
|
||||||
|
display_vector.push_back({result});
|
||||||
|
}
|
||||||
|
|
||||||
|
void BaseVisualizer::SetConsoleColor(Colors foreground, Colors background) {
|
||||||
|
const std::string SEQ_FOREGROUND = "\x1b[3";
|
||||||
|
const std::string SEQ_FOREGROUND_LIGHT = "\x1b[9";
|
||||||
|
const std::string SEQ_BACKGROUND = "\x1b[4";
|
||||||
|
const std::string SEQ_BACKGROUND_LIGHT = "\x1b[10";
|
||||||
|
|
||||||
|
// set foreground color
|
||||||
|
switch (foreground) {
|
||||||
|
case BLACK:
|
||||||
|
case RED:
|
||||||
|
case GREEN:
|
||||||
|
case YELLOW:
|
||||||
|
case BLUE:
|
||||||
|
case MAGENTA:
|
||||||
|
case CYAN:
|
||||||
|
case WHITE:
|
||||||
|
std::cout << SEQ_FOREGROUND << foreground << "m";
|
||||||
|
break;
|
||||||
|
case LIGHT_BLACK:
|
||||||
|
case LIGHT_RED:
|
||||||
|
case LIGHT_GREEN:
|
||||||
|
case LIGHT_YELLOW:
|
||||||
|
case LIGHT_BLUE:
|
||||||
|
case LIGHT_MAGENTA:
|
||||||
|
case LIGHT_CYAN:
|
||||||
|
case LIGHT_WHITE:
|
||||||
|
std::cout << SEQ_FOREGROUND_LIGHT << foreground << "m";
|
||||||
|
break;
|
||||||
|
case DEFAULT:
|
||||||
|
default:
|
||||||
|
std::cout << SEQ_FOREGROUND << foreground << "m";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// set background color
|
||||||
|
switch (background) {
|
||||||
|
case BLACK:
|
||||||
|
case RED:
|
||||||
|
case GREEN:
|
||||||
|
case YELLOW:
|
||||||
|
case BLUE:
|
||||||
|
case MAGENTA:
|
||||||
|
case CYAN:
|
||||||
|
case WHITE:
|
||||||
|
std::cout << SEQ_BACKGROUND << background << "m";
|
||||||
|
break;
|
||||||
|
case LIGHT_BLACK:
|
||||||
|
case LIGHT_RED:
|
||||||
|
case LIGHT_GREEN:
|
||||||
|
case LIGHT_YELLOW:
|
||||||
|
case LIGHT_BLUE:
|
||||||
|
case LIGHT_MAGENTA:
|
||||||
|
case LIGHT_CYAN:
|
||||||
|
case LIGHT_WHITE:
|
||||||
|
std::cout << SEQ_BACKGROUND_LIGHT << background << "m";
|
||||||
|
break;
|
||||||
|
case DEFAULT:
|
||||||
|
default:
|
||||||
|
std::cout << SEQ_BACKGROUND << background << "m";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t BaseVisualizer::FindMaxLength(const std::vector<std::string> vec) {
|
||||||
|
size_t max = 0;
|
||||||
|
size_t currentLength = 0;
|
||||||
|
for (const std::string& str : vec) {
|
||||||
|
currentLength = CountVisibleCharacters(str);
|
||||||
|
(currentLength > max) ? max = CountVisibleCharacters(str) : max;
|
||||||
|
}
|
||||||
|
return max;
|
||||||
|
}
|
||||||
|
|
99
Visualizer/BaseVisualizer.hpp
Normal file
99
Visualizer/BaseVisualizer.hpp
Normal file
@@ -0,0 +1,99 @@
|
|||||||
|
#ifndef BASEVISUALIZER_H
|
||||||
|
#define BASEVISUALIZER_H
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
#include <cmath>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
enum Colors {
|
||||||
|
BLACK = 0, RED = 1, GREEN = 2, YELLOW = 3, BLUE = 4, MAGENTA = 5, CYAN = 6, WHITE = 7,
|
||||||
|
LIGHT_BLACK = 10, LIGHT_RED = 11, LIGHT_GREEN = 12, LIGHT_YELLOW = 13, LIGHT_BLUE = 14,
|
||||||
|
LIGHT_MAGENTA = 15, LIGHT_CYAN = 16, LIGHT_WHITE = 17, DEFAULT = 9
|
||||||
|
};
|
||||||
|
|
||||||
|
class BaseVisualizer {
|
||||||
|
protected:
|
||||||
|
inline static const std::string TOP_LEFT_CORNER = "\u2554";
|
||||||
|
inline static const std::string TOP_RIGHT_CORNER = "\u2557";
|
||||||
|
inline static const std::string HORIZONTAL_LINE = "\u2550";
|
||||||
|
inline static const std::string VERTICAL_LINE = "\u2551";
|
||||||
|
inline static const std::string BOTTOM_LEFT_CORNER = "\u255A";
|
||||||
|
inline static const std::string BOTTOM_RIGHT_CORNER = "\u255D";
|
||||||
|
inline static const std::string RIGHT_CROSS = "\u2560";
|
||||||
|
inline static const std::string LEFT_CROSS = "\u2563";
|
||||||
|
inline static const std::string CROSS = "\u256C";
|
||||||
|
inline static const std::string TOP_CROSS = "\u2566";
|
||||||
|
inline static const std::string BOTTOM_CROSS = "\u2569";
|
||||||
|
|
||||||
|
inline static const std::string TOP_LEFT_CORNER_SINGLE = "\u250C";
|
||||||
|
inline static const std::string TOP_RIGHT_CORNER_SINGLE = "\u2510";
|
||||||
|
inline static const std::string HORIZONTAL_LINE_SINGLE = "\u2500";
|
||||||
|
inline static const std::string VERTICAL_LINE_SINGLE = "\u2502";
|
||||||
|
inline static const std::string BOTTOM_LEFT_CORNER_SINGLE = "\u2514";
|
||||||
|
inline static const std::string BOTTOM_RIGHT_CORNER_SINGLE = "\u2518";
|
||||||
|
inline static const std::string RIGHT_CROSS_SINGLE = "\u251C";
|
||||||
|
inline static const std::string LEFT_CROSS_SINGLE = "\u2524";
|
||||||
|
inline static const std::string CROSS_SINGLE = "\u253C";
|
||||||
|
inline static const std::string TOP_CROSS_SINGLE = "\u252C";
|
||||||
|
inline static const std::string BOTTOM_CROSS_SINGLE = "\u2534";
|
||||||
|
|
||||||
|
const size_t MAX_MENU_WIDTH;
|
||||||
|
const size_t PADDING;
|
||||||
|
|
||||||
|
std::vector<std::vector<std::string>> display_vector;
|
||||||
|
|
||||||
|
void GenerateEmptyLine(const int lengthOfMenu, const bool single);
|
||||||
|
void GenerateBoxMenuLine(const size_t length, const std::string& str, const bool single, const size_t padding);
|
||||||
|
void GenerateCenteredString(const size_t widthOfMenu, const std::string& str, const bool single);
|
||||||
|
size_t CalculateMaxMenuWidth(const size_t longestStringLength, const size_t padding);
|
||||||
|
size_t FindMaxLength(const std::vector<std::string> vec);
|
||||||
|
void GenerateTopBottomBorder(const size_t totalLength, const bool top, const bool single);
|
||||||
|
void AddEmptyLines(const size_t lines, const size_t length, const bool sinlge);
|
||||||
|
void GenerateTableTopBottom(const size_t totalLength, const bool top, const bool single);
|
||||||
|
void GenerateTableLine(const float length, const std::vector<std::string>& str, const bool single);
|
||||||
|
void GenerateTableSeperator(const float length, const bool single);
|
||||||
|
void GenerateBoxSeperator(const float length, const bool single);
|
||||||
|
void SetConsoleColor(Colors foreground, Colors background);
|
||||||
|
|
||||||
|
static size_t GetSumAllCharsFromVector(const std::vector<std::string>& vec);
|
||||||
|
static size_t CountVisibleCharacters(const std::string& str);
|
||||||
|
|
||||||
|
private:
|
||||||
|
virtual void GenerateElement() = 0;
|
||||||
|
|
||||||
|
public:
|
||||||
|
virtual ~BaseVisualizer() = default;
|
||||||
|
static void ClearTerminal();
|
||||||
|
void DisplayElement();
|
||||||
|
std::vector<std::vector<std::string>>* GetDisplayVector();
|
||||||
|
BaseVisualizer(size_t longestStringLength, size_t padding) : MAX_MENU_WIDTH(BaseVisualizer::CalculateMaxMenuWidth(longestStringLength, padding)), PADDING(padding) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //BASEVISUALIZER_H
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
ChessboardVisualizer.cpp
|
||||||
|
HistorieVisualizer.cpp
|
||||||
|
CommandVisualizer.cpp
|
||||||
|
|
||||||
|
PlayVisualizer.cpp {
|
||||||
|
ChessboardVisualizer.display_vector
|
||||||
|
|
||||||
|
|
||||||
|
HistorieVisualizer.display_vector;
|
||||||
|
|
||||||
|
CommandVisualizer.display_vector;
|
||||||
|
|
||||||
|
st::cout << ChessboardVisualizer.display_vector[i] (isEmpty) ? << std:endl : << Padding << Menus.display_vector[i] << std:endl;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
166
Visualizer/ChessboardVisualizer.cpp
Normal file
166
Visualizer/ChessboardVisualizer.cpp
Normal file
@@ -0,0 +1,166 @@
|
|||||||
|
#include "ChessboardVisualizer.hpp"
|
||||||
|
|
||||||
|
size_t ChessboardVisualizer::GetMaxBoardWidth() {
|
||||||
|
std::string temp;
|
||||||
|
|
||||||
|
temp.append(3, ' ');
|
||||||
|
|
||||||
|
temp += BaseVisualizer::TOP_LEFT_CORNER;
|
||||||
|
for (int i = 0; i < 8; i++) {
|
||||||
|
for (int j = 0; j < 7; j++) {
|
||||||
|
temp += BaseVisualizer::HORIZONTAL_LINE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
temp += BaseVisualizer::TOP_RIGHT_CORNER;
|
||||||
|
|
||||||
|
return BaseVisualizer::CountVisibleCharacters(temp);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ChessboardVisualizer::GenerateTopBottomBorder(bool top, bool single) {
|
||||||
|
std::string temp;
|
||||||
|
|
||||||
|
temp.append(3, ' '); // ToDo: Padding?
|
||||||
|
|
||||||
|
temp += (top)
|
||||||
|
? ((single)
|
||||||
|
? BaseVisualizer::TOP_LEFT_CORNER_SINGLE
|
||||||
|
: BaseVisualizer::TOP_LEFT_CORNER)
|
||||||
|
: ((single)
|
||||||
|
? BaseVisualizer::BOTTOM_LEFT_CORNER_SINGLE
|
||||||
|
: BaseVisualizer::BOTTOM_LEFT_CORNER);
|
||||||
|
for (int i = 0; i < 8; i++) {
|
||||||
|
for (int j = 0; j < 7; j++) {
|
||||||
|
temp += (single) ? BaseVisualizer::HORIZONTAL_LINE_SINGLE : BaseVisualizer::HORIZONTAL_LINE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
display_vector.push_back({temp + ((top) ? ((single) ? BaseVisualizer::TOP_RIGHT_CORNER_SINGLE : BaseVisualizer::TOP_RIGHT_CORNER) : ((single) ? BaseVisualizer::BOTTOM_RIGHT_CORNER_SINGLE : BaseVisualizer::BOTTOM_RIGHT_CORNER))});
|
||||||
|
}
|
||||||
|
|
||||||
|
void ChessboardVisualizer::GenerateElement() {
|
||||||
|
BaseVisualizer::ClearTerminal();
|
||||||
|
|
||||||
|
GeneratePlayers();
|
||||||
|
|
||||||
|
GenerateChessboard();
|
||||||
|
|
||||||
|
//GenerateDisplayVector();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ChessboardVisualizer::GeneratePlayers() {
|
||||||
|
std::string result;
|
||||||
|
result.append(3, ' ');
|
||||||
|
display_vector.push_back({result + CHESSBOARD->GetPlayer(ChessPieceColor::White)->GetName()
|
||||||
|
+ " vs. " + CHESSBOARD->GetPlayer(ChessPieceColor::Black)->GetName()});
|
||||||
|
}
|
||||||
|
|
||||||
|
void ChessboardVisualizer::GenerateChessboard() {
|
||||||
|
std::vector<std::string> temp;
|
||||||
|
for (int rank = 8; rank >= 1; rank--) {
|
||||||
|
if (rank == 8) GenerateTopBottomBorder(true, true);
|
||||||
|
for (int heightOfField = 0; heightOfField < 3; heightOfField++) {
|
||||||
|
for (char file = 'A'; file <= 'H'; file++) {
|
||||||
|
if (file == 'A') {
|
||||||
|
temp.push_back((heightOfField == 1) ? " " + std::to_string(rank) + " " : std::string(3, ' '));
|
||||||
|
temp.push_back(BaseVisualizer::VERTICAL_LINE_SINGLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
temp.push_back(GenerateBoardField(file, rank, heightOfField));
|
||||||
|
|
||||||
|
if (file == 'H') {
|
||||||
|
temp.push_back(BaseVisualizer::VERTICAL_LINE_SINGLE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
display_vector.push_back(temp);
|
||||||
|
temp.clear();
|
||||||
|
}
|
||||||
|
if (rank == 1) {
|
||||||
|
GenerateTopBottomBorder(false, true);
|
||||||
|
GenerateFiles();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string ChessboardVisualizer::GenerateBoardField(char file, int rank, int height) {
|
||||||
|
ChessPiecePosition* position = new ChessPiecePosition(file, rank);
|
||||||
|
if (height == 1 && !CHESSBOARD->IsEmptyField(position)) {
|
||||||
|
ChessPiece* piece = CHESSBOARD->GetChessPiece(position);
|
||||||
|
return std::string(3, ' ') + piece->GetUnicode() + std::string(3, ' ');
|
||||||
|
}
|
||||||
|
return std::string(7, ' ');
|
||||||
|
}
|
||||||
|
|
||||||
|
void ChessboardVisualizer::GenerateFiles() {
|
||||||
|
std::string temp;
|
||||||
|
|
||||||
|
for (char file = 'A'; file <= 'H'; file++) {
|
||||||
|
if (file == 'A') {
|
||||||
|
temp += (std::string(4, ' '));
|
||||||
|
}
|
||||||
|
|
||||||
|
temp += (std::string(3, ' ') + std::string(1, file) + std::string(3, ' '));
|
||||||
|
|
||||||
|
if (file == 'H') {
|
||||||
|
temp += " ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
display_vector.push_back({temp});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// board[2] bis board[25] Feld des Schachbretts
|
||||||
|
// in vectoren von 2 bis 25 index von 2 bis 9
|
||||||
|
void ChessboardVisualizer::DisplayElement() {
|
||||||
|
size_t size;
|
||||||
|
std::string temp;
|
||||||
|
for (int row = 0; row < display_vector.size(); ++row) {
|
||||||
|
for (int column = 0; column < display_vector[row].size(); ++column) {
|
||||||
|
if (row >= 2 && row <= 25 && column >= 2 && column <= 9) {
|
||||||
|
bool isSecondRowOfField = (row % 3 == 2);
|
||||||
|
bool isBlackWhite = (column % 2 == row % 2);
|
||||||
|
|
||||||
|
if ((row - 1) % 3 == 0) { // Change after 3 rows
|
||||||
|
if (isSecondRowOfField) {
|
||||||
|
this->SetConsoleColor(isBlackWhite ? WHITE : BLACK, isBlackWhite ? BLACK : WHITE);
|
||||||
|
} else {
|
||||||
|
this->SetConsoleColor(isBlackWhite ? BLACK : WHITE, isBlackWhite ? WHITE : BLACK);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (isSecondRowOfField) {
|
||||||
|
this->SetConsoleColor(isBlackWhite ? BLACK : WHITE, isBlackWhite ? WHITE : BLACK);
|
||||||
|
} else {
|
||||||
|
this->SetConsoleColor(isBlackWhite ? WHITE : BLACK, isBlackWhite ? BLACK : WHITE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
std::cout << display_vector[row][column];
|
||||||
|
this->SetConsoleColor(DEFAULT, DEFAULT);
|
||||||
|
}
|
||||||
|
this->SetConsoleColor(DEFAULT, DEFAULT);
|
||||||
|
|
||||||
|
std::cout << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*void ChessboardVisualizer::GenerateDisplayVector() {
|
||||||
|
std::string temp;
|
||||||
|
size_t size;
|
||||||
|
|
||||||
|
for (auto& row : draw_vector) {
|
||||||
|
if (row.size() > 1) {
|
||||||
|
for (const auto& element : row) {
|
||||||
|
temp += element;
|
||||||
|
}
|
||||||
|
display_vector.push_back(FillStringToMaxLength(temp));
|
||||||
|
temp = "";
|
||||||
|
} else {
|
||||||
|
display_vector.push_back(FillStringToMaxLength(row[0]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string ChessboardVisualizer::FillStringToMaxLength(std::string& str) {
|
||||||
|
size_t size = BaseVisualizer::CountVisibleCharacters(str);
|
||||||
|
return ((size == MAX_MENU_WIDTH)
|
||||||
|
? str
|
||||||
|
: str.append(std::string(MAX_MENU_WIDTH - size, ' ')));
|
||||||
|
}*/
|
32
Visualizer/ChessboardVisualizer.hpp
Normal file
32
Visualizer/ChessboardVisualizer.hpp
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
#ifndef CHESSBOARDVISUALIZER_HPP
|
||||||
|
#define CHESSBOARDVISUALIZER_HPP
|
||||||
|
|
||||||
|
#include "BaseVisualizer.hpp"
|
||||||
|
#include "../Chessboard/Chessboard.hpp"
|
||||||
|
#include "../Chesspieces/Chesspiece.hpp"
|
||||||
|
|
||||||
|
class ChessboardVisualizer : public BaseVisualizer {
|
||||||
|
|
||||||
|
private:
|
||||||
|
Chessboard* CHESSBOARD;
|
||||||
|
std::vector<std::vector<std::string>> draw_vector;
|
||||||
|
|
||||||
|
static size_t GetMaxBoardWidth();
|
||||||
|
|
||||||
|
void GenerateTopBottomBorder(bool top, bool single);
|
||||||
|
void GenerateElement() override;
|
||||||
|
void GeneratePlayers();
|
||||||
|
void GenerateChessboard();
|
||||||
|
void GenerateFiles();
|
||||||
|
std::string GenerateBoardField(char file, int rank, int height);
|
||||||
|
void GenerateDisplayVector();
|
||||||
|
std::string FillStringToMaxLength(std::string& str);
|
||||||
|
|
||||||
|
public:
|
||||||
|
ChessboardVisualizer(Chessboard* chessboard, size_t padding) : BaseVisualizer(ChessboardVisualizer::GetMaxBoardWidth(), padding), CHESSBOARD(chessboard) {
|
||||||
|
ChessboardVisualizer::GenerateElement();
|
||||||
|
};
|
||||||
|
void DisplayElement();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //CHESSBOARDVISUALIZER_HPP
|
13
Visualizer/CommandMenuVisualizer.cpp
Normal file
13
Visualizer/CommandMenuVisualizer.cpp
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
#include "CommandMenuVisualizer.hpp"
|
||||||
|
|
||||||
|
void CommandMenuVisualizer::GenerateElement() {
|
||||||
|
BaseVisualizer::display_vector.push_back({"Commands"});
|
||||||
|
BaseVisualizer::GenerateTopBottomBorder(MAX_MENU_WIDTH, true, true);
|
||||||
|
for (const auto& content : menuContent) {
|
||||||
|
BaseVisualizer::GenerateBoxMenuLine(MAX_MENU_WIDTH, content, true, PADDING);
|
||||||
|
}
|
||||||
|
BaseVisualizer::GenerateBoxSeperator(MAX_MENU_WIDTH, true);
|
||||||
|
std::string str_temp = ((CHESSBOARD->GetCurrentPlayer()->GetColor() == ChessPieceColor::White) ? "White" : "Black");
|
||||||
|
BaseVisualizer::GenerateBoxMenuLine(MAX_MENU_WIDTH, "Move [" + str_temp + "] : " + "\x1B[s", true, true);
|
||||||
|
BaseVisualizer::GenerateTopBottomBorder(MAX_MENU_WIDTH, false, true);
|
||||||
|
}
|
30
Visualizer/CommandMenuVisualizer.hpp
Normal file
30
Visualizer/CommandMenuVisualizer.hpp
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
#ifndef COMMANDMENUVISUALIZER_HPP
|
||||||
|
#define COMMANDMENUVISUALIZER_HPP
|
||||||
|
|
||||||
|
#include "BaseVisualizer.hpp"
|
||||||
|
#include "../Chessboard/Chessboard.hpp"
|
||||||
|
|
||||||
|
class CommandMenuVisualizer : public BaseVisualizer {
|
||||||
|
private:
|
||||||
|
inline static const std::vector<std::string> menuContent = {
|
||||||
|
"To execute command: $<command_no>",
|
||||||
|
"",
|
||||||
|
"1 - Instructions",
|
||||||
|
"2 - Save",
|
||||||
|
"3 - Exit",
|
||||||
|
"",
|
||||||
|
"8 - Resign",
|
||||||
|
"9 - Draw"
|
||||||
|
};
|
||||||
|
|
||||||
|
Chessboard* CHESSBOARD;
|
||||||
|
|
||||||
|
void GenerateElement() override;
|
||||||
|
|
||||||
|
public:
|
||||||
|
CommandMenuVisualizer(Chessboard* chessboard, size_t padding) : BaseVisualizer(CommandMenuVisualizer::FindMaxLength(menuContent), padding), CHESSBOARD(chessboard) {
|
||||||
|
CommandMenuVisualizer::GenerateElement();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //COMMANDMENUVISUALIZER_HPP
|
16
Visualizer/HistorieVisualizer.cpp
Normal file
16
Visualizer/HistorieVisualizer.cpp
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
#include "HistorieVisualizer.hpp"
|
||||||
|
|
||||||
|
void HistorieVisualizer::GenerateElement() {
|
||||||
|
BaseVisualizer::display_vector.push_back({"Historie"});
|
||||||
|
BaseVisualizer::GenerateTableTopBottom(MAX_MENU_WIDTH, true, true);
|
||||||
|
|
||||||
|
BaseVisualizer::GenerateTableLine(MAX_MENU_WIDTH, {HistorieVisualizer::PLAYER1, HistorieVisualizer::PLAYER2}, true);
|
||||||
|
BaseVisualizer::BaseVisualizer::GenerateTableSeperator(MAX_MENU_WIDTH, true);
|
||||||
|
|
||||||
|
// ToDo: History einlesen und anzeigen lassenF
|
||||||
|
for (size_t i = 0; i < 5; i++) {
|
||||||
|
BaseVisualizer::GenerateTableLine(MAX_MENU_WIDTH, {"", ""}, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
BaseVisualizer::GenerateTableTopBottom(MAX_MENU_WIDTH, false, true);
|
||||||
|
}
|
28
Visualizer/HistorieVisualizer.hpp
Normal file
28
Visualizer/HistorieVisualizer.hpp
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
#ifndef HISTORIEVISUALIZER_HPP
|
||||||
|
#define HISTORIEVISUALIZER_HPP
|
||||||
|
|
||||||
|
#include "BaseVisualizer.hpp"
|
||||||
|
#include "../Chessboard/Chessboard.hpp"
|
||||||
|
|
||||||
|
class HistorieVisualizer : public BaseVisualizer {
|
||||||
|
private:
|
||||||
|
const std::string PLAYER1;
|
||||||
|
const std::string PLAYER2;
|
||||||
|
|
||||||
|
std::vector<std::vector<std::string>> histories;
|
||||||
|
Chessboard* CHESSBOARD;
|
||||||
|
|
||||||
|
void GenerateElement() override;
|
||||||
|
|
||||||
|
public:
|
||||||
|
HistorieVisualizer(Chessboard* chessbord,const size_t menuWidth, const size_t padding) :
|
||||||
|
BaseVisualizer(menuWidth, padding), histories(5, std::vector<std::string>(2, "")),
|
||||||
|
CHESSBOARD(chessbord),
|
||||||
|
PLAYER1(chessbord->GetPlayer(ChessPieceColor::White)->GetName()),
|
||||||
|
PLAYER2(chessbord->GetPlayer(ChessPieceColor::Black)->GetName())
|
||||||
|
{
|
||||||
|
HistorieVisualizer::GenerateElement();
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //HISTORIEVISUALIZER_HPP
|
13
Visualizer/InstructionsVisualizer.cpp
Normal file
13
Visualizer/InstructionsVisualizer.cpp
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
#include "InstructionsVisualizer.hpp"
|
||||||
|
|
||||||
|
void InstructionsVisualizer::GenerateElement() {
|
||||||
|
BaseVisualizer::GenerateTopBottomBorder(MAX_MENU_WIDTH, true, false);
|
||||||
|
BaseVisualizer::AddEmptyLines(5, MAX_MENU_WIDTH, false);
|
||||||
|
for (const auto& content : menuContent) {
|
||||||
|
BaseVisualizer::GenerateBoxMenuLine(MAX_MENU_WIDTH, content, false, PADDING);
|
||||||
|
}
|
||||||
|
BaseVisualizer::AddEmptyLines(2, MAX_MENU_WIDTH, false);
|
||||||
|
BaseVisualizer::GenerateBoxMenuLine(MAX_MENU_WIDTH, "Enter any key to return to menu: \x1B[s", false, PADDING);
|
||||||
|
BaseVisualizer::AddEmptyLines(5, MAX_MENU_WIDTH, false);
|
||||||
|
BaseVisualizer::GenerateTopBottomBorder(MAX_MENU_WIDTH, false, false);
|
||||||
|
}
|
19
Visualizer/InstructionsVisualizer.hpp
Normal file
19
Visualizer/InstructionsVisualizer.hpp
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
#ifndef INSTRUCTIONSVISUALIZER_HPP
|
||||||
|
#define INSTRUCTIONSVISUALIZER_HPP
|
||||||
|
|
||||||
|
#include "BaseVisualizer.hpp"
|
||||||
|
|
||||||
|
class InstructionsVisualizer : public BaseVisualizer {
|
||||||
|
private:
|
||||||
|
inline static const std::vector<std::string> menuContent = {
|
||||||
|
"Hier kommt noch eine Anleitung"
|
||||||
|
};
|
||||||
|
void GenerateElement() override;
|
||||||
|
|
||||||
|
public:
|
||||||
|
InstructionsVisualizer() : BaseVisualizer(60, 4) {
|
||||||
|
InstructionsVisualizer::GenerateElement();
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //INSTRUCTIONSVISUALIZER_HPP
|
103
Visualizer/PlayingViewVisualizer.cpp
Normal file
103
Visualizer/PlayingViewVisualizer.cpp
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
#include "PlayingViewVisualizer.hpp"
|
||||||
|
#include "ChessboardVisualizer.hpp"
|
||||||
|
#include "HistorieVisualizer.hpp"
|
||||||
|
#include "CommandMenuVisualizer.hpp"
|
||||||
|
|
||||||
|
void PlayingViewVisualizer::GenerateElement() {
|
||||||
|
position_vector.clear();
|
||||||
|
display_vector.clear();
|
||||||
|
ChessboardVisualizer chessboardVisualizer = ChessboardVisualizer(CHESSBOARD, 2);
|
||||||
|
HistorieVisualizer historieVisualizer = HistorieVisualizer(CHESSBOARD, 32, 2);
|
||||||
|
CommandMenuVisualizer cmdMenuVisualizer = CommandMenuVisualizer(CHESSBOARD, 2);
|
||||||
|
|
||||||
|
GeneratePositionVector(chessboardVisualizer.GetDisplayVector(), historieVisualizer.GetDisplayVector(), cmdMenuVisualizer.GetDisplayVector());
|
||||||
|
|
||||||
|
BaseVisualizer::GenerateTopBottomBorder(MAX_MENU_WIDTH, true, false);
|
||||||
|
BaseVisualizer::GenerateEmptyLine(MAX_MENU_WIDTH, false);
|
||||||
|
|
||||||
|
std::vector<std::string> temp;
|
||||||
|
|
||||||
|
//((single) ? BaseVisualizer::VERTICAL_LINE_SINGLE : BaseVisualizer::VERTICAL_LINE) + std::string(padding, ' ')
|
||||||
|
|
||||||
|
for (const auto& row : position_vector) {
|
||||||
|
display_vector.push_back(row);
|
||||||
|
}
|
||||||
|
|
||||||
|
BaseVisualizer::GenerateEmptyLine(MAX_MENU_WIDTH, false);
|
||||||
|
BaseVisualizer::GenerateTopBottomBorder(MAX_MENU_WIDTH, false, false);
|
||||||
|
//size_t maxWidth = BaseVisualizer::FindMaxLength(chessboardVisualizer.display_vector);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlayingViewVisualizer::GeneratePositionVector(
|
||||||
|
std::vector<std::vector<std::string>>* chessboard_display_vector,
|
||||||
|
std::vector<std::vector<std::string>>* historie_display_vector,
|
||||||
|
std::vector<std::vector<std::string>>* command_menu_display_vector)
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < chessboard_display_vector->size(); ++i) {
|
||||||
|
size_t test;
|
||||||
|
std::vector<std::string> temp;
|
||||||
|
temp.push_back({BaseVisualizer::VERTICAL_LINE + " "});
|
||||||
|
if (i == 0) {
|
||||||
|
const std::string& first_element = chessboard_display_vector->at(i).at(0);
|
||||||
|
temp.push_back(first_element);
|
||||||
|
temp.push_back(std::string(62-BaseVisualizer::CountVisibleCharacters(first_element), ' '));
|
||||||
|
} else if (chessboard_display_vector->at(i).size() > 1 && i != 0) {
|
||||||
|
temp.insert(temp.end(), chessboard_display_vector->at(i).begin(), chessboard_display_vector->at(i).end());
|
||||||
|
} else {
|
||||||
|
temp.push_back(chessboard_display_vector->at(i).at(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i < historie_display_vector->size()) {
|
||||||
|
temp.push_back(std::string(DISTANCE_BETWEEN_ELEMENTS, ' '));
|
||||||
|
temp.push_back(historie_display_vector->at(i)[0]);
|
||||||
|
} else if (i-3-historie_display_vector->size() < command_menu_display_vector->size()) {
|
||||||
|
temp.push_back(std::string(DISTANCE_BETWEEN_ELEMENTS, ' '));
|
||||||
|
temp.push_back(command_menu_display_vector->at(i-3-historie_display_vector->size())[0]);
|
||||||
|
} else{
|
||||||
|
temp.push_back({"", ""});
|
||||||
|
}
|
||||||
|
|
||||||
|
BaseVisualizer::GetSumAllCharsFromVector(temp);
|
||||||
|
temp.push_back(std::string(MAX_MENU_WIDTH-BaseVisualizer::GetSumAllCharsFromVector(temp)-1, ' ') + BaseVisualizer::VERTICAL_LINE);
|
||||||
|
|
||||||
|
position_vector.push_back(temp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlayingViewVisualizer::DisplayElement() {
|
||||||
|
PlayingViewVisualizer::GenerateElement();
|
||||||
|
size_t size;
|
||||||
|
std::string temp;
|
||||||
|
for (int row = 0; row < display_vector.size(); ++row) {
|
||||||
|
for (int column = 0; column < display_vector[row].size(); ++column) {
|
||||||
|
if (row >= 4 && row <= 27 && column >= 3 && column <= 10) {
|
||||||
|
bool isSecondRowOfField = ((row-1) % 3 == 2);
|
||||||
|
bool isBlackWhite = ((column-1) % 2 == (row-1) % 2);
|
||||||
|
|
||||||
|
if ((row - 1) % 3 == 0) { // Change after 3 rows
|
||||||
|
if (isSecondRowOfField) {
|
||||||
|
this->SetConsoleColor(isBlackWhite ? BLACK : WHITE, isBlackWhite ? WHITE : BLACK);
|
||||||
|
} else {
|
||||||
|
this->SetConsoleColor(isBlackWhite ? WHITE : BLACK, isBlackWhite ? BLACK : WHITE);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (isSecondRowOfField) {
|
||||||
|
this->SetConsoleColor(isBlackWhite ? WHITE : BLACK, isBlackWhite ? BLACK : WHITE);
|
||||||
|
} else {
|
||||||
|
this->SetConsoleColor(isBlackWhite ? BLACK : WHITE, isBlackWhite ? WHITE : BLACK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
std::cout << display_vector[row][column];
|
||||||
|
this->SetConsoleColor(DEFAULT, DEFAULT);
|
||||||
|
}
|
||||||
|
this->SetConsoleColor(DEFAULT, DEFAULT);
|
||||||
|
|
||||||
|
std::cout << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string PlayingViewVisualizer::GetMove() {
|
||||||
|
return move;
|
||||||
|
}
|
29
Visualizer/PlayingViewVisualizer.hpp
Normal file
29
Visualizer/PlayingViewVisualizer.hpp
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
#ifndef PLAYINGVIEWVISUALIZER_HPP
|
||||||
|
#define PLAYINGVIEWVISUALIZER_HPP
|
||||||
|
|
||||||
|
#include "BaseVisualizer.hpp"
|
||||||
|
#include "../Chessboard/Chessboard.hpp"
|
||||||
|
|
||||||
|
class PlayingViewVisualizer : public BaseVisualizer {
|
||||||
|
private:
|
||||||
|
const size_t DISTANCE_BETWEEN_ELEMENTS;
|
||||||
|
|
||||||
|
Chessboard* CHESSBOARD;
|
||||||
|
std::string move;
|
||||||
|
|
||||||
|
std::vector<std::vector<std::string>> position_vector;
|
||||||
|
|
||||||
|
void GenerateElement();
|
||||||
|
void GeneratePositionVector(
|
||||||
|
std::vector<std::vector<std::string>>* chessboard_display_vector,
|
||||||
|
std::vector<std::vector<std::string>>* historie_display_vector,
|
||||||
|
std::vector<std::vector<std::string>>* command_menu_display_vector);
|
||||||
|
|
||||||
|
public:
|
||||||
|
PlayingViewVisualizer(Chessboard* chessboard, size_t padding, size_t distance) :
|
||||||
|
BaseVisualizer(110, padding), CHESSBOARD(chessboard), DISTANCE_BETWEEN_ELEMENTS(distance) {}
|
||||||
|
void DisplayElement();
|
||||||
|
std::string GetMove();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //PLAYINGVIEWVISUALIZER_HPP
|
66
Visualizer/StartMenuVisualizer.cpp
Normal file
66
Visualizer/StartMenuVisualizer.cpp
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
#include "StartMenuVisualizer.hpp"
|
||||||
|
|
||||||
|
void StartMenuVisualizer::GenerateElement() {
|
||||||
|
BaseVisualizer::GenerateTopBottomBorder(MAX_MENU_WIDTH, true, false);
|
||||||
|
|
||||||
|
BaseVisualizer::AddEmptyLines(2, MAX_MENU_WIDTH, false);
|
||||||
|
|
||||||
|
for (const auto& str : StartMenuVisualizer::ACSII_ART_TURBO_SCHACH) {
|
||||||
|
BaseVisualizer::GenerateCenteredString(MAX_MENU_WIDTH, str, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
BaseVisualizer::AddEmptyLines(2, MAX_MENU_WIDTH, false);
|
||||||
|
|
||||||
|
BaseVisualizer::GenerateCenteredString(MAX_MENU_WIDTH, "Welcome to TurboSchach!", false);
|
||||||
|
|
||||||
|
BaseVisualizer::AddEmptyLines(2, MAX_MENU_WIDTH, false);
|
||||||
|
|
||||||
|
BaseVisualizer::GenerateCenteredString(MAX_MENU_WIDTH, "Please select one of the menu options:", false);
|
||||||
|
BaseVisualizer::GenerateCenteredString(MAX_MENU_WIDTH, "\x1B[s", false);
|
||||||
|
|
||||||
|
BaseVisualizer::AddEmptyLines(1, MAX_MENU_WIDTH, false);
|
||||||
|
|
||||||
|
// ToDo: Attribute zum direkten setzen des Types der Außenbegrenzung -> Allgemein in BaseVisualizer auch?
|
||||||
|
// ToDo: Überarbeiten -> Extra Methode um Menus im Menu zu generieren
|
||||||
|
BaseVisualizer::GenerateTopBottomBorder(24, true, true);
|
||||||
|
BaseVisualizer::GenerateCenteredString(MAX_MENU_WIDTH, BaseVisualizer::display_vector[BaseVisualizer::display_vector.size()-1][0], false);
|
||||||
|
BaseVisualizer::display_vector.erase(BaseVisualizer::display_vector.begin() + (BaseVisualizer::display_vector.size() - 2));
|
||||||
|
|
||||||
|
|
||||||
|
for (const auto& str : StartMenuVisualizer::MENU_OPTIONS) {
|
||||||
|
BaseVisualizer::GenerateBoxMenuLine(24, str, true, 1);
|
||||||
|
BaseVisualizer::GenerateCenteredString(MAX_MENU_WIDTH, BaseVisualizer::display_vector[BaseVisualizer::display_vector.size()-1][0], false);
|
||||||
|
BaseVisualizer::display_vector.erase(BaseVisualizer::display_vector.begin() + (BaseVisualizer::display_vector.size() - 2));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
BaseVisualizer::GenerateTopBottomBorder(24, false, true);
|
||||||
|
BaseVisualizer::GenerateCenteredString(MAX_MENU_WIDTH, BaseVisualizer::display_vector[BaseVisualizer::display_vector.size()-1][0], false);
|
||||||
|
BaseVisualizer::display_vector.erase(BaseVisualizer::display_vector.begin() + (BaseVisualizer::display_vector.size() - 2));
|
||||||
|
|
||||||
|
|
||||||
|
BaseVisualizer::AddEmptyLines(2, MAX_MENU_WIDTH, false);
|
||||||
|
|
||||||
|
BaseVisualizer::GenerateTopBottomBorder(MAX_MENU_WIDTH, false, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
int StartMenuVisualizer::GetSelectedOption() {
|
||||||
|
return selectedOption;
|
||||||
|
}
|
||||||
|
|
||||||
|
void StartMenuVisualizer::SetSelectedOption(int optionSelect) {
|
||||||
|
selectedOption = selectedOption;
|
||||||
|
};
|
||||||
|
|
||||||
|
void StartMenuVisualizer::DisplayElement1() {
|
||||||
|
BaseVisualizer::ClearTerminal();
|
||||||
|
int temp;
|
||||||
|
for (const auto& row : display_vector) {
|
||||||
|
for (const auto& cell : row) {
|
||||||
|
std::cout << cell;
|
||||||
|
}
|
||||||
|
std::cout << std::endl;
|
||||||
|
}
|
||||||
|
std::cout << "\x1B[u";
|
||||||
|
std::cin >> selectedOption;
|
||||||
|
}
|
39
Visualizer/StartMenuVisualizer.hpp
Normal file
39
Visualizer/StartMenuVisualizer.hpp
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
#ifndef STARTMENUVISUALIZER_H
|
||||||
|
#define STARTMENUVISUALIZER_H
|
||||||
|
|
||||||
|
#include "BaseVisualizer.hpp"
|
||||||
|
|
||||||
|
class StartMenuVisualizer : public BaseVisualizer {
|
||||||
|
private:
|
||||||
|
inline static const std::vector<std::string> ACSII_ART_TURBO_SCHACH = {
|
||||||
|
"████████╗██╗░░░██╗██████╗░██████╗░░█████╗░░██████╗░█████╗░██╗░░██╗░█████╗░░█████╗░██╗░░██╗",
|
||||||
|
"╚══██╔══╝██║░░░██║██╔══██╗██╔══██╗██╔══██╗██╔════╝██╔══██╗██║░░██║██╔══██╗██╔══██╗██║░░██║",
|
||||||
|
"░░░██║░░░██║░░░██║██████╔╝██████╦╝██║░░██║╚█████╗░██║░░╚═╝███████║███████║██║░░╚═╝███████║",
|
||||||
|
"░░░██║░░░██║░░░██║██╔══██╗██╔══██╗██║░░██║░╚═══██╗██║░░██╗██╔══██║██╔══██║██║░░██╗██╔══██║",
|
||||||
|
"░░░██║░░░╚██████╔╝██║░░██║██████╦╝╚█████╔╝██████╔╝╚█████╔╝██║░░██║██║░░██║╚█████╔╝██║░░██║",
|
||||||
|
"░░░╚═╝░░░░╚═════╝░╚═╝░░╚═╝╚═════╝░░╚════╝░╚═════╝░░╚════╝░╚═╝░░╚═╝╚═╝░░╚═╝░╚════╝░╚═╝░░╚═╝"
|
||||||
|
};
|
||||||
|
|
||||||
|
inline static const std::vector<std::string> MENU_OPTIONS = {
|
||||||
|
"1 - New Game",
|
||||||
|
"2 - Load Save",
|
||||||
|
"3 - Instructions",
|
||||||
|
"",
|
||||||
|
"0 - Exit"
|
||||||
|
};
|
||||||
|
|
||||||
|
int selectedOption = -1;
|
||||||
|
|
||||||
|
void GenerateElement() override;
|
||||||
|
|
||||||
|
public:
|
||||||
|
StartMenuVisualizer(size_t padding) : BaseVisualizer(BaseVisualizer::CountVisibleCharacters(StartMenuVisualizer::ACSII_ART_TURBO_SCHACH[0]), padding) {
|
||||||
|
StartMenuVisualizer::GenerateElement();
|
||||||
|
}
|
||||||
|
int GetSelectedOption();
|
||||||
|
void SetSelectedOption(int selectedOption);
|
||||||
|
void DisplayElement1();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //STARTMENUVISUALIZER_H
|
256
main.cpp
256
main.cpp
@@ -1,135 +1,155 @@
|
|||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
//#include "Chessboard.cpp"
|
#include "Player/Player.hpp"
|
||||||
#include "ChessPieces/Knight.hpp"
|
|
||||||
#include "ChessPieces/Bishop.hpp"
|
|
||||||
#include "ChessPieces/King.hpp"
|
|
||||||
#include "ChessPieces/Pawn.hpp"
|
|
||||||
#include "ChessPieces/Queen.hpp"
|
|
||||||
#include "ChessPieces/Rook.hpp"
|
|
||||||
#include "ChessPieces/ChessPiece.hpp"
|
#include "ChessPieces/ChessPiece.hpp"
|
||||||
#include "Chessboard/Chessboard.hpp"
|
#include "Chessboard/Chessboard.hpp"
|
||||||
#include "ChessPieces/ChessPiecePosition.hpp"
|
#include "Chessboard/ChessboardVisualizerText.hpp"
|
||||||
|
#include "Chessboard/ChessboardVisualizerGraphic.hpp"
|
||||||
|
#include "Visualizer/BaseVisualizer.hpp"
|
||||||
|
#include "Visualizer/StartMenuVisualizer.hpp"
|
||||||
|
#include "Visualizer/HistorieVisualizer.hpp"
|
||||||
|
#include "Visualizer/ChessboardVisualizer.hpp"
|
||||||
|
#include "Visualizer/CommandMenuVisualizer.hpp"
|
||||||
|
#include "Visualizer/PlayingViewVisualizer.hpp"
|
||||||
|
#include "Visualizer/InstructionsVisualizer.hpp"
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
#include <iostream>
|
||||||
|
#include <memory>
|
||||||
|
#include <vector>
|
||||||
|
#include <string>
|
||||||
|
#include <locale>
|
||||||
|
|
||||||
|
void HandleThirdOption() {
|
||||||
|
BaseVisualizer::ClearTerminal();
|
||||||
|
InstructionsVisualizer instructions = InstructionsVisualizer();
|
||||||
|
instructions.DisplayElement();
|
||||||
|
std::cout << "\x1B[u";
|
||||||
|
std::cin;
|
||||||
|
}
|
||||||
|
|
||||||
|
void HandleCommandOptions(const std::string& command) {
|
||||||
|
if (command == "1") {
|
||||||
|
HandleThirdOption();
|
||||||
|
} else if (command == "2") {
|
||||||
|
// ToDo: Save implementieren
|
||||||
|
} else if (command == "3") {
|
||||||
|
// ToDo: Exit implementieren -> Möglichkeit noch zu speichern oder einfach speichern?
|
||||||
|
} else if (command == "8") {
|
||||||
|
// ToDo: Spiel beenden -> Gewinn an anderen gegeben
|
||||||
|
} else if (command == "9") {
|
||||||
|
// ToDo: Draw anbieten -> Anfrage mit Annahme/Ablehnen an anderen Spieler schicken
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string ExtractAfterDollar(const std::string& userInput) {
|
||||||
|
// Überprüfen, ob der String mit '$' beginnt
|
||||||
|
if (!userInput.empty() && userInput[0] == '$') {
|
||||||
|
return userInput.substr(1); // Rückgabe des Teils nach '$'
|
||||||
|
}
|
||||||
|
return ""; // Leerer String, wenn kein '$' am Anfang
|
||||||
|
}
|
||||||
|
|
||||||
|
void HandleFirstOption() {
|
||||||
|
BaseVisualizer::ClearTerminal();
|
||||||
|
Player* playerA = new Player("Player 1");
|
||||||
|
Player* playerB = new Player("Player 2");
|
||||||
|
|
||||||
|
Chessboard chessboard = Chessboard();
|
||||||
|
chessboard.SetPlayers(playerA, playerB);
|
||||||
|
|
||||||
|
chessboard.InitializeStartBoard();
|
||||||
|
|
||||||
|
PlayingViewVisualizer playView = PlayingViewVisualizer(&chessboard, 4, 12);
|
||||||
|
|
||||||
|
while (chessboard.IsCheckmate() == false) {
|
||||||
|
std::string input;
|
||||||
|
|
||||||
|
playView.DisplayElement();
|
||||||
|
|
||||||
|
std::cout << "\x1B[u";
|
||||||
|
std::cin >> input;
|
||||||
|
|
||||||
|
std::string command = ExtractAfterDollar(input);
|
||||||
|
|
||||||
|
while (command != "3") {
|
||||||
|
if (command != "") {
|
||||||
|
HandleCommandOptions(command);
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
//ToDo: Valide Züge annehmen
|
||||||
|
chessboard.MoveChessPiece(input);
|
||||||
|
}
|
||||||
|
// ToDo: Nicht valide Eingabe melden -> Unterscheidung was falsch?
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
std::cout << "Game is over! - " << chessboard.GetOpponentPlayer()->GetName() << " has won the game!" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
void HandleSecondOption() {}
|
||||||
|
|
||||||
|
int main() {
|
||||||
SetConsoleOutputCP(CP_UTF8);
|
SetConsoleOutputCP(CP_UTF8);
|
||||||
|
|
||||||
ChessPiecePosition* p = new ChessPiecePosition("A5");
|
BaseVisualizer::ClearTerminal();
|
||||||
ChessPiecePosition* ppp = new ChessPiecePosition("A5");
|
|
||||||
ChessPiecePosition* a;
|
|
||||||
std::cout << p->ToString() << std::endl;
|
|
||||||
|
|
||||||
a = p;
|
StartMenuVisualizer startMenu = StartMenuVisualizer(3);
|
||||||
while (a = a->NextBottom()) {
|
int choice = -1;
|
||||||
std::cout << a->ToString() << std::endl;
|
|
||||||
|
while (startMenu.GetSelectedOption() != 0) {
|
||||||
|
BaseVisualizer::ClearTerminal();
|
||||||
|
startMenu.DisplayElement1();
|
||||||
|
|
||||||
|
if (startMenu.GetSelectedOption() == 1) {
|
||||||
|
HandleFirstOption();
|
||||||
|
} else if (startMenu.GetSelectedOption() == 2) {
|
||||||
|
HandleSecondOption();
|
||||||
|
} else if (startMenu.GetSelectedOption() == 3) {
|
||||||
|
HandleThirdOption();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
a = p;
|
//CommandMenuVisualizer commandMenu = CommandMenuVisualizer(2);
|
||||||
while (a = a->NextTopRight()) {
|
//commandMenu.DisplayElement();
|
||||||
std::cout << a->ToString() << std::endl;
|
//HistorieVisualizer historie = HistorieVisualizer(15, 2, "Player 1", "Player 2");
|
||||||
}
|
//historie.DisplayElement();
|
||||||
|
|
||||||
|
|
||||||
std::vector<ChessPiecePosition> pospos;
|
|
||||||
pospos.push_back(*p);
|
|
||||||
ChessPiecePosition pppp = pospos.back();
|
|
||||||
|
|
||||||
std::set<ChessPiecePosition> pos;
|
|
||||||
pos.insert(*p);
|
|
||||||
int t = pos.count(*ppp);
|
|
||||||
|
|
||||||
delete p;
|
|
||||||
|
|
||||||
t = pos.count(*ppp);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Test Code
|
|
||||||
Bishop bishop1 = Bishop(ChessPieceColor::Black, ChessPiecePosition{'A', 1});
|
|
||||||
Bishop bishop2 = Bishop(ChessPieceColor::White, ChessPiecePosition{'B', 2});
|
|
||||||
std::cout << bishop1.GetCharUnicode() << Bishop::GetCharUnicode(ChessPieceColor::Black) << " Position: " << bishop1.GetPosition().ToString() << " - Algebraic Notation: " << bishop1.GetAlgebraicNotationSymbol() << std::endl;
|
|
||||||
std::cout << bishop2.GetCharUnicode() << Bishop::GetCharUnicode(ChessPieceColor::White) << " Position: " << bishop2.GetPosition().ToString() << " - Algebraic Notation: " << bishop2.GetAlgebraicNotationSymbol() << std::endl;
|
|
||||||
King king1 = King(ChessPieceColor::Black, ChessPiecePosition('A', 1));
|
|
||||||
King king2 = King(ChessPieceColor::White, ChessPiecePosition('B', 2));
|
|
||||||
std::cout << king1.GetCharUnicode() << King::GetCharUnicode(ChessPieceColor::Black) << " Position: " << king1.GetPosition().ToString() << " - Algebraic Notation: " << king1.GetAlgebraicNotationSymbol() << std::endl;
|
|
||||||
std::cout << king2.GetCharUnicode() << King::GetCharUnicode(ChessPieceColor::White) << " Position: " << king2.GetPosition().ToString() << " - Algebraic Notation: " << king2.GetAlgebraicNotationSymbol() << std::endl;
|
|
||||||
Knight knight1 = Knight(ChessPieceColor::Black, ChessPiecePosition{'A', 1});
|
|
||||||
Knight knight2 = Knight(ChessPieceColor::White, ChessPiecePosition{'B', 2});
|
|
||||||
std::cout << knight1.GetCharUnicode() << Knight::GetCharUnicode(ChessPieceColor::Black) << " Position: " << knight1.GetPosition().ToString() << " - Algebraic Notation: " << knight1.GetAlgebraicNotationSymbol() << std::endl;
|
|
||||||
std::cout << knight2.GetCharUnicode() << Knight::GetCharUnicode(ChessPieceColor::White) << " Position: " << knight2.GetPosition().ToString() << " - Algebraic Notation: " << knight2.GetAlgebraicNotationSymbol() << std::endl;
|
|
||||||
Pawn pawn1 = Pawn(ChessPieceColor::Black, ChessPiecePosition{'A', 1});
|
|
||||||
Pawn pawn2 = Pawn(ChessPieceColor::White, ChessPiecePosition{'B', 2});
|
|
||||||
std::cout << pawn1.GetCharUnicode() << Pawn::GetCharUnicode(ChessPieceColor::Black) << " Position: " << pawn1.GetPosition().ToString() << " - Algebraic Notation: " << pawn1.GetAlgebraicNotationSymbol() << std::endl;
|
|
||||||
std::cout << pawn2.GetCharUnicode() << Pawn::GetCharUnicode(ChessPieceColor::White) << " Position: " << pawn2.GetPosition().ToString() << " - Algebraic Notation: " << pawn2.GetAlgebraicNotationSymbol() << std::endl;
|
|
||||||
Queen queen1 = Queen(ChessPieceColor::Black, ChessPiecePosition{'A', 1});
|
|
||||||
Queen queen2 = Queen(ChessPieceColor::White, ChessPiecePosition{'B', 2});
|
|
||||||
std::cout << queen1.GetCharUnicode() << Queen::GetCharUnicode(ChessPieceColor::Black) << " Position: " << queen1.GetPosition().ToString() << " - Algebraic Notation: " << queen1.GetAlgebraicNotationSymbol() << std::endl;
|
|
||||||
std::cout << queen2.GetCharUnicode() << Queen::GetCharUnicode(ChessPieceColor::White) << " Position: " << queen1.GetPosition().ToString() << " - Algebraic Notation: " << queen2.GetAlgebraicNotationSymbol() << std::endl;
|
|
||||||
Rook rook1 = Rook(ChessPieceColor::Black, ChessPiecePosition{'A', 1});
|
|
||||||
Rook rook2 = Rook(ChessPieceColor::White, ChessPiecePosition{'B', 2});
|
|
||||||
std::cout << rook1.GetCharUnicode() << Rook::GetCharUnicode(ChessPieceColor::Black) << " Position: " << rook1.GetPosition().ToString() << " - Algebraic Notation: " << rook1.GetAlgebraicNotationSymbol() << std::endl;
|
|
||||||
std::cout << rook2.GetCharUnicode() << Rook::GetCharUnicode(ChessPieceColor::White) << " Position: " << rook2.GetPosition().ToString() << " - Algebraic Notation: " << rook2.GetAlgebraicNotationSymbol() << std::endl;
|
|
||||||
|
|
||||||
Chessboard chessboard = Chessboard();
|
|
||||||
|
|
||||||
// set black chess pieces
|
|
||||||
chessboard.SetChessPiece(new Rook{ChessPieceColor::Black, ChessPiecePosition{'A', 8}});
|
|
||||||
chessboard.SetChessPiece(new Knight{ChessPieceColor::Black, ChessPiecePosition{'B', 8}});
|
|
||||||
chessboard.SetChessPiece(new Bishop{ChessPieceColor::Black, ChessPiecePosition{'C', 8}});
|
|
||||||
chessboard.SetChessPiece(new Queen{ChessPieceColor::Black, ChessPiecePosition{'D', 8}});
|
|
||||||
chessboard.SetChessPiece(new King{ChessPieceColor::Black, ChessPiecePosition{'E', 8}});
|
|
||||||
chessboard.SetChessPiece(new Bishop{ChessPieceColor::Black, ChessPiecePosition{'F', 8}});
|
|
||||||
chessboard.SetChessPiece(new Knight{ChessPieceColor::Black, ChessPiecePosition{'G', 8}});
|
|
||||||
chessboard.SetChessPiece(new Rook{ChessPieceColor::Black, ChessPiecePosition{'H', 8}});
|
|
||||||
chessboard.SetChessPiece(new Pawn{ChessPieceColor::Black, ChessPiecePosition{'A', 7}});
|
|
||||||
chessboard.SetChessPiece(new Pawn{ChessPieceColor::Black, ChessPiecePosition{'B', 7}});
|
|
||||||
chessboard.SetChessPiece(new Pawn{ChessPieceColor::Black, ChessPiecePosition{'C', 7}});
|
|
||||||
chessboard.SetChessPiece(new Pawn{ChessPieceColor::Black, ChessPiecePosition{'D', 7}});
|
|
||||||
chessboard.SetChessPiece(new Pawn{ChessPieceColor::Black, ChessPiecePosition{'E', 7}});
|
|
||||||
chessboard.SetChessPiece(new Pawn{ChessPieceColor::Black, ChessPiecePosition{'F', 7}});
|
|
||||||
chessboard.SetChessPiece(new Pawn{ChessPieceColor::Black, ChessPiecePosition{'G', 7}});
|
|
||||||
chessboard.SetChessPiece(new Pawn{ChessPieceColor::Black, ChessPiecePosition{'H', 7}});
|
|
||||||
|
|
||||||
// set white chess pieces
|
|
||||||
chessboard.SetChessPiece(new Rook{ChessPieceColor::White, ChessPiecePosition{'A', 1}});
|
|
||||||
chessboard.SetChessPiece(new Knight{ChessPieceColor::White, ChessPiecePosition{'B', 1}});
|
|
||||||
chessboard.SetChessPiece(new Bishop{ChessPieceColor::White, ChessPiecePosition{'C', 1}});
|
|
||||||
chessboard.SetChessPiece(new Queen{ChessPieceColor::White, ChessPiecePosition{'D', 1}});
|
|
||||||
chessboard.SetChessPiece(new King{ChessPieceColor::White, ChessPiecePosition{'E', 1}});
|
|
||||||
chessboard.SetChessPiece(new Bishop{ChessPieceColor::White, ChessPiecePosition{'F', 1}});
|
|
||||||
chessboard.SetChessPiece(new Knight{ChessPieceColor::White, ChessPiecePosition{'G', 1}});
|
|
||||||
chessboard.SetChessPiece(new Rook{ChessPieceColor::White, ChessPiecePosition{'H', 1}});
|
|
||||||
chessboard.SetChessPiece(new Pawn{ChessPieceColor::White, ChessPiecePosition{'A', 2}});
|
|
||||||
chessboard.SetChessPiece(new Pawn{ChessPieceColor::White, ChessPiecePosition{'B', 2}});
|
|
||||||
chessboard.SetChessPiece(new Pawn{ChessPieceColor::White, ChessPiecePosition{'C', 2}});
|
|
||||||
chessboard.SetChessPiece(new Pawn{ChessPieceColor::White, ChessPiecePosition{'D', 2}});
|
|
||||||
chessboard.SetChessPiece(new Pawn{ChessPieceColor::White, ChessPiecePosition{'E', 2}});
|
|
||||||
chessboard.SetChessPiece(new Pawn{ChessPieceColor::White, ChessPiecePosition{'F', 2}});
|
|
||||||
chessboard.SetChessPiece(new Pawn{ChessPieceColor::White, ChessPiecePosition{'G', 2}});
|
|
||||||
chessboard.SetChessPiece(new Pawn{ChessPieceColor::White, ChessPiecePosition{'H', 2}});
|
|
||||||
|
|
||||||
// ChessPiece* aa = chessboard.GetChessPiece(ChessPiecePosition('A', 1));
|
|
||||||
// std::cout << "Test: " << aa->GetAlgebraicNotationSymbol() << std::endl;
|
|
||||||
// std::cout << aa->GetColorName() << std::endl;
|
|
||||||
|
|
||||||
// std::cout << "First Move? - " << chessboard.GetChessPiece(ChessPiecePosition('A', 1))->IsFirstMove() << std::endl;
|
|
||||||
|
|
||||||
// Jetzt kann man Moves machen. Nach jedem Move müssen die ChessPieces aktualisiert werden.
|
|
||||||
chessboard.UpdateChessPieces();
|
|
||||||
|
|
||||||
while (true) {
|
|
||||||
std::string move;
|
|
||||||
std::cout << "Move: ";
|
|
||||||
std::cin >> move;
|
|
||||||
chessboard.MoveChessPiece(move);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// chessboard.SetChessPiece(rook1);
|
/*if () {
|
||||||
// ChessPiece aa = chessboard.GetChessPiece(rook1.GetPosition());
|
Player* playerA = new Player("Player 1");
|
||||||
|
Player* playerB = new Player("Player 2");
|
||||||
|
|
||||||
// Ist das Feld leer?
|
Chessboard chessboard = Chessboard();
|
||||||
// std::cout << chessboard.IsEmptyField(a.GetPosition()) << std::endl;
|
chessboard.SetPlayers(playerA, playerB);
|
||||||
// std::cout << chessboard.IsEmptyField(ChessPiecePosition{'A', 5}) << std::endl;
|
|
||||||
|
chessboard.InitializeStartBoard();
|
||||||
|
|
||||||
|
// Jetzt kann man Moves machen. Nach jedem Move müssen die ChessPieces aktualisiert werden.
|
||||||
|
chessboard.UpdateChessPieces();
|
||||||
|
|
||||||
|
//ChessboardVisualizerText* visualizer = new ChessboardVisualizerText();
|
||||||
|
ChessboardVisualizer visualizer(&chessboard, 2);
|
||||||
|
|
||||||
|
|
||||||
|
}*/
|
||||||
|
//}
|
||||||
|
|
||||||
|
/*std::cout << "Spieler A: ";
|
||||||
|
std::string namePlayerA;
|
||||||
|
getline(std::cin, namePlayerA);
|
||||||
|
std::cout << "Spieler B: ";
|
||||||
|
std::string namePlayerB;
|
||||||
|
getline(std::cin, namePlayerB);
|
||||||
|
|
||||||
|
Player* playerA = new Player("1");
|
||||||
|
Player* playerB = new Player("2");*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
std::vector<std::vector<ChessPiece>> chessmatrix;
|
std::vector<std::vector<ChessPiece>> chessmatrix;
|
||||||
@@ -156,5 +176,3 @@ int main(int argc, char* argv[]) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
Reference in New Issue
Block a user