diff --git a/CppProperties.json b/CppProperties.json new file mode 100644 index 0000000..659bf4e --- /dev/null +++ b/CppProperties.json @@ -0,0 +1,21 @@ +{ + "configurations": [ + { + "inheritEnvironments": [ + "msvc_x86" + ], + "name": "x86-Debug", + "includePath": [ + "${env.INCLUDE}", + "${workspaceRoot}\\**" + ], + "defines": [ + "WIN32", + "_DEBUG", + "UNICODE", + "_UNICODE" + ], + "intelliSenseMode": "windows-msvc-x86" + } + ] +} \ No newline at end of file diff --git a/board.cpp b/board.cpp deleted file mode 100644 index 760c88e..0000000 --- a/board.cpp +++ /dev/null @@ -1,42 +0,0 @@ -#include "board.h" - -Board::Board() { - StartingPosition(); -} - -void Board::StartingPosition() { - - // Clear the board - for (int i = 0; i < 8; i++) { - for (int j = 0; j < 8; j++) { - m_Board[i][j] = 0; - } - } - - m_Board[0][0] = Piece::WHITE_ROOK; - m_Board[7][0] = Piece::WHITE_ROOK; - m_Board[1][0] = Piece::WHITE_KNIGHT; - m_Board[6][0] = Piece::WHITE_KNIGHT; - m_Board[2][0] = Piece::WHITE_BISHOP; - m_Board[5][0] = Piece::WHITE_BISHOP; - m_Board[3][0] = Piece::WHITE_QUEEN; - m_Board[4][0] = Piece::WHITE_KING; - - for (int i = 0; i < 8; i++) { - m_Board[i][1] = Piece::WHITE_PAWN; - } - - - m_Board[0][7] = Piece::BLACK_ROOK; - m_Board[7][7] = Piece::BLACK_ROOK; - m_Board[1][7] = Piece::BLACK_KNIGHT; - m_Board[6][7] = Piece::BLACK_KNIGHT; - m_Board[2][7] = Piece::BLACK_BISHOP; - m_Board[5][7] = Piece::BLACK_BISHOP; - m_Board[3][7] = Piece::BLACK_QUEEN; - m_Board[4][7] = Piece::BLACK_KING; - - for (int i = 0; i < 8; i++) { - m_Board[i][6] = Piece::BLACK_PAWN; - } -} diff --git a/board.h b/board.h deleted file mode 100644 index 904db5b..0000000 --- a/board.h +++ /dev/null @@ -1,33 +0,0 @@ -#include - -struct Move { - public: - int m_Position; - int m_Moveto; -} - -enum Piece { - NONE = 0, - WHITE_KING = 1, - WHITE_PAWN = 2, - WHITE_KNIGHT = 3, - WHITE_BISHOP = 4, - WHITE_ROOK = 5, - WHITE_QUEEN = 6, - BLACK_KING = 7, - BLACK_PAWN = 8, - BLACK_KNIGHT = 9, - BLACK_BISHOP = 10, - BLACK_ROOK = 11, - BLACK_QUEEN = 12 -}; - -class Board { - public: - char m_Board[8][8] = { 0 }; // We start the index with a1 then b1 and so on - - Board(); - - void StartingPosition(); - -} \ No newline at end of file diff --git a/main.cpp b/main.cpp deleted file mode 100644 index 2346f4a..0000000 --- a/main.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include -#include - - - -int main() { - Board board; - - for (int i = 0; i < 8; i++) { - for (int j = 0; j < 8; j++) { - printf("%i\n", m_Board[i][j]); - } - } -} \ No newline at end of file diff --git a/milesChess.sln b/milesChess.sln new file mode 100644 index 0000000..a43a193 --- /dev/null +++ b/milesChess.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.5.33516.290 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "milesChess", "milesChess.vcxproj", "{B830A8D2-D5AE-4B5F-9AA1-6BD2A4CBEE5E}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B830A8D2-D5AE-4B5F-9AA1-6BD2A4CBEE5E}.Debug|x64.ActiveCfg = Debug|x64 + {B830A8D2-D5AE-4B5F-9AA1-6BD2A4CBEE5E}.Debug|x64.Build.0 = Debug|x64 + {B830A8D2-D5AE-4B5F-9AA1-6BD2A4CBEE5E}.Debug|x86.ActiveCfg = Debug|Win32 + {B830A8D2-D5AE-4B5F-9AA1-6BD2A4CBEE5E}.Debug|x86.Build.0 = Debug|Win32 + {B830A8D2-D5AE-4B5F-9AA1-6BD2A4CBEE5E}.Release|x64.ActiveCfg = Release|x64 + {B830A8D2-D5AE-4B5F-9AA1-6BD2A4CBEE5E}.Release|x64.Build.0 = Release|x64 + {B830A8D2-D5AE-4B5F-9AA1-6BD2A4CBEE5E}.Release|x86.ActiveCfg = Release|Win32 + {B830A8D2-D5AE-4B5F-9AA1-6BD2A4CBEE5E}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {A60EF79C-35EE-49BD-9C8F-4AFE395CB02E} + EndGlobalSection +EndGlobal diff --git a/milesChess.vcxproj b/milesChess.vcxproj new file mode 100644 index 0000000..3033177 --- /dev/null +++ b/milesChess.vcxproj @@ -0,0 +1,113 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 17.0 + {B830A8D2-D5AE-4B5F-9AA1-6BD2A4CBEE5E} + Win32Proj + + + + Application + true + v143 + + + Application + false + v143 + + + Application + true + v143 + + + Application + false + v143 + + + + + + + + + + + + + + + + + + + + + true + + + true + + + C:\stuff\dev\milesChess\src;$(IncludePath) + + + + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + MultiThreadedDebugDLL + Level3 + ProgramDatabase + Disabled + + + MachineX86 + true + Windows + + + + + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + MultiThreadedDLL + Level3 + ProgramDatabase + + + MachineX86 + true + Windows + true + true + + + + + + + + + + + + + \ No newline at end of file diff --git a/milesChess.vcxproj.filters b/milesChess.vcxproj.filters new file mode 100644 index 0000000..a90c015 --- /dev/null +++ b/milesChess.vcxproj.filters @@ -0,0 +1,30 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + + + Source Files + + + Source Files + + + + + Header Files + + + \ No newline at end of file diff --git a/src/board.cpp b/src/board.cpp new file mode 100644 index 0000000..828100c --- /dev/null +++ b/src/board.cpp @@ -0,0 +1,34 @@ +#include "board.h" + +#include + +Board::Board() { + StartingPosition(); +} + +static uint64 FenToMap(std::string FEN, char p) { + uint64_t i = 0; + char c; + int pos = 63; + + uint64_t result = 0; + while ((c = FEN[i++]) != ' ') + { + uint64_t P = 1ull << pos; + switch (c) { + case '/': pos += 1; break; + case '1': break; + case '2': pos -= 1; break; + case '3': pos -= 2; break; + case '4': pos -= 3; break; + case '5': pos -= 4; break; + case '6': pos -= 5; break; + case '7': pos -= 6; break; + case '8': pos -= 7; break; + default: + if (c == p) result |= P; + } + pos--; + } + return result; +} \ No newline at end of file diff --git a/src/board.h b/src/board.h new file mode 100644 index 0000000..5cac710 --- /dev/null +++ b/src/board.h @@ -0,0 +1,29 @@ +#include + +using uint64 = unsigned long long; + + +static uint64 FenToMap(std::string FEN, char p); + +class Board { +public: + uint64 m_WhitePawn; + uint64 m_WhiteKnight; + uint64 m_WhiteBishop; + uint64 m_WhiteRook; + uint64 m_WhiteQueen; + uint64 m_WhiteKing; + + uint64 m_BlackPawn; + uint64 m_BlackKnight; + uint64 m_BlackBishop; + uint64 m_BlackRook; + uint64 m_BlackQueen; + uint64 m_BlackKing; + + bool m_Whitetoplay; + + Board(); + + void StartingPosition(); +}; \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..3eb15c1 --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,11 @@ +#include +#include "board.h" + + + +int main() { + Board board; + + + scanf("%i"); +} \ No newline at end of file