Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version
Go to top

C# / C++ CLI Micro Chess (Huo Chess)

, 23 Aug 2014
An article about Huo Chess, a chess program in C++ and C# that attempts to be smaller in size than the Commodore-era Microchess
c__v0.93__all_editions_.zip
C# v0.93 (all editions)
Huo Chess 0.93 (Kakos MiniMax depth 10)
Executable
Huo Chess 0.93 cs.exe
Source
Huo Chess 0.93 cs
Properties
Huo Chess 0.93 (Simple MiniMax)
Executable
Huo Chess 0.93 cs.exe
Source
Huo Chess 0.93 cs
bin
Properties
Huo Chess 0.94 (Kakos MiniMax depth 20)
Executable
Huo Chess 0.93 cs.exe
Source
Huo Chess 0.93 cs
Properties
executable.zip
Executable
Huo Chess 0.94 cs.exe
executables.zip
Executables
Huo Chess version 0.3
Huo Chess Opening Book
HuoChessConsole.exe
Huo Chess version 0.4
Huo Chess Opening Book
HuoChessConsole.exe
Executable_microEdition.zip
Executable_microEdition
HuoChess094cs.exe
huochess093cs.zip
HuoChess093cs.exe
huo_chess_0.6_micro_edition__source_and_exe_.zip
Huo Chess 0.6 micro edition (source and exe)
Executable
HuoChessConsole.exe
Source
HuoChessConsole
HuoChessConsole
app.ico
HuoChessConsole.vcproj.HUB7381LCL.spyridon.kakos.user
HuoChessConsole.vcproj.HZQWB1J.spyridon.kakos.user
HuoChessConsole.vcproj.KAKOS-BROS-HY.Spiros.user
HuoChessConsole.vcproj.STASP.Stavros Kakos.user
huo_chess_0.6__source_and_exe_.zip
Huo Chess 0.6 (source and exe)
Executable
HuoChessConsole.exe
Source
HuoChessConsole
HuoChessConsole
app.ico
HuoChessConsole.vcproj.HUB7381LCL.spyridon.kakos.user
HuoChessConsole.vcproj.HZQWB1J.spyridon.kakos.user
HuoChessConsole.vcproj.KAKOS-BROS-HY.Spiros.user
HuoChessConsole.vcproj.STASP.Stavros Kakos.user
huo_chess_0.721__executable_.zip
Huo Chess 0.721 (executable)
HuoChessConsole.exe
huo_chess_0.721__source_.zip
Huo Chess 0.721 (source)
HuoChessConsole
app.ico
HuoChessConsole.vcproj.HUB7381LCL.spyridon.kakos.user
HuoChessConsole.vcproj.HZQWB1J.spyridon.kakos.user
HuoChessConsole.vcproj.KAKOS-BROS-HY.Spiros.user
HuoChessConsole.vcproj.STASP.Stavros Kakos.user
Huo_Chess_0.722_and_older_versions.zip
Huo Chess 0.722 and older versions
Huo Chess 0.5
Huo Chess 0.5 (Executable).zip
Huo Chess 0.5 (Source).zip
Huo Chess 0.6
Huo Chess 0.6 (Executable).zip
Huo Chess 0.6 (Source code).zip
Huo Chess Opening Book.zip
Huo Chess 0.6_micro
Huo Chess 0.6 - micro edition (Executable).zip
Huo Chess 0.6 - micro edition (Source code).zip
Huo Chess Opening Book.zip
Huo Chess 0.721
Huo Chess 0.721 (executable).zip
Huo Chess 0.721 (source).zip
Huo Chess Opening Book.zip
Huo Chess 0.722
Huo Chess 0.722 Executable.zip
Huo Chess 0.722 Source.zip
Huo_Chess_0.722__all_editions_.zip
Huo Chess 0.722 (all editions)
Huo Chess 0.722 (C++ edition)
Executable
HuoChessConsole.exe
Source
HuoChessConsole
HuoChessConsole
app.ico
HuoChessConsole.vcproj.HUB7381LCL.spyridon.kakos.user
HuoChessConsole.vcproj.HZQWB1J.spyridon.kakos.user
HuoChessConsole.vcproj.KAKOS-BROS-HY.Spiros.user
HuoChessConsole.vcproj.STASP.Stavros Kakos.user
Huo Chess 0.722 (CS edition)
Executable
Huo Chess 0.721 cs.exe
Source
Huo Chess 0.722 cs
Huo Chess 0.6 cs
bin
Properties
Huo Chess 0.722 (GUI edition)
Executable
Content
a_black_bishop.xnb
a_black_king.xnb
a_black_knight.xnb
a_black_pawn.xnb
a_black_queen.xnb
a_black_rook.xnb
a_skakiera_empty.xnb
a_skakiera_startingPosition.xnb
a_white_bishop.xnb
a_white_king.xnb
a_white_knight.xnb
a_white_pawn.xnb
a_white_queen.xnb
a_white_rook.xnb
b_black_bishop.xnb
b_black_king.xnb
b_black_knight.xnb
b_black_pawn.xnb
b_black_queen.xnb
b_black_rook.xnb
b_white_bishop.xnb
b_white_king.xnb
b_white_knight.xnb
b_white_pawn.xnb
b_white_queen.xnb
b_white_rook.xnb
chess_columns.xnb
chess_columns_v2.xnb
chess_ranks.xnb
chess_ranks_v2.xnb
chess_white.xnb
chess_white_v2.xnb
SpriteFont1.xnb
XNAHuoChessGame.exe
Source
XNAHuoChessGame
Content
a_black_bishop.PNG
a_black_king.PNG
a_black_knight.PNG
a_black_pawn.PNG
a_black_queen.PNG
a_black_rook.PNG
a_skakiera_empty.bmp
a_skakiera_startingPosition.bmp
a_white_bishop.PNG
a_white_king.PNG
a_white_knight.PNG
a_white_pawn.PNG
a_white_queen.PNG
a_white_rook.PNG
bin
x86
Debug
Release
Xbox 360
Debug
Release
Zune
Debug
Release
b_black_bishop.PNG
b_black_king.PNG
b_black_knight.PNG
b_black_pawn.PNG
b_black_queen.PNG
b_black_rook.PNG
b_white_bishop.PNG
b_white_king.PNG
b_white_knight.PNG
b_white_pawn.PNG
b_white_queen.PNG
b_white_rook.PNG
chess_columns.bmp
chess_columns_v2.bmp
chess_ranks.bmp
chess_ranks_v2.bmp
chess_white.bmp
chess_white_v2.bmp
Content.contentproj
obj
x86
Debug
TempPE
Release
TempPE
Xbox 360
Debug
Release
Zune
Debug
Release
SpriteFont1.spritefont
Thumbs.db
Game.ico
GameThumbnail.png
Properties
Xbox 360 Copy of XNAHuoChessGame.csproj.Debug.cachefile
Xbox 360 Copy of XNAHuoChessGame.csproj.Release.cachefile
XNAHuoChessGame.csproj.Debug.cachefile
XNAHuoChessGame.csproj.Release.cachefile
XNAHuoChessGame.csproj.user
Zune Copy of Xbox 360 Copy of XNAHuoChessGame.csproj.Debug.cachefile
Zune Copy of Xbox 360 Copy of XNAHuoChessGame.csproj.Release.cachefile
huo_chess_0.82_all_editions.zip
Huo Chess 0.82 all editions
Huo Chess 0.81 cpp edition
Executable
Huo Chess Opening Book
HuoChessConsole.exe
Source
HuoChessConsole
HuoChessConsole
app.ico
HuoChessConsole.vcproj.HUB7381LCL.spyridon.kakos.user
HuoChessConsole.vcproj.HZQWB1J.spyridon.kakos.user
HuoChessConsole.vcproj.KAKOS-BROS-HY.Spiros.user
HuoChessConsole.vcproj.STASP.Stavros Kakos.user
Huo Chess 0.82 cs edition
Executable
Huo Chess 0.721 cs.exe
Huo Chess Opening Book
Source
Huo Chess 0.6 cs
bin
Properties
Huo Chess 0.82 vb edition
Executable
HuoChessVB.exe
Source
HuoChessVB
My Project
Application.myapp
Settings.settings
Huo Chess 0.82 XNA edition
Executable
Content
a_black_bishop.xnb
a_black_king.xnb
a_black_knight.xnb
a_black_pawn.xnb
a_black_queen.xnb
a_black_rook.xnb
a_skakiera_empty.xnb
a_skakiera_startingPosition.xnb
a_white_bishop.xnb
a_white_king.xnb
a_white_knight.xnb
a_white_pawn.xnb
a_white_queen.xnb
a_white_rook.xnb
b_black_bishop.xnb
b_black_king.xnb
b_black_knight.xnb
b_black_pawn.xnb
b_black_queen.xnb
b_black_rook.xnb
b_white_bishop.xnb
b_white_king.xnb
b_white_knight.xnb
b_white_pawn.xnb
b_white_queen.xnb
b_white_rook.xnb
chess_columns.xnb
chess_columns_v2.xnb
chess_ranks.xnb
chess_ranks_v2.xnb
chess_white.xnb
chess_white_v2.xnb
SpriteFont1.xnb
Huo Chess Opening Book
Huo_Chess_XNA.exe
Source
XNAHuoChessGame
Content
a_black_bishop.PNG
a_black_king.PNG
a_black_knight.PNG
a_black_pawn.PNG
a_black_queen.PNG
a_black_rook.PNG
a_skakiera_empty.bmp
a_skakiera_startingPosition.bmp
a_white_bishop.PNG
a_white_king.PNG
a_white_knight.PNG
a_white_pawn.PNG
a_white_queen.PNG
a_white_rook.PNG
bin
x86
Release
Xbox 360
Release
Zune
Release
b_black_bishop.PNG
b_black_king.PNG
b_black_knight.PNG
b_black_pawn.PNG
b_black_queen.PNG
b_black_rook.PNG
b_white_bishop.PNG
b_white_king.PNG
b_white_knight.PNG
b_white_pawn.PNG
b_white_queen.PNG
b_white_rook.PNG
chess_columns.bmp
chess_columns_v2.bmp
chess_ranks.bmp
chess_ranks_v2.bmp
chess_white.bmp
chess_white_v2.bmp
Content.contentproj
SpriteFont1.spritefont
Game.ico
GameThumbnail.png
Properties
Xbox 360 Copy of XNAHuoChessGame.csproj.Debug.cachefile
Xbox 360 Copy of XNAHuoChessGame.csproj.Release.cachefile
XNAHuoChessGame.csproj.Debug.cachefile
XNAHuoChessGame.csproj.Release.cachefile
XNAHuoChessGame.csproj.user
Zune Copy of Xbox 360 Copy of XNAHuoChessGame.csproj.Debug.cachefile
Zune Copy of Xbox 360 Copy of XNAHuoChessGame.csproj.Release.cachefile
huo_chess_0.82_micro_version.zip
Huo Chess 0.82 micro version
Huo Chess 0.721 cs.exe
Huo_Chess_0.82_VS_2008-noexe.zip
Huo Chess 0.82_VS 2008
Huo Chess 0.81 cpp edition
Executable
Huo Chess Opening Book
Source
HuoChessConsole
HuoChessConsole
app.ico
HuoChessConsole.vcproj.HUB7381LCL.spyridon.kakos.user
HuoChessConsole.vcproj.HZQWB1J.spyridon.kakos.user
HuoChessConsole.vcproj.KAKOS-BROS-HY.Spiros.user
HuoChessConsole.vcproj.STASP.Stavros Kakos.user
Huo Chess 0.82 cs edition
Executable
Huo Chess Opening Book
Source
Huo Chess 0.6 cs
Properties
Huo Chess 0.82 vb edition
Source
HuoChessVB
My Project
Application.myapp
Settings.settings
Huo Chess 0.82 XNA edition
Executable
Content
a_black_bishop.xnb
a_black_king.xnb
a_black_knight.xnb
a_black_pawn.xnb
a_black_queen.xnb
a_black_rook.xnb
a_skakiera_empty.xnb
a_skakiera_startingPosition.xnb
a_white_bishop.xnb
a_white_king.xnb
a_white_knight.xnb
a_white_pawn.xnb
a_white_queen.xnb
a_white_rook.xnb
b_black_bishop.xnb
b_black_king.xnb
b_black_knight.xnb
b_black_pawn.xnb
b_black_queen.xnb
b_black_rook.xnb
b_white_bishop.xnb
b_white_king.xnb
b_white_knight.xnb
b_white_pawn.xnb
b_white_queen.xnb
b_white_rook.xnb
chess_columns.xnb
chess_columns_v2.xnb
chess_ranks.xnb
chess_ranks_v2.xnb
chess_white.xnb
chess_white_v2.xnb
SpriteFont1.xnb
Huo Chess Opening Book
Source
XNAHuoChessGame
Content
a_black_bishop.PNG
a_black_king.PNG
a_black_knight.PNG
a_black_pawn.PNG
a_black_queen.PNG
a_black_rook.PNG
a_skakiera_empty.bmp
a_skakiera_startingPosition.bmp
a_white_bishop.PNG
a_white_king.PNG
a_white_knight.PNG
a_white_pawn.PNG
a_white_queen.PNG
a_white_rook.PNG
b_black_bishop.PNG
b_black_king.PNG
b_black_knight.PNG
b_black_pawn.PNG
b_black_queen.PNG
b_black_rook.PNG
b_white_bishop.PNG
b_white_king.PNG
b_white_knight.PNG
b_white_pawn.PNG
b_white_queen.PNG
b_white_rook.PNG
chess_columns.bmp
chess_columns_v2.bmp
chess_ranks.bmp
chess_ranks_v2.bmp
chess_white.bmp
chess_white_v2.bmp
Content.contentproj
SpriteFont1.spritefont
Game.ico
GameThumbnail.png
Properties
Xbox 360 Copy of XNAHuoChessGame.csproj.Debug.cachefile
Xbox 360 Copy of XNAHuoChessGame.csproj.Release.cachefile
XNAHuoChessGame.csproj.Debug.cachefile
XNAHuoChessGame.csproj.Release.cachefile
XNAHuoChessGame.csproj.user
Zune Copy of Xbox 360 Copy of XNAHuoChessGame.csproj.Debug.cachefile
Zune Copy of Xbox 360 Copy of XNAHuoChessGame.csproj.Release.cachefile
Huo_Chess_0.82_VS_2008.zip
HuoChessConsole.exe
app.ico
HuoChessConsole.vcproj.HUB7381LCL.spyridon.kakos.user
HuoChessConsole.vcproj.HZQWB1J.spyridon.kakos.user
HuoChessConsole.vcproj.KAKOS-BROS-HY.Spiros.user
HuoChessConsole.vcproj.STASP.Stavros Kakos.user
Huo Chess 0.721 cs.exe
Executable
HuoChessVB.exe
Application.myapp
Settings.settings
a_black_bishop.xnb
a_black_king.xnb
a_black_knight.xnb
a_black_pawn.xnb
a_black_queen.xnb
a_black_rook.xnb
a_skakiera_empty.xnb
a_skakiera_startingPosition.xnb
a_white_bishop.xnb
a_white_king.xnb
a_white_knight.xnb
a_white_pawn.xnb
a_white_queen.xnb
a_white_rook.xnb
b_black_bishop.xnb
b_black_king.xnb
b_black_knight.xnb
b_black_pawn.xnb
b_black_queen.xnb
b_black_rook.xnb
b_white_bishop.xnb
b_white_king.xnb
b_white_knight.xnb
b_white_pawn.xnb
b_white_queen.xnb
b_white_rook.xnb
chess_columns.xnb
chess_columns_v2.xnb
chess_ranks.xnb
chess_ranks_v2.xnb
chess_white.xnb
chess_white_v2.xnb
SpriteFont1.xnb
Huo_Chess_XNA.exe
a_black_bishop.PNG
a_black_king.PNG
a_black_knight.PNG
a_black_pawn.PNG
a_black_queen.PNG
a_black_rook.PNG
a_skakiera_empty.bmp
a_skakiera_startingPosition.bmp
a_white_bishop.PNG
a_white_king.PNG
a_white_knight.PNG
a_white_pawn.PNG
a_white_queen.PNG
a_white_rook.PNG
b_black_bishop.PNG
b_black_king.PNG
b_black_knight.PNG
b_black_pawn.PNG
b_black_queen.PNG
b_black_rook.PNG
b_white_bishop.PNG
b_white_king.PNG
b_white_knight.PNG
b_white_pawn.PNG
b_white_queen.PNG
b_white_rook.PNG
chess_columns.bmp
chess_columns_v2.bmp
chess_ranks.bmp
chess_ranks_v2.bmp
chess_white.bmp
chess_white_v2.bmp
Content.contentproj
SpriteFont1.spritefont
Game.ico
GameThumbnail.png
Xbox 360 Copy of XNAHuoChessGame.csproj.Debug.cachefile
Xbox 360 Copy of XNAHuoChessGame.csproj.Release.cachefile
XNAHuoChessGame.csproj.Debug.cachefile
XNAHuoChessGame.csproj.Release.cachefile
XNAHuoChessGame.csproj.user
Zune Copy of Xbox 360 Copy of XNAHuoChessGame.csproj.Debug.cachefile
Zune Copy of Xbox 360 Copy of XNAHuoChessGame.csproj.Release.cachefile
Huo_Chess_0.82__all_editions_.zip
Huo Chess 0.82 (all editions)
Huo Chess 0.81 cpp edition
Executable
Huo Chess Opening Book
HuoChessConsole.exe
Source
HuoChessConsole
HuoChessConsole
app.ico
HuoChessConsole.vcproj.HUB7381LCL.spyridon.kakos.user
HuoChessConsole.vcproj.HZQWB1J.spyridon.kakos.user
HuoChessConsole.vcproj.KAKOS-BROS-HY.Spiros.user
HuoChessConsole.vcproj.STASP.Stavros Kakos.user
Huo Chess 0.82 cs edition
Executable
Huo Chess 0.721 cs.exe
Huo Chess Opening Book
Source
Huo Chess 0.6 cs
bin
Properties
Huo Chess 0.82 XNA edition
Executable
Content
a_black_bishop.xnb
a_black_king.xnb
a_black_knight.xnb
a_black_pawn.xnb
a_black_queen.xnb
a_black_rook.xnb
a_skakiera_empty.xnb
a_skakiera_startingPosition.xnb
a_white_bishop.xnb
a_white_king.xnb
a_white_knight.xnb
a_white_pawn.xnb
a_white_queen.xnb
a_white_rook.xnb
b_black_bishop.xnb
b_black_king.xnb
b_black_knight.xnb
b_black_pawn.xnb
b_black_queen.xnb
b_black_rook.xnb
b_white_bishop.xnb
b_white_king.xnb
b_white_knight.xnb
b_white_pawn.xnb
b_white_queen.xnb
b_white_rook.xnb
chess_columns.xnb
chess_columns_v2.xnb
chess_ranks.xnb
chess_ranks_v2.xnb
chess_white.xnb
chess_white_v2.xnb
SpriteFont1.xnb
Huo Chess Opening Book
Huo_Chess_XNA.exe
Source
XNAHuoChessGame
Content
a_black_bishop.PNG
a_black_king.PNG
a_black_knight.PNG
a_black_pawn.PNG
a_black_queen.PNG
a_black_rook.PNG
a_skakiera_empty.bmp
a_skakiera_startingPosition.bmp
a_white_bishop.PNG
a_white_king.PNG
a_white_knight.PNG
a_white_pawn.PNG
a_white_queen.PNG
a_white_rook.PNG
bin
x86
Debug
Release
Xbox 360
Debug
Release
Zune
Debug
Release
b_black_bishop.PNG
b_black_king.PNG
b_black_knight.PNG
b_black_pawn.PNG
b_black_queen.PNG
b_black_rook.PNG
b_white_bishop.PNG
b_white_king.PNG
b_white_knight.PNG
b_white_pawn.PNG
b_white_queen.PNG
b_white_rook.PNG
chess_columns.bmp
chess_columns_v2.bmp
chess_ranks.bmp
chess_ranks_v2.bmp
chess_white.bmp
chess_white_v2.bmp
Content.contentproj
obj
x86
Debug
Refactor
TempPE
Release
TempPE
Xbox 360
Debug
Release
Zune
Debug
ResolveAssemblyReference.cache
Release
SpriteFont1.spritefont
Game.ico
GameThumbnail.png
Properties
Xbox 360 Copy of XNAHuoChessGame.csproj.Debug.cachefile
Xbox 360 Copy of XNAHuoChessGame.csproj.Release.cachefile
XNAHuoChessGame.csproj.Debug.cachefile
XNAHuoChessGame.csproj.Release.cachefile
XNAHuoChessGame.csproj.user
Zune Copy of Xbox 360 Copy of XNAHuoChessGame.csproj.Debug.cachefile
Zune Copy of Xbox 360 Copy of XNAHuoChessGame.csproj.Release.cachefile
Huo_Chess_0.93_VS2010-noexe.zip
Huo Chess 0.93_VS2010
Huo Chess 0.93_CS (official)
Huo Chess 0.93 (Simple MiniMax)
Source
Huo Chess 0.93 cs
Properties
Huo Chess 0.94 (Kakos MiniMax depth 20)
Source
Huo Chess 0.93 cs
Properties
Huo Chess 0.93_XNA (official)
Huo Chess 0.93 XNA edition - huoMinimax 20 v2
Huo Chess XNA 0.93 Executable.zip
Huo Chess XNA 0.93 Source.zip
Huo_Chess_0.93_VS2010.zip
Executable
Huo Chess 0.93 cs.exe
Executable
Huo Chess 0.93 cs.exe
Huo Chess XNA 0.93 Executable.zip
Huo Chess XNA 0.93 Source.zip
huo_chess_0.94.zip
Huo Chess 0.94
Executable
Huo Chess 0.94 cs.exe
Executable_microEdition
HuoChess094cs.exe
Source
Huo Chess 0.94 cs
bin
Release
Huo Chess 0.94 cs.exe
huochess.ico
Properties
Huo_Chess_0.95_cs_VS2012-noexe.zip
Huo Chess 0.95 cs_VS2012
Source
Huo Chess 0.95 cs
Properties
Huo_Chess_0.95_cs_VS2012.zip
Executable
Huo Chess 0.95 cs.exe
bin
Release
Huo Chess 0.95 cs.exe
Huo_Chess_0.95_cs_with_GUI_VS2012-noexe.zip
Huo Chess 0.95 cs with GUI_VS2012
Executable
Resources
BBishop.gif
BKing.gif
BKnight.gif
BKnight1.GIF
blacksquare.gif
BPawn.gif
BQueen.gif
BRook.gif
nothing.gif
WBishop - Copy.gif
WBishop.gif
whitesquare.gif
WKing.gif
WKnight.gif
WPawn.gif
WQueen.gif
WRook.gif
Source
HuoChessW8
Properties
Settings.settings
Resources
BBishop.gif
BKing.gif
BKnight.gif
BKnight1.GIF
blacksquare.gif
BPawn.gif
BQueen.gif
BRook.gif
nothing.gif
WBishop - Copy.gif
WBishop.gif
whitesquare.gif
WKing.gif
WKnight.gif
WPawn.gif
WQueen.gif
WRook.gif
Huo_Chess_0.95_cs_with_GUI_VS2012.zip
HuoChessW8.exe
BBishop.gif
BKing.gif
BKnight.gif
BKnight1.GIF
blacksquare.gif
BPawn.gif
BQueen.gif
BRook.gif
nothing.gif
WBishop - Copy.gif
WBishop.gif
whitesquare.gif
WKing.gif
WKnight.gif
WPawn.gif
WQueen.gif
WRook.gif
Settings.settings
BBishop.gif
BKing.gif
BKnight.gif
BKnight1.GIF
blacksquare.gif
BPawn.gif
BQueen.gif
BRook.gif
nothing.gif
WBishop - Copy.gif
WBishop.gif
whitesquare.gif
WKing.gif
WKnight.gif
WPawn.gif
WQueen.gif
WRook.gif
Huo_Chess_0.95_with_GUI_VS2012-noexe.zip
Huo Chess 0.95 with GUI_VS2012
Executable
Resources
BBishop.gif
BKing.gif
BKnight.gif
BKnight1.GIF
blacksquare.gif
BPawn.gif
BQueen.gif
BRook.gif
nothing.gif
WBishop - Copy.gif
WBishop.gif
whitesquare.gif
WKing.gif
WKnight.gif
WPawn.gif
WQueen.gif
WRook.gif
Source
HuoChessW8
bin
Release
Resources
BBishop.gif
BKing.gif
BKnight.gif
BKnight1.GIF
blacksquare.gif
BPawn.gif
BQueen.gif
BRook.gif
nothing.gif
WBishop - Copy.gif
WBishop.gif
whitesquare.gif
WKing.gif
WKnight.gif
WPawn.gif
WQueen.gif
WRook.gif
Properties
Settings.settings
Resources
BBishop.gif
BKing.gif
BKnight.gif
BKnight1.GIF
blacksquare.gif
BPawn.gif
BQueen.gif
BRook.gif
nothing.gif
WBishop - Copy.gif
WBishop.gif
whitesquare.gif
WKing.gif
WKnight.gif
WPawn.gif
WQueen.gif
WRook.gif
Huo_Chess_0.95_with_GUI_VS2012.zip
HuoChessW8.exe
BBishop.gif
BKing.gif
BKnight.gif
BKnight1.GIF
blacksquare.gif
BPawn.gif
BQueen.gif
BRook.gif
nothing.gif
WBishop - Copy.gif
WBishop.gif
whitesquare.gif
WKing.gif
WKnight.gif
WPawn.gif
WQueen.gif
WRook.gif
BBishop.gif
BKing.gif
BKnight.gif
BKnight1.GIF
blacksquare.gif
BPawn.gif
BQueen.gif
BRook.gif
nothing.gif
WBishop - Copy.gif
WBishop.gif
whitesquare.gif
WKing.gif
WKnight.gif
WPawn.gif
WQueen.gif
WRook.gif
Settings.settings
BBishop.gif
BKing.gif
BKnight.gif
BKnight1.GIF
blacksquare.gif
BPawn.gif
BQueen.gif
BRook.gif
nothing.gif
WBishop - Copy.gif
WBishop.gif
whitesquare.gif
WKing.gif
WKnight.gif
WPawn.gif
WQueen.gif
WRook.gif
HUO_CHESS_0.961-noexe.zip
HUO CHESS 0.961
Huo Chess 0.961 with GUI_VS2012
Executable
Resources
BBishop.gif
BKing.gif
BKnight.gif
BKnight1.GIF
blacksquare.gif
BPawn.gif
BQueen.gif
BRook.gif
nothing.gif
WBishop - Copy.gif
WBishop.gif
whitesquare.gif
WKing.gif
WKnight.gif
WPawn.gif
WQueen.gif
WRook.gif
Source
HuoChessW8
bin
Debug
Release
HuoChessW8.pdb
HuoChessW8.vshost.exe.manifest
Resources
BBishop.gif
BKing.gif
BKnight.gif
BKnight1.GIF
blacksquare.gif
BPawn.gif
BQueen.gif
BRook.gif
nothing.gif
WBishop - Copy.gif
WBishop.gif
whitesquare.gif
WKing.gif
WKnight.gif
WPawn.gif
WQueen.gif
WRook.gif
obj
Properties
Settings.settings
Resources
BBishop.gif
BKing.gif
BKnight.gif
BKnight1.GIF
blacksquare.gif
BPawn.gif
BQueen.gif
BRook.gif
nothing.gif
WBishop - Copy.gif
WBishop.gif
whitesquare.gif
WKing.gif
WKnight.gif
WPawn.gif
WQueen.gif
WRook.gif
Huo Chess Thought process v0.7.docx
~$o Chess Thought process v0.41.docx
~$o Chess Thought process v0.5.docx
~WRL0266.tmp
HUO_CHESS_0.961.zip
HuoChessW8.exe
BBishop.gif
BKing.gif
BKnight.gif
BKnight1.GIF
blacksquare.gif
BPawn.gif
BQueen.gif
BRook.gif
nothing.gif
WBishop - Copy.gif
WBishop.gif
whitesquare.gif
WKing.gif
WKnight.gif
WPawn.gif
WQueen.gif
WRook.gif
HuoChessW8.exe
HuoChessW8.pdb
HuoChessW8.vshost.exe
HuoChessW8.vshost.exe.manifest
BBishop.gif
BKing.gif
BKnight.gif
BKnight1.GIF
blacksquare.gif
BPawn.gif
BQueen.gif
BRook.gif
nothing.gif
WBishop - Copy.gif
WBishop.gif
whitesquare.gif
WKing.gif
WKnight.gif
WPawn.gif
WQueen.gif
WRook.gif
Settings.settings
BBishop.gif
BKing.gif
BKnight.gif
BKnight1.GIF
blacksquare.gif
BPawn.gif
BQueen.gif
BRook.gif
nothing.gif
WBishop - Copy.gif
WBishop.gif
whitesquare.gif
WKing.gif
WKnight.gif
WPawn.gif
WQueen.gif
WRook.gif
Huo Chess Thought process v0.7.docx
~$o Chess Thought process v0.41.docx
~$o Chess Thought process v0.5.docx
~WRL0266.tmp
Huo_Chess_0.961_cs-noexe.zip
Huo Chess 0.961 cs
Executable
Huo Chess Thought process v0.7.docx
Source
Huo Chess 0.95 cs
bin
Release
Huo Chess 0.95 cs.pdb
Huo Chess 0.95 cs.vshost.exe.manifest
obj
Properties
~$o Chess Thought process v0.7.docx
Huo_Chess_0.961_cs.zip
Huo Chess 0.95 cs.exe
Huo Chess Thought process v0.7.docx
Huo Chess 0.95 cs.exe
Huo Chess 0.95 cs.pdb
Huo Chess 0.95 cs.vshost.exe
Huo Chess 0.95 cs.vshost.exe.manifest
~$o Chess Thought process v0.7.docx
huo_chess_new_article.zip
Huo Chess new article
Files
Executable
Huo Chess Opening Book
HuoChessConsole.exe
Source
HuoChessConsole
HuoChessConsole
app.ico
HuoChessConsole.vcproj.HUB7381LCL.spyridon.kakos.user
HuoChessConsole.vcproj.HZQWB1J.spyridon.kakos.user
HuoChessConsole.vcproj.KAKOS-BROS-HY.Spiros.user
HuoChessConsole.vcproj.STASP.Stavros Kakos.user
Thumbs.db
huo_chess_opening_book.zip
Huo Chess Opening Book
Huo_Chess_Opening_Book_Editor_0.1-noexe.zip
Huo Chess Opening Book Editor 0.1
Executable
Huo Chess Opening Book
Source
Huo Chess Opening Book Editor
app.ico
Huo Chess Opening Book
Huo Chess Opening Book Editor.vcproj.HUB7381LCL.spyridon.kakos.user
Huo Chess Opening Book Editor.vcxproj.filters
Release
Huo Chess Opening Book
Huo_Chess_Opening_Book_Editor_0.1.zip
Huo Chess Opening Book Editor.exe
app.ico
Huo Chess Opening Book Editor.vcproj.HUB7381LCL.spyridon.kakos.user
Huo Chess Opening Book Editor.vcxproj.filters
Huo Chess Opening Book Editor.exe
huo_chess_with_gui__xna__v0.93.zip
Huo Chess with GUI (XNA) v0.93
Executable
Content
a_black_bishop.xnb
a_black_king.xnb
a_black_knight.xnb
a_black_pawn.xnb
a_black_queen.xnb
a_black_rook.xnb
a_skakiera_empty.xnb
a_skakiera_startingPosition.xnb
a_white_bishop.xnb
a_white_king.xnb
a_white_knight.xnb
a_white_pawn.xnb
a_white_queen.xnb
a_white_rook.xnb
b_black_bishop.xnb
b_black_king.xnb
b_black_knight.xnb
b_black_pawn.xnb
b_black_queen.xnb
b_black_rook.xnb
b_white_bishop.xnb
b_white_king.xnb
b_white_knight.xnb
b_white_pawn.xnb
b_white_queen.xnb
b_white_rook.xnb
chess_columns.xnb
chess_columns_v2.xnb
chess_ranks.xnb
chess_ranks_v2.xnb
chess_white.xnb
chess_white_v2.xnb
SpriteFont1.xnb
Huo_Chess_XNA.exe
Huo_Chess_XNA.pdb
Source
XNAHuoChessGame
bin
x86
Debug
Release
Content
a_black_bishop.xnb
a_black_king.xnb
a_black_knight.xnb
a_black_pawn.xnb
a_black_queen.xnb
a_black_rook.xnb
a_skakiera_empty.xnb
a_skakiera_startingPosition.xnb
a_white_bishop.xnb
a_white_king.xnb
a_white_knight.xnb
a_white_pawn.xnb
a_white_queen.xnb
a_white_rook.xnb
b_black_bishop.xnb
b_black_king.xnb
b_black_knight.xnb
b_black_pawn.xnb
b_black_queen.xnb
b_black_rook.xnb
b_white_bishop.xnb
b_white_king.xnb
b_white_knight.xnb
b_white_pawn.xnb
b_white_queen.xnb
b_white_rook.xnb
chess_columns.xnb
chess_columns_v2.xnb
chess_ranks.xnb
chess_ranks_v2.xnb
chess_white.xnb
chess_white_v2.xnb
SpriteFont1.xnb
Huo_Chess_XNA.exe
Huo_Chess_XNA.pdb
ClassDiagram1.cd
Content
a_black_bishop.PNG
a_black_king.PNG
a_black_knight.PNG
a_black_pawn.PNG
a_black_queen.PNG
a_black_rook.PNG
a_skakiera_empty.bmp
a_skakiera_startingPosition.bmp
a_white_bishop.PNG
a_white_king.PNG
a_white_knight.PNG
a_white_pawn.PNG
a_white_queen.PNG
a_white_rook.PNG
b_black_bishop.PNG
b_black_king.PNG
b_black_knight.PNG
b_black_pawn.PNG
b_black_queen.PNG
b_black_rook.PNG
b_white_bishop.PNG
b_white_king.PNG
b_white_knight.PNG
b_white_pawn.PNG
b_white_queen.PNG
b_white_rook.PNG
chess_columns.bmp
chess_columns_v2.bmp
chess_ranks.bmp
chess_ranks_v2.bmp
chess_white.bmp
chess_white_v2.bmp
SpriteFont1.spritefont
XNAHuoChessGameContent.contentproj
XNAHuoChessGameContent.contentproj.user
Game.ico
GameThumbnail.png
huochess.ico
HuoChessPng.png
Properties
XNAHuoChessGame.csproj.Debug.cachefile
XNAHuoChessGame.csproj.Release.cachefile
XNAHuoChessGame.csproj.user
source.zip
Source
Huo Chess 0.94 cs
bin
Release
Huo Chess 0.94 cs.exe
huochess.ico
Properties
source_code.zip
Source code
Huo Chess version 0.3
HuoChessConsole
HuoChessConsole
app.ico
HuoChessConsole.vcproj.HZQWB1J.spyridon.kakos.user
HuoChessConsole.vcproj.STASP.Stavros Kakos.user
Huo Chess version 0.4
HuoChessConsole
HuoChessConsole
app.ico
HuoChessConsole.vcproj.HUB7381LCL.spyridon.kakos.user
HuoChessConsole.vcproj.HZQWB1J.spyridon.kakos.user
HuoChessConsole.vcproj.STASP.Stavros Kakos.user
using System;
using System.Collections.Generic;
//using System.Linq;
using System.IO;
using System.Text;
// UNCOMMENT TO USE THREADS
//using System.Threading;

namespace Huo_Chess_0._94_cs
{
class HuoChess_main {
// HuoChessConsole.cpp : main project file.

/////////////////////////////////////////////
// Huo Chess                               //
// version: 0.94                           //
// Changes from version 0.82: Simplified the program (now only ComputerMove functions are used //
// MiniMax algorithm utilized              //
// version: 0.82                           //
// Changes from version 0.81: Removed the  //
// ComputerMove functions and used a       //
// template function to create all new     //
// ComputerMove functions I need.          //
// Changes from version 0.722: Changed the //
// ComputerMove, HumanMove, CountScore,    //
// ElegxosOrthotitas functions.            //
// Changes from verion 0.721: removed some //
// useless code and added the variable     //
// thinking depth (depending on the piece  //
// the opponent moves) (see parts marked   //
// with "2009 version 1 change")           //
// Changes from version 0.6: Added more    //
// thinking depths                         //
// Year: 2008                              //
// Place: Earth - Greece                   //
// Programmed by Spiros I. Kakos (huo)     //
// License: TOTALLY FREEWARE!              //
//          Do anything you want with it!  //
//          Spread the knowledge!          //
//          Fix its bugs!                  //
//          Sell it (if you can...)!       //
//          Call me for help!              //
// Site: www.kakos.com.gr                  //
//       www.kakos.eu                      //
/////////////////////////////////////////////

// Icon created with : http://www.rw-designer.com/online_icon_maker.php
// Algorithm analysis: http://www.codeproject.com/KB/game/cpp_microchess.aspx

///////////////////////////////////////////////////////////////////////////////////////////
// MAIN ALGORITHM
// 1. ComputerMove: Scans the chessboard and makes all possible moves.
// 2. CheckMove: It checks the legality and correctness of these possible moves.
// 3. (if thinking depth not reached) => call HumanMove
// 4. HumanMove2: Checks and finds the possible answers of the human opponent for the next move.
// 5. ComputerMove2: Scans the chessboard and makes all possible moves at the next thinking level.
// 6. CheckMove: It checks the legality and correctness of these possible moves.
// 7. (if thinking depth not reached) => call HumanMove for the next level of thinking
// 8. HumanMove4: Checks and finds the possible answers of the human opponent for the next move.
// 9. ComputerMove4: Scans the chessboard and makes all possible moves at the next thinking level.
// 10. CheckMove: It checks the legality and correctness of these possible moves.
// 11. (if thinking depth reached) => record the score of the final position.
// 12. (if score of position the best so far) => record the move as best move!
// 13. The algorithm continues until all possible moves are scanned.
// SET huo_debug to TRUE to see live the progress of the computer thought!
// FIND us at Codeproject (www.codeproject.com) or MSDN Code Gallery!
// ---------------------------------------------------------------------------
// The score before every human opponents move and after any human opponents move are stored in the
// Temp_Score_Human_before_2 (i.e. the score after the first move of the H/Y and before the 1st move of human
// while at the 2nd -ply of computer thinking), Temp_Score_Human_after_2, etc variables.
// ---------------------------------------------------------------------------
// At every level of thinking, the scores are stored in the NodesAnalysis table. This table is used for the
// implementation of the MiniMax algorithm.
////////////////////////////////////////////////////////////////////////////////////////////


	//public:
	////////////////////////////////////////////////////////////////////////////////////////////////////////
	// DECLARE VARIABLES
	////////////////////////////////////////////////////////////////////////////////////////////////////////

    public static bool DEBUG_huo = false;
    public static bool SHOW_thinking = true;

    public static String MovingPiece2;
    public static String MovingPiece3;
    public static String MovingPiece4;
    public static String MovingPiece5;
    public static String MovingPiece6;

    // 2011 START
    public static bool danger_penalty;
    public static bool danger_penalty_human;
    public static bool possibility_to_eat_back;

    public static int Destination_Piece_Value;
    public static int Moving_Piece_Value;

    public static double Temp_Score_Human_before_2;
    public static double Temp_Score_Human_after_2;
    public static double Temp_Score_Human_before_4;
    public static double Temp_Score_Human_after_4;
    public static double Temp_Score_Human_before_6;
    public static double Temp_Score_Human_after_6;

    // This array will hold the minimax analysis nodes skakos
    public static double[, ,] NodesAnalysis = new double[1000000, 11, 2];
    public static int Nodes_Total_count;
    public static int NodeLevel_1_count;
    public static int NodeLevel_2_count;
    public static int NodeLevel_3_count;
    public static int NodeLevel_4_count;
    public static int NodeLevel_5_count;
    public static int NodeLevel_6_count;
    public static int NodeLevel_7_count;
    public static int NodeLevel_8_count;
    public static int NodeLevel_9_count;
    public static int NodeLevel_10_count;
    public static int NodeLevel_11_count;
    public static int NodeLevel_12_count;
    public static int NodeLevel_13_count;
    public static int NodeLevel_14_count;
    public static int NodeLevel_15_count;
    public static int NodeLevel_16_count;
    public static int NodeLevel_17_count;
    public static int NodeLevel_18_count;
    public static int NodeLevel_19_count;
    public static int NodeLevel_20_count;
    // 2011 END

    ///////////////////
    // 2009 v4 change
    ///////////////////

    // if human eats a piece, then make the square a preferred target!!!
    public static int target_column;
    public static int target_row;
    public static String target_piece;

    // Dangerous squares
    public static bool[,] Skakiera_Dangerous_Squares_0 = new bool[8, 8];
    public static bool[,] Skakiera_Dangerous_Squares_1 = new bool[8, 8];
    public static bool[,] Skakiera_Dangerous_Squares_2 = new bool[8, 8];
    public static bool[,] Skakiera_Dangerous_Squares_3 = new bool[8, 8];
    public static bool[,] Skakiera_Dangerous_Squares_4 = new bool[8, 8];
    public static bool[,] Skakiera_Dangerous_Squares_5 = new bool[8, 8];

    // v0.82
    public static Huo_Chess_0._93_cs.HuoChess_main HuoChess_new_depth_2 = new HuoChess_main();
    public static Huo_Chess_0._93_cs.HuoChess_main HuoChess_new_depth_4 = new HuoChess_main();
    public static Huo_Chess_0._93_cs.HuoChess_main HuoChess_new_depth_6 = new HuoChess_main();
    public static Huo_Chess_0._93_cs.HuoChess_main HuoChess_new_depth_8 = new HuoChess_main();
    public static Huo_Chess_0._93_cs.HuoChess_main HuoChess_new_depth_10 = new HuoChess_main();
    public static Huo_Chess_0._93_cs.HuoChess_main HuoChess_new_depth_12 = new HuoChess_main();
    public static Huo_Chess_0._93_cs.HuoChess_main HuoChess_new_depth_14 = new HuoChess_main();
    public static Huo_Chess_0._93_cs.HuoChess_main HuoChess_new_depth_16 = new HuoChess_main();
    public static Huo_Chess_0._93_cs.HuoChess_main HuoChess_new_depth_18 = new HuoChess_main();
    public static Huo_Chess_0._93_cs.HuoChess_main HuoChess_new_depth_20 = new HuoChess_main();
    // v0.82
    ///////////////////
    // 2009 v4 change
    ///////////////////

    // UNCOMMENT TO SHOW THINKING TIME!
    // (this and the other commands that use 'start' variable to record thinking time...)
    // public static int start; 

	// the chessboard (=skakiera in Greek)
	public static String[,] Skakiera = new String[8,8];  // Δήλωση πίνακα που αντιπροσωπεύει τη σκακιέρα
    public static String[,] Skakiera_Thinking_init = new String[8, 8];  // Δήλωση πίνακα που αντιπροσωπεύει τη σκακιέρα

    // CODE FOR COMPARISON
    public static int number_of_moves_analysed;

	// Variable to note if the computer moves its piece to a square threatened by a pawn
	public static bool knight_pawn_threat;
	public static bool bishop_pawn_threat;
	public static bool rook_pawn_threat;
	public static bool queen_pawn_threat;
	public static bool checked_for_pawn_threats;

	// Variable which determines of the program will show the inner
	// thinking process of the AI. Good for educational purposes!!!
	// UNCOMMENT TO SHOW INNER THINKING MECHANISM!
	//bool huo_debug;

	// Arrays to use in ComputerMove function
	// Changed in version 0.5
	// Penalty for moving the only piece that defends a square to that square (thus leavind the defender
	// alone in the square he once defended, defenceless!)
	// This penalty is also used to indicate that the computer loses its Queen with the move analyzed
	public static bool Danger_penalty;
	//bool LoseQueen_penalty;
	// Penalty for moving your piece to a square that the human opponent can hit with more power than the computer.
	public static bool Attackers_penalty;
	// Penalty if the pieces of the human defending a square in which the computer movies in, have much less
	// value than the pieces the computer has to support the attack on that square
    public static bool Defenders_value_penalty;

	public static String m_PlayerColor;   
	public static String m_ComputerLevel = "Kakos"; 
	public static String m_WhoPlays;      
	public static String m_WhichColorPlays; 
	public static String MovingPiece;      

	// variable to store temporarily the piece that is moving
	public static String ProsorinoKommati; 
	public static String ProsorinoKommati_KingCheck; 

	// variables to check the legality of the move
	public static bool exit_elegxos_nomimothtas = false;
	public static int h;
	public static int p;
	public static int how_to_move_Rank;
	public static int how_to_move_Column;
	public static int hhh;

	// NEW
	public static int kopa = 1;
	public static bool KingCheck = false;

	// coordinates of the starting square of the move
	public static String m_StartingColumn;
	public static int m_StartingRank;
	public static String m_FinishingColumn;
	public static int m_FinishingRank;

	// variable for en passant moves
	public static bool enpassant_occured;

	// move number
	public static int Move;

	// variable to show if promotion of a pawn occured
	public static bool Promotion_Occured = false;

	// variable to show if castrling occured
	public static bool Castling_Occured = false;

	// variables to help find out if it is legal for the computer to perform castling
	public static bool White_King_Moved = false;
	public static bool Black_King_Moved = false;
	public static bool White_Rook_a1_Moved = false;
	public static bool White_Rook_h1_Moved = false;
	public static bool Black_Rook_a8_Moved = false;
	public static bool Black_Rook_h8_Moved = false;
	public static bool Can_Castle_Big_White;
	public static bool Can_Castle_Big_Black;
	public static bool Can_Castle_Small_White;
	public static bool Can_Castle_Small_Black;
	
	// variables to show where the kings are in the chessboard
	public static int WhiteKingColumn;      
    public static int WhiteKingRank;        
	public static int BlackKingColumn;      
    public static int BlackKingRank;        

	// variables to show if king is in check
	public static bool WhiteKingCheck;
	public static bool BlackKingCheck;

	// variables to show if there is a possibility for mate
	public static bool WhiteMate = false;
	public static bool BlackMate = false;
	public static bool Mate;

	// variable to show if a move is found for the hy to do
	public static bool Best_Move_Found;

	// variables to help find if a king is under check.
	// (see CheckForWhiteCheck and CheckForBlackCheck functions)
	public static bool DangerFromRight;
	public static bool DangerFromLeft;
	public static bool DangerFromUp;
	public static bool DangerFromDown;
	public static bool DangerFromUpRight;
	public static bool DangerFromDownRight;
	public static bool DangerFromUpLeft;
	public static bool DangerFromDownLeft;

	// initial coordinates of the two kings
	// (see CheckForWhiteCheck and CheckForBlackCheck functions)
	public static int StartingWhiteKingColumn;
	public static int StartingWhiteKingRank;
	public static int StartingBlackKingColumn;
	public static int StartingBlackKingRank;

	// column number inserted by the user
	public static int m_StartingColumnNumber;
	public static int m_FinishingColumnNumber;

	///////////////////////////////////////////////////////////////////////////////////////////////////
	// Μεταβλητές για τον έλεγχο της "ορθότητας" και της "νομιμότητας" μιας κίνησης του χρήστη
	///////////////////////////////////////////////////////////////////////////////////////////////////

	// variable for the correctness of the move
	public static bool m_OrthotitaKinisis;           
	// variable for the legality of the move
	public static bool m_NomimotitaKinisis;         
	// has the user entered a wrong column?
	public static bool m_WrongColumn;                

	// variables for 'For' loops
	public static int i;
	public static int j;

	public static int ApophasiXristi = 1;

	//////////////////////////////////////
	// Computer Thought
	//////////////////////////////////////
	// Chessboards used for the computer throught
	public static String[,] Skakiera_Move_0 = new String[8,8]; // Δήλωση πίνακα που αντιπροσωπεύει τη σκακιέρα
    public static String[,] Skakiera_Move_After = new String[8,8];
    public static String[,] Skakiera_Thinking = new String[8,8];
    //static array<String, 2> Skakiera_Move_After = new array<String, 2>(8,8);  // Δήλωση πίνακα που αντιπροσωπεύει τη σκακιέρα
	//static array<String, 2> Skakiera_Thinking = new array<String, 2>(8,8);  // Δήλωση πίνακα που χρησιμοποιείται στη σκέψη του υπολογιστή.
	// rest of variables used for computer thought
	public static double Best_Move_Score;
	public static double Current_Move_Score;
	public static int Best_Move_StartingColumnNumber;
    public static int Best_Move_FinishingColumnNumber;
    public static int Best_Move_StartingRank;
    public static int Best_Move_FinishingRank;
	public static int Move_Analyzed;
	public static bool Stop_Analyzing;
	public static int Thinking_Depth;
    public static int Thinking_Depth_temp; // used when human eats a piece of the computer
	public static int m_StartingColumnNumber_HY;
	public static int m_FinishingColumnNumber_HY;
	public static int m_StartingRank_HY;
	public static int m_FinishingRank_HY;
	public static bool First_Call;
	public static String Who_Is_Analyzed;
	public static String MovingPiece_HY;

	// for writing the computer move
	public static String HY_Starting_Column_Text;
	public static String HY_Finishing_Column_Text;

	// chessboard to store the chessboard squares where it is dangerous
	// for the HY to move a piece
	// SEE function ComputerMove!
	//static array<String, 2> Skakiera_Dangerous_Squares = new array<String, 2>(8,8);  // Δήλωση πίνακα που αντιπροσωπεύει τη σκακιέρα

	// variables which help find the best move of the human-opponent
	// during the HY thought analysis
    public static String[,] Skakiera_Human_Move_0 = new String[8,8];
    public static String[,] Skakiera_Human_Thinking = new String[8,8];
	//static array<String, 2> Skakiera_Human_Move_0 = new array<String, 2>(8,8);
	//static array<String, 2> Skakiera_Human_Thinking = new array<String, 2>(8,8);
	public static bool First_Call_Human_Thought;
    // 2009 version 1 change
	//public static int iii_Human;
	//public static int jjj_Human;
	public static String MovingPiece_Human = "";
	public static int m_StartingColumnNumber_Human = 1;
	public static int m_FinishingColumnNumber_Human = 1;
	public static int m_StartingRank_Human = 1;
	public static int m_FinishingRank_Human = 1;
	public static int Current_Human_Move_Score;
	public static double Best_Human_Move_Score;
	public static int Best_Move_Human_StartingColumnNumber;
	public static int Best_Move_Human_FinishingColumnNumber;
	public static int Best_Move_Human_StartingRank;
	public static int Best_Move_Human_FinishingRank;
	public static bool Best_Human_Move_Found;

	// does the HY eats the queen of his opponent with the move it analyzes?
	// Changed in version 0.5
	public static bool eat_queen;

	// where the player can perform en passant
	public static int enpassant_possible_target_rank;
	public static int enpassant_possible_target_column;

	// is there a possible mate?
	public static bool Human_is_in_check;
	public static bool Possible_mate;

	// does the HY moves its King with the move it is analyzing?
	public static bool moving_the_king;

	public static int choise_of_user;
    private static string test_starting_column;
    private static string test_finishing_column;

	///////////////////////////////////////////////////////////////////////////////////////////////////
	// END OF VARIABLES DECLARATION
	///////////////////////////////////////////////////////////////////////////////////////////////////

static void Main(string[] args) {
	/////////////////////
	// Setup game
	/////////////////////
	Console.Write("Choose color (w/b): ");
	String the_choise_of_user = Console.ReadLine();

	if((the_choise_of_user.CompareTo("w") == 0)||(the_choise_of_user.CompareTo("W") == 0))
	{
		m_PlayerColor = "White";
		m_WhoPlays = "Human";
	}
	else if((the_choise_of_user.CompareTo("b") == 0)||(the_choise_of_user.CompareTo("B") == 0))
	{
		m_PlayerColor = "Black";
		m_WhoPlays = "HY";
	}

	/////////////////////////////////////////////////////////////////////////
	// CHANGE Thinking_Depth TO HAVE MORE THINKING DEPTHS
	// BUT REMEMBER TO ALSO UNCOMMENT ComputerMove4,6,8 functions and
	// the respective part in HumanMove function that calls them!
	/////////////////////////////////////////////////////////////////////////
	// ΠΡΟΣΟΧΗ: Αν βάλω τον υπολογιστή να σκεφτεί σε βάθος 1 κίνησης
	// (ήτοι Thinking_Depth = 0), τότε ΔΕΝ σκέφτεται σωστά! Αυτό συμβαίνει
	// διότι η HumanMove πρέπει να κληθεί τουλάχιστον μία φορά για να
	// ολοκληρωθεί σωστά τουλάχιστον ένας πλήρης κύκλος σκέψης του ΗΥ.
	/////////////////////////////////////////////////////////////////////////

    //Thinking_Depth = 20;
    // MiniMax algorithm currently only utilizes 8-ply thinking depth
    // Add more "for loops" in the required section in ComputerMove to allow more deep thinking
    // However remember that the NodesAnalysis table has a limit!!! (and so does the memory)
    //Thinking_Depth = 4;

	////////////////////////////////////////////////////////////
	// SHOW THE INNER THINKING PROCESS OF THE COMPUTER?
	// GOOD FOR EDUCATIONAL PURPOSES!
	// SET huo_debug to TRUE to show inner thinking process!
	////////////////////////////////////////////////////////////
	//Console.Write("Show thinking process (y/n)? ");
	//the_choise_of_user = Console.ReadLine();
	//if((the_choise_of_user.CompareTo("y") == 0)||(the_choise_of_user.CompareTo("Y") == 0))
	//	huo_debug = true;
	//else if((the_choise_of_user.CompareTo("n") == 0)||(the_choise_of_user.CompareTo("N") == 0))
	//	huo_debug = false;

	Console.WriteLine( "\nHuo Chess v0.94 by Spiros I.Kakos (huo) [2011] - C# Edition" );

	// initial values
	White_King_Moved = false;
	Black_King_Moved = false;
	White_Rook_a1_Moved = false;
	White_Rook_h1_Moved = false;
	Black_Rook_a8_Moved = false;
	Black_Rook_h8_Moved = false;
	Can_Castle_Big_White = true;
	Can_Castle_Big_Black = true;
	Can_Castle_Small_White = true;
	Can_Castle_Small_Black = true;
	Move = 0;
	m_WhichColorPlays = "White";

	// fix startup position
	Starting_position();

	// if it is the turn of HY to play, then call the respective function
	// to implement HY thought

	bool exit_game = false;

	do
	{

	if ( m_WhoPlays.CompareTo("HY") == 0 )
	{
		// call HY Thought function
		Move = 0;

		if( Move == 0 )
		{
			Console.WriteLine("");
			Console.WriteLine("Thinking...");
		}

		Move_Analyzed = 0;
		Stop_Analyzing = false;
		First_Call = true;
		Best_Move_Found = false;
		Who_Is_Analyzed = "HY";
		ComputerMove(Skakiera);
	}
	else if ( m_WhoPlays.CompareTo("Human") == 0 )
	{
		////////////////////////////
		// Human enters his move
		////////////////////////////
		Console.WriteLine("");
		Console.Write("Starting column (A to H)...");
		m_StartingColumn = Console.ReadLine().ToUpper();

		Console.Write("Starting rank (1 to 8).....");
		m_StartingRank = Int32.Parse(Console.ReadLine());

		Console.Write("Finishing column (A to H)...");
		m_FinishingColumn = Console.ReadLine().ToUpper();

		Console.Write("Finishing rank (1 to 8).....");
		m_FinishingRank = Int32.Parse(Console.ReadLine());

		// show the move entered

		String huoMove = String.Concat("Your move: ", m_StartingColumn, m_StartingRank.ToString(), " -> " );

        huoMove = String.Concat( huoMove, m_FinishingColumn, m_FinishingRank.ToString() );
		Console.WriteLine( huoMove );

        //StreamWriter huo_sw3 = new StreamWriter("game.txt", true);
        //huo_sw3.WriteLine(huoMove);
        //huo_sw3.Close();

		Console.WriteLine("");
		Console.WriteLine("Thinking...");

		// check the move entered by the human for correctness (='Orthotita' in Greek)
		// and legality (='Nomimotita' in Greek)
		Enter_move();
	}

	}while(exit_game == false);

	}



public static bool CheckForBlackCheck(string[,] BCSkakiera)                    
{      
	// TODO: Add your control notification handler code here

	bool KingCheck;

	///////////////////////////////////////////////////////////////////////////////////////////////////////////////
	// Εύρεση των συντεταγμένων του βασιλιά.
	// Αν σε κάποιο τετράγωνο βρεθεί ότι υπάρχει ένας βασιλιάς, τότε απλά καταγράφεται η τιμή του εν λόγω
	// τετραγώνου στις αντίστοιχες μεταβλητές που δηλώνουν τη στήλη και τη γραμμή στην οποία υπάρχει μαύρος
	// βασιλιάς.
	// ΠΡΟΣΟΧΗ: Γράφω (i+1) αντί για i και (j+1) αντί για j γιατί το πρώτο στοιχείο του πίνακα BCSkakiera[(8),(8)]
	// είναι το BCSkakiera[(0),(0)] και ΟΧΙ το BCSkakiera[(1),(1)]!
	///////////////////////////////////////////////////////////////////////////////////////////////////////////////

	for (i = 0; i <= 7; i++)
	{
		for (j = 0; j <= 7; j++)
		{

			if (BCSkakiera[(i),(j)].CompareTo("Black King") == 0)
			{
				BlackKingColumn = (i+1);
				BlackKingRank = (j+1);
			}

		}
	}

	///////////////////////////////////////////////////////////////
	// Έλεγχος του αν ο μαύρος βασιλιάς υφίσταται "σαχ"
	///////////////////////////////////////////////////////////////

	KingCheck = false;

	////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	// Ελέγχουμε αρχικά αν υπάρχει κίνδυνος για το μαύρο βασιλιά ΑΠΟ ΤΑ ΔΕΞΙΑ ΤΟΥ. Για να μην βγούμε έξω από τα
	// όρια της BCSkakiera[(8),(8)] έχουμε προσθέσει τον έλεγχο (BlackKingColumn + 1) <= 8 στο "if". Αρχικά ο "κίνδυνος"
	// από τα "δεξιά" είναι υπαρκτός, άρα DangerFromRight = true. Ωστόσο αν βρεθεί ότι στα δεξιά του μαύρου βασι-
	// λιά υπάρχει κάποιο μαύρο κομμάτι, τότε δεν είναι δυνατόν ο εν λόγω βασιλιάς να υφίσταται σαχ από τα δεξιά
	// του (αφού θα "προστατεύεται" από το κομμάτι ιδίου χρώματος), οπότε η DangerFromRight = false και ο έλεγχος
	// για απειλές από τα δεξιά σταματάει (για αυτό και έχω προσθέσει την προϋπόθεση (DangerFromRight == true) στα
	// "if" που κάνουν αυτόν τον έλεγχο).
	// Αν όμως δεν υπάρχει κανένα μαύρο κομμάτι δεξιά του βασιλιά για να τον προστατεύει, τότε συνεχίζει να
	// υπάρχει πιθανότητα να απειλείται ο βασιλιάς από τα δεξιά του, οπότε ο έλεγχος συνεχίζεται.
	// Σημείωση: Ο έλεγχος γίνεται για πιθανό σαχ από πύργο ή βασίλισσα αντίθετου χρώματος.
	////////////////////////////////////////////////////////////////////////////////////////////////////////////////

	DangerFromRight = true;

	for(int klopa = 1; klopa<=7;klopa++)
	{
	if ( ((BlackKingColumn + klopa) <= 8) && (DangerFromRight == true) )
	{
		if ((BCSkakiera[(BlackKingColumn + klopa - 1),(BlackKingRank - 1)].CompareTo("White Rook") == 0)||(BCSkakiera[(BlackKingColumn + klopa - 1),(BlackKingRank - 1)].CompareTo("White Queen") == 0))
			KingCheck = true;
		else if ((BCSkakiera[(BlackKingColumn + klopa - 1),(BlackKingRank - 1)].CompareTo("Black Pawn") == 0)||(BCSkakiera[(BlackKingColumn + klopa - 1),(BlackKingRank - 1)].CompareTo("Black Rook") == 0)||(BCSkakiera[(BlackKingColumn + klopa - 1),(BlackKingRank - 1)].CompareTo("Black Knight") == 0)||(BCSkakiera[(BlackKingColumn + klopa - 1),(BlackKingRank - 1)].CompareTo("Black Bishop") == 0)||(BCSkakiera[(BlackKingColumn + klopa - 1),(BlackKingRank - 1)].CompareTo("Black Queen") == 0))
			DangerFromRight = false;
		else if ((BCSkakiera[(BlackKingColumn + klopa - 1),(BlackKingRank - 1)].CompareTo("White Pawn") == 0)||(BCSkakiera[(BlackKingColumn + klopa - 1),(BlackKingRank - 1)].CompareTo("White Knight") == 0)||(BCSkakiera[(BlackKingColumn + klopa - 1),(BlackKingRank - 1)].CompareTo("White Bishop") == 0)||(BCSkakiera[(BlackKingColumn + klopa - 1),(BlackKingRank - 1)].CompareTo("White King") == 0))
			DangerFromRight = false;
	}
	}



	///////////////////////////////////////////////////////////////////////////////////////////////////////
	// Έλεγχος αν υπάρχει κίνδυνος για το μαύρο βασιλιά ΑΠΟ ΤΑ ΑΡΙΣΤΕΡΑ ΤΟΥ (από πύργο ή βασίλισσα).
	///////////////////////////////////////////////////////////////////////////////////////////////////////

	DangerFromLeft = true;

	for(int klopa = 1; klopa<=7;klopa++)
	{
	if ( ((BlackKingColumn - klopa) >= 1) && (DangerFromLeft == true) )
	{
		if ((BCSkakiera[(BlackKingColumn - klopa - 1),(BlackKingRank - 1)].CompareTo("White Rook") == 0)||(BCSkakiera[(BlackKingColumn - klopa - 1),(BlackKingRank - 1)].CompareTo("White Queen") == 0))
			KingCheck = true;
		else if ((BCSkakiera[(BlackKingColumn - klopa - 1),(BlackKingRank - 1)].CompareTo("Black Pawn") == 0)||(BCSkakiera[(BlackKingColumn - klopa - 1),(BlackKingRank - 1)].CompareTo("Black Rook") == 0)||(BCSkakiera[(BlackKingColumn - klopa - 1),(BlackKingRank - 1)].CompareTo("Black Knight") == 0)||(BCSkakiera[(BlackKingColumn - klopa - 1),(BlackKingRank - 1)].CompareTo("Black Bishop") == 0)||(BCSkakiera[(BlackKingColumn - klopa - 1),(BlackKingRank - 1)].CompareTo("Black Queen") == 0))
			DangerFromLeft = false;
		else if ((BCSkakiera[(BlackKingColumn - klopa - 1),(BlackKingRank - 1)].CompareTo("White Pawn") == 0)||(BCSkakiera[(BlackKingColumn - klopa - 1),(BlackKingRank - 1)].CompareTo("White Knight") == 0)||(BCSkakiera[(BlackKingColumn - klopa - 1),(BlackKingRank - 1)].CompareTo("White Bishop") == 0)||(BCSkakiera[(BlackKingColumn - klopa - 1),(BlackKingRank - 1)].CompareTo("White King") == 0))
			DangerFromLeft = false;
	}
	}



	///////////////////////////////////////////////////////////////////////////////////////////////////////
	// Έλεγχος αν υπάρχει κίνδυνος για το μαύρο βασιλιά ΑΠΟ ΠΑΝΩ (από πύργο ή βασίλισσα).
	///////////////////////////////////////////////////////////////////////////////////////////////////////


	DangerFromUp = true;

	for(int klopa = 1; klopa<=7;klopa++)
	{
	if ( ((BlackKingRank + klopa) <= 8) && (DangerFromUp == true) )
	{
		if ((BCSkakiera[(BlackKingColumn - 1),(BlackKingRank + klopa- 1)].CompareTo("White Rook") == 0)||(BCSkakiera[(BlackKingColumn - 1),(BlackKingRank + klopa- 1)].CompareTo("White Queen") == 0))
			KingCheck = true;
		else if ((BCSkakiera[(BlackKingColumn - 1),(BlackKingRank + klopa- 1)].CompareTo("Black Pawn") == 0)||(BCSkakiera[(BlackKingColumn - 1),(BlackKingRank + klopa- 1)].CompareTo("Black Rook") == 0)||(BCSkakiera[(BlackKingColumn - 1),(BlackKingRank + klopa- 1)].CompareTo("Black Knight") == 0)||(BCSkakiera[(BlackKingColumn - 1),(BlackKingRank + klopa- 1)].CompareTo("Black Bishop") == 0)||(BCSkakiera[(BlackKingColumn - 1),(BlackKingRank + klopa- 1)].CompareTo("Black Queen") == 0))
			DangerFromUp = false;
		else if ((BCSkakiera[(BlackKingColumn - 1),(BlackKingRank + klopa - 1)].CompareTo("White Pawn") == 0)||(BCSkakiera[(BlackKingColumn - 1),(BlackKingRank + klopa - 1)].CompareTo("White Knight") == 0)||(BCSkakiera[(BlackKingColumn - 1),(BlackKingRank + klopa - 1)].CompareTo("White Bishop") == 0)||(BCSkakiera[(BlackKingColumn - 1),(BlackKingRank + klopa - 1)].CompareTo("White King") == 0))
			DangerFromUp = false;
	}
	}



	///////////////////////////////////////////////////////////////////////////////////////////////////////
	// Έλεγχος αν υπάρχει κίνδυνος για το μαύρο βασιλιά ΑΠΟ ΚΑΤΩ (από πύργο ή βασίλισσα).
	///////////////////////////////////////////////////////////////////////////////////////////////////////

	DangerFromDown = true;

	for(int klopa = 1; klopa<=7;klopa++)
	{
	if ( ((BlackKingRank - klopa) >= 1) && (DangerFromDown == true) )
	{
		if ((BCSkakiera[(BlackKingColumn - 1),(BlackKingRank - klopa- 1)].CompareTo("White Rook") == 0)||(BCSkakiera[(BlackKingColumn - 1),(BlackKingRank - klopa- 1)].CompareTo("White Queen") == 0))
			KingCheck = true;
		else if ((BCSkakiera[(BlackKingColumn - 1),(BlackKingRank - klopa- 1)].CompareTo("Black Pawn") == 0)||(BCSkakiera[(BlackKingColumn - 1),(BlackKingRank - klopa- 1)].CompareTo("Black Rook") == 0)||(BCSkakiera[(BlackKingColumn - 1),(BlackKingRank - klopa- 1)].CompareTo("Black Knight") == 0)||(BCSkakiera[(BlackKingColumn - 1),(BlackKingRank - klopa- 1)].CompareTo("Black Bishop") == 0)||(BCSkakiera[(BlackKingColumn - 1),(BlackKingRank - klopa- 1)].CompareTo("Black Queen") == 0))
			DangerFromDown = false;
		else if ((BCSkakiera[(BlackKingColumn - 1),(BlackKingRank - klopa - 1)].CompareTo("White Pawn") == 0)||(BCSkakiera[(BlackKingColumn - 1),(BlackKingRank - klopa - 1)].CompareTo("White Knight") == 0)||(BCSkakiera[(BlackKingColumn - 1),(BlackKingRank - klopa - 1)].CompareTo("White Bishop") == 0)||(BCSkakiera[(BlackKingColumn - 1),(BlackKingRank - klopa - 1)].CompareTo("White King") == 0))
			DangerFromDown = false;
	}
	}



	////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	// Έλεγχος αν υπάρχει κίνδυνος για το μαύρο βασιλιά ΑΠΟ ΠΑΝΩ-ΔΕΞΙΑ ΤΟΥ (από βασίλισσα ή αξιωματικό).
	////////////////////////////////////////////////////////////////////////////////////////////////////////////////

	DangerFromUpRight = true;

	for(int klopa = 1; klopa<=7;klopa++)
	{
	if ( ((BlackKingColumn + klopa) <= 8) && ((BlackKingRank + klopa) <= 8) && (DangerFromUpRight == true) )
	{
		if ((BCSkakiera[(BlackKingColumn + klopa - 1),(BlackKingRank + klopa - 1)].CompareTo("White Bishop") == 0)||(BCSkakiera[(BlackKingColumn + klopa - 1),(BlackKingRank + klopa - 1)].CompareTo("White Queen") == 0))
			KingCheck = true;
		else if ((BCSkakiera[(BlackKingColumn + klopa - 1),(BlackKingRank + klopa - 1)].CompareTo("Black Pawn") == 0)||(BCSkakiera[(BlackKingColumn + klopa - 1),(BlackKingRank + klopa - 1)].CompareTo("Black Rook") == 0)||(BCSkakiera[(BlackKingColumn + klopa - 1),(BlackKingRank + klopa - 1)].CompareTo("Black Knight") == 0)||(BCSkakiera[(BlackKingColumn + klopa - 1),(BlackKingRank + klopa - 1)].CompareTo("Black Bishop") == 0)||(BCSkakiera[(BlackKingColumn + klopa - 1),(BlackKingRank + klopa - 1)].CompareTo("Black Queen") == 0))
			DangerFromUpRight = false;
		else if ((BCSkakiera[(BlackKingColumn + klopa - 1),(BlackKingRank + klopa - 1)].CompareTo("White Pawn") == 0)||(BCSkakiera[(BlackKingColumn + klopa - 1),(BlackKingRank + klopa - 1)].CompareTo("White Rook") == 0)||(BCSkakiera[(BlackKingColumn + klopa - 1),(BlackKingRank + klopa - 1)].CompareTo("White Knight") == 0)||(BCSkakiera[(BlackKingColumn + klopa - 1),(BlackKingRank + klopa - 1)].CompareTo("White King") == 0))
			DangerFromUpRight = false;
	}
	}



	////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	// Έλεγχος αν υπάρχει κίνδυνος για το μαύρο βασιλιά ΑΠΟ ΚΑΤΩ-ΑΡΙΣΤΕΡΑ ΤΟΥ (από βασίλισσα ή αξιωματικό).
	////////////////////////////////////////////////////////////////////////////////////////////////////////////////

	DangerFromDownLeft = true;

	for(int klopa = 1; klopa<=7;klopa++)
	{
	if ( ((BlackKingColumn - klopa) >= 1) && ((BlackKingRank - klopa) >= 1) && (DangerFromDownLeft == true) )
	{
		if ((BCSkakiera[(BlackKingColumn - klopa - 1),(BlackKingRank - klopa - 1)].CompareTo("White Bishop") == 0)||(BCSkakiera[(BlackKingColumn - klopa - 1),(BlackKingRank - klopa - 1)].CompareTo("White Queen") == 0))
			KingCheck = true;
		else if ((BCSkakiera[(BlackKingColumn - klopa - 1),(BlackKingRank - klopa - 1)].CompareTo("Black Pawn") == 0)||(BCSkakiera[(BlackKingColumn - klopa - 1),(BlackKingRank - klopa - 1)].CompareTo("Black Rook") == 0)||(BCSkakiera[(BlackKingColumn - klopa - 1),(BlackKingRank - klopa - 1)].CompareTo("Black Knight") == 0)||(BCSkakiera[(BlackKingColumn - klopa - 1),(BlackKingRank - klopa - 1)].CompareTo("Black Bishop") == 0)||(BCSkakiera[(BlackKingColumn - klopa - 1),(BlackKingRank - klopa - 1)].CompareTo("Black Queen") == 0))
			DangerFromDownLeft = false;
		else if ((BCSkakiera[(BlackKingColumn - klopa - 1),(BlackKingRank - klopa - 1)].CompareTo("White Pawn") == 0)||(BCSkakiera[(BlackKingColumn - klopa - 1),(BlackKingRank - klopa - 1)].CompareTo("White Rook") == 0)||(BCSkakiera[(BlackKingColumn - klopa - 1),(BlackKingRank - klopa - 1)].CompareTo("White Knight") == 0)||(BCSkakiera[(BlackKingColumn - klopa - 1),(BlackKingRank - klopa - 1)].CompareTo("White King") == 0))
			DangerFromDownLeft = false;
	}
	}


	////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	// Έλεγχος αν υπάρχει κίνδυνος για το μαύρο βασιλιά ΑΠΟ ΚΑΤΩ-ΔΕΞΙΑ ΤΟΥ (από βασίλισσα ή αξιωματικό).
	////////////////////////////////////////////////////////////////////////////////////////////////////////////////

	DangerFromDownRight = true;

	for(int klopa = 1; klopa<=7;klopa++)
	{
	if ( ((BlackKingColumn + klopa) <= 8) && ((BlackKingRank - klopa) >= 1) && (DangerFromDownRight == true) )
	{
		if ((BCSkakiera[(BlackKingColumn + klopa - 1),(BlackKingRank - klopa - 1)].CompareTo("White Bishop") == 0)||(BCSkakiera[(BlackKingColumn + klopa - 1),(BlackKingRank - klopa - 1)].CompareTo("White Queen") == 0))
			KingCheck = true;
		else if ((BCSkakiera[(BlackKingColumn + klopa - 1),(BlackKingRank - klopa - 1)].CompareTo("Black Pawn") == 0)||(BCSkakiera[(BlackKingColumn + klopa - 1),(BlackKingRank - klopa - 1)].CompareTo("Black Rook") == 0)||(BCSkakiera[(BlackKingColumn + klopa - 1),(BlackKingRank - klopa - 1)].CompareTo("Black Knight") == 0)||(BCSkakiera[(BlackKingColumn + klopa - 1),(BlackKingRank - klopa - 1)].CompareTo("Black Bishop") == 0)||(BCSkakiera[(BlackKingColumn + klopa - 1),(BlackKingRank - klopa - 1)].CompareTo("Black Queen") == 0))
			DangerFromDownRight = false;
		else if ((BCSkakiera[(BlackKingColumn + klopa - 1),(BlackKingRank - klopa - 1)].CompareTo("White Pawn") == 0)||(BCSkakiera[(BlackKingColumn + klopa - 1),(BlackKingRank - klopa - 1)].CompareTo("White Rook") == 0)||(BCSkakiera[(BlackKingColumn + klopa - 1),(BlackKingRank - klopa - 1)].CompareTo("White Knight") == 0)||(BCSkakiera[(BlackKingColumn + klopa - 1),(BlackKingRank - klopa - 1)].CompareTo("White King") == 0))
			DangerFromDownRight = false;
	}
	}



	////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	// Έλεγχος αν υπάρχει κίνδυνος για το μαύρο βασιλιά ΑΠΟ ΠΑΝΩ-ΑΡΙΣΤΕΡΑ ΤΟΥ (από βασίλισσα ή αξιωματικό).
	////////////////////////////////////////////////////////////////////////////////////////////////////////////////

	DangerFromUpLeft = true;

	for(int klopa = 1; klopa<=7;klopa++)
	{
	if ( ((BlackKingColumn - klopa) >= 1) && ((BlackKingRank + klopa) <= 8) && (DangerFromUpLeft == true) )
	{
		if ((BCSkakiera[(BlackKingColumn - klopa - 1),(BlackKingRank + klopa - 1)].CompareTo("White Bishop") == 0)||(BCSkakiera[(BlackKingColumn - klopa - 1),(BlackKingRank + klopa - 1)].CompareTo("White Queen") == 0))
			KingCheck = true;
		else if ((BCSkakiera[(BlackKingColumn - klopa - 1),(BlackKingRank + klopa - 1)].CompareTo("Black Pawn") == 0)||(BCSkakiera[(BlackKingColumn - klopa - 1),(BlackKingRank + klopa - 1)].CompareTo("Black Rook") == 0)||(BCSkakiera[(BlackKingColumn - klopa - 1),(BlackKingRank + klopa - 1)].CompareTo("Black Knight") == 0)||(BCSkakiera[(BlackKingColumn - klopa - 1),(BlackKingRank + klopa - 1)].CompareTo("Black Bishop") == 0)||(BCSkakiera[(BlackKingColumn - klopa - 1),(BlackKingRank + klopa - 1)].CompareTo("Black Queen") == 0))
			DangerFromUpLeft = false;
		else if ((BCSkakiera[(BlackKingColumn - klopa - 1),(BlackKingRank + klopa - 1)].CompareTo("White Pawn") == 0)||(BCSkakiera[(BlackKingColumn - klopa - 1),(BlackKingRank + klopa - 1)].CompareTo("White Rook") == 0)||(BCSkakiera[(BlackKingColumn - klopa - 1),(BlackKingRank + klopa - 1)].CompareTo("White Knight") == 0)||(BCSkakiera[(BlackKingColumn - klopa - 1),(BlackKingRank + klopa - 1)].CompareTo("White King") == 0))
			DangerFromUpLeft = false;
	}
	}


	//////////////////////////////////////////////////////////////////////////
	// Έλεγχος για το αν ο μαύρος βασιλιάς απειλείται από πιόνι.
	//////////////////////////////////////////////////////////////////////////

	if (((BlackKingColumn + 1) <= 8) && ((BlackKingRank - 1) >= 1))
	{
		if (BCSkakiera[(BlackKingColumn + 1 - 1),(BlackKingRank - 1 - 1)].CompareTo("White Pawn") == 0)
		{
			KingCheck = true;
		}
	}


	if (((BlackKingColumn - 1) >= 1) && ((BlackKingRank - 1) >= 1))
	{
		if (BCSkakiera[(BlackKingColumn - 1 - 1),(BlackKingRank - 1 - 1)].CompareTo("White Pawn") == 0) 
		{
			KingCheck = true;
		}
	}


	///////////////////////////////////////////////////////////////////////
	// Έλεγχος για το αν ο μαύρος βασιλιάς απειλείται από ίππο.
	///////////////////////////////////////////////////////////////////////
	
	if (((BlackKingColumn + 1) <= 8) && ((BlackKingRank + 2) <= 8))
		if (BCSkakiera[(BlackKingColumn + 1 - 1),(BlackKingRank + 2 - 1)].CompareTo("White Knight") == 0)
			KingCheck = true;
	
	if (((BlackKingColumn + 2) <= 8) && ((BlackKingRank - 1) >= 1))
		if (BCSkakiera[(BlackKingColumn + 2 - 1),(BlackKingRank - 1 - 1)].CompareTo("White Knight") == 0)
			KingCheck = true;
	
	if (((BlackKingColumn + 1) <= 8) && ((BlackKingRank - 2) >= 1))
		if (BCSkakiera[(BlackKingColumn + 1 - 1),(BlackKingRank - 2 - 1)].CompareTo("White Knight") == 0)
			KingCheck = true;

	if (((BlackKingColumn - 1) >= 1) && ((BlackKingRank - 2) >= 1))
		if (BCSkakiera[(BlackKingColumn - 1 - 1),(BlackKingRank - 2 - 1)].CompareTo("White Knight") == 0)
			KingCheck = true;

	if (((BlackKingColumn - 2) >= 1) && ((BlackKingRank - 1) >= 1))
		if (BCSkakiera[(BlackKingColumn - 2 - 1),(BlackKingRank - 1 - 1)].CompareTo("White Knight") == 0)
			KingCheck = true;

	if (((BlackKingColumn - 2) >= 1) && ((BlackKingRank + 1) <= 8))
		if (BCSkakiera[(BlackKingColumn - 2 - 1),(BlackKingRank + 1 - 1)].CompareTo("White Knight") == 0)
			KingCheck = true;
	
	if (((BlackKingColumn - 1) >= 1) && ((BlackKingRank + 2) <= 8))
		if (BCSkakiera[(BlackKingColumn - 1 - 1),(BlackKingRank + 2 - 1)].CompareTo("White Knight") == 0)
			KingCheck = true;

	if (((BlackKingColumn + 2) <= 8) && ((BlackKingRank + 1) <= 8))
		if (BCSkakiera[(BlackKingColumn + 2 - 1),(BlackKingRank + 1 - 1)].CompareTo("White Knight") == 0)
			KingCheck = true;

	return KingCheck;
	}


		
public static bool CheckForBlackMate(string[,] BMSkakiera)                   
{														      
	// TODO: Add your control notification handler code here

	bool Mate;

	/////////////////////////////////////////////////////////////////////////////////////////////////////////
	// Μεταβλητή που χρησιμεύει στον έλεγχο για το αν υπάρχει ματ (βλ. συναρτήσεις CheckForWhiteMate() και
	// CheckForBlackMate()).
	// Αναλυτικότερα, το πρόγραμμα ελέγχει αν αρχικά υπάρχει σαχ και, αν υπάρχει, ελέγχει αν αυτό το
	// σαχ μπορεί να αποφευχθεί με τη μετακίνηση του υπό απειλή βασιλιά σε κάποιο γειτονικό τετράγωνο.
	// Η μεταβλητή καταγράφει το αν συνεχίζει να υπάρχει πιθανότητα να υπάρχει ματ στη σκακιέρα.
	/////////////////////////////////////////////////////////////////////////////////////////////////////////

	bool DangerForMate;

	////////////////////////////////////////////////////////////
	// Έλεγχος του αν υπάρχει "ματ" στον μαύρο βασιλιά
	////////////////////////////////////////////////////////////

	Mate = false;
	DangerForMate = true;    // Αρχικά, προφανώς υπάρχει πιθανότητα να υπάρχει ματ στη σκακιέρα.
	                         // Αν, ωστόσο, κάποια στιγμή βρεθεί ότι αν ο βασιλιάς μπορεί να μετακινηθεί
						     // σε ένα διπλανό τετράγωνο και να πάψει να υφίσταται σαχ, τότε παύει να
							 // υπάρχει πιθανότητα να υπάρχει ματ (προφανώς) και η μεταβλητή παίρνει την
							 // τιμή false.


	//////////////////////////////////////////////////////////////
	// Εύρεση των αρχικών συντεταγμένων του βασιλιά
	//////////////////////////////////////////////////////////////

	for (i = 0; i <= 7; i++)
	{
		for (j = 0; j <= 7; j++)
		{
			
			if (BMSkakiera[(i),(j)].CompareTo("Black King") == 0)
			{
				StartingBlackKingColumn = (i+1);
				StartingBlackKingRank = (j+1);
			}

		}
	}


	//////////////////////////////////////////////////
	// Έλεγχος αν ο μαύρος βασιλιάς είναι ματ
	//////////////////////////////////////////////////


	if (m_WhichColorPlays.CompareTo("Black") == 0)
	{

	////////////////////////////////////////////////
	// Έλεγχος αν υπάρχει σαχ αυτή τη στιγμή
	////////////////////////////////////////////////

	BlackKingCheck = CheckForBlackCheck(BMSkakiera);

	if ( BlackKingCheck == false )     // Αν αυτή τη στιγμή δεν υφίσταται σαχ, τότε να μη συνεχιστεί ο έλεγχος
		DangerForMate = false;         // καθώς ΔΕΝ συνεχίζει να υφίσταται πιθανότητα να υπάρχει ματ.

	///////////////////////////////////////////////////////////////////////////////////////////////////////////////
	// Έλεγχος του αν θα συνεχίσει να υπάρχει σαχ αν ο μαύρος βασιλιάς προσπαθήσει να διαφύγει μετακινούμενος
	// προς τα πάνω
	///////////////////////////////////////////////////////////////////////////////////////////////////////////////

	if (StartingBlackKingRank < 8)
	{
		MovingPiece = BMSkakiera[(StartingBlackKingColumn - 1),(StartingBlackKingRank - 1)];
		ProsorinoKommati = BMSkakiera[(StartingBlackKingColumn - 1),(StartingBlackKingRank - 1 + 1)];

	if ( (ProsorinoKommati.CompareTo("Black Queen")==1)&&(ProsorinoKommati.CompareTo("Black Rook")==1)&&(ProsorinoKommati.CompareTo("Black Knight")==1)&&(ProsorinoKommati.CompareTo("Black Bishop")==1)&&(ProsorinoKommati.CompareTo("Black Pawn")==1)&&(DangerForMate == true)&&((StartingBlackKingRank - 1 + 1)<=7) )
	{
	
	// (Προσωρινή) μετακίνηση του βασιλιά προς τα πάνω και έλεγχος του αν συνεχίζει τότε να υπάρχει σαχ.
	// Ο έλεγχος γίνεται μόνο αν στο τετράγωνο που μετακινείται προσωρινά ο βασιλιάς δεν υπάρχει άλλο κομμάτι
	// του ίδιου χρώματος που να τον εμποδίζει και αν, φυσικά, ο βασιλιάς δεν βγαίνει έξω από τη σκακιέρα με
	// αυτή του την κίνηση και αν, προφανώς, συνεχίζει να υπάρχει πιθανότητα να ύπάρχει ματ (καθώς αν δεν
	// υπάρχει τέτοια πιθανότητα, τότε ο έλεγχος είναι άχρηστος).
		
		BMSkakiera[(StartingBlackKingColumn - 1),(StartingBlackKingRank - 1)] = "";
		BMSkakiera[(StartingBlackKingColumn - 1),(StartingBlackKingRank - 1 + 1)] = MovingPiece;
		BlackKingCheck = CheckForBlackCheck(BMSkakiera);

		if (BlackKingCheck == false)
			DangerForMate = false;

		// Επαναφορά της σκακιέρας στην κατάσταση στην οποία βρισκόταν πριν μετακινηθεί ο βασιλιάς για τους
		// σκοπούς του ελέγχου.

		BMSkakiera[(StartingBlackKingColumn - 1),(StartingBlackKingRank - 1)] = MovingPiece;
		BMSkakiera[(StartingBlackKingColumn - 1),(StartingBlackKingRank - 1 + 1)] = ProsorinoKommati;

	}

	}

	
	///////////////////////////////////////////////////////////////////////////////////////////////////////////////
	// Έλεγχος του αν θα συνεχίσει να υπάρχει σαχ αν ο μαύρος βασιλιάς προσπαθήσει να διαφύγει μετακινούμενος
	// προς τα πάνω-δεξιά
	///////////////////////////////////////////////////////////////////////////////////////////////////////////////

	if ((StartingBlackKingColumn < 8)&&(StartingBlackKingRank < 8))
	{

	MovingPiece = BMSkakiera[(StartingBlackKingColumn - 1),(StartingBlackKingRank - 1)];
	ProsorinoKommati = BMSkakiera[(StartingBlackKingColumn - 1 + 1),(StartingBlackKingRank - 1 + 1)];

	if ( (ProsorinoKommati.CompareTo("Black Queen")==1)&&(ProsorinoKommati.CompareTo("Black Rook")==1)&&(ProsorinoKommati.CompareTo("Black Knight")==1)&&(ProsorinoKommati.CompareTo("Black Bishop")==1)&&(ProsorinoKommati.CompareTo("Black Pawn")==1)&&(DangerForMate == true)&&((StartingBlackKingRank - 1 + 1)<=7)&&((StartingBlackKingColumn - 1 + 1)<=7) )
	{
		
		// (Προσωρινή) μετακίνηση του βασιλιά και έλεγχος του αν συνεχίζει τότε να υπάρχει σαχ.

		BMSkakiera[(StartingBlackKingColumn - 1),(StartingBlackKingRank - 1)] = "";
		BMSkakiera[(StartingBlackKingColumn - 1 + 1),(StartingBlackKingRank - 1 + 1)] = MovingPiece;
		BlackKingCheck = CheckForBlackCheck(BMSkakiera);

		if (BlackKingCheck == false)
			DangerForMate = false;

		// Επαναφορά της σκακιέρας στην κατάσταση στην οποία βρισκόταν πριν μετακινηθεί ο βασιλιάς για τους
		// σκοπούς του ελέγχου.

		BMSkakiera[(StartingBlackKingColumn - 1),(StartingBlackKingRank - 1)] = MovingPiece;
		BMSkakiera[(StartingBlackKingColumn - 1 + 1),(StartingBlackKingRank - 1 + 1)] = ProsorinoKommati;

	}

	}


	///////////////////////////////////////////////////////////////////////////////////////////////////////////////
	// Έλεγχος του αν θα συνεχίσει να υπάρχει σαχ αν ο μαύρος βασιλιάς προσπαθήσει να διαφύγει μετακινούμενος
	// προς τα δεξιά
	///////////////////////////////////////////////////////////////////////////////////////////////////////////////

	if (StartingBlackKingColumn < 8)
	{

	MovingPiece = BMSkakiera[(StartingBlackKingColumn - 1),(StartingBlackKingRank - 1)];
	ProsorinoKommati = BMSkakiera[(StartingBlackKingColumn - 1 + 1),(StartingBlackKingRank - 1)];

	if ( (ProsorinoKommati.CompareTo("Black Queen")==1)&&(ProsorinoKommati.CompareTo("Black Rook")==1)&&(ProsorinoKommati.CompareTo("Black Knight")==1)&&(ProsorinoKommati.CompareTo("Black Bishop")==1)&&(ProsorinoKommati.CompareTo("Black Pawn")==1)&&(DangerForMate == true)&&((StartingBlackKingColumn - 1 + 1)<=7) )
	{
		
		// (Προσωρινή) μετακίνηση του βασιλιά και έλεγχος του αν συνεχίζει τότε να υπάρχει σαχ.

		BMSkakiera[(StartingBlackKingColumn - 1),(StartingBlackKingRank - 1)] = "";
		BMSkakiera[(StartingBlackKingColumn - 1 + 1),(StartingBlackKingRank - 1)] = MovingPiece;
		BlackKingCheck = CheckForBlackCheck(BMSkakiera);

		if (BlackKingCheck == false)
			DangerForMate = false;

		// Επαναφορά της σκακιέρας στην κατάσταση στην οποία βρισκόταν πριν μετακινηθεί ο βασιλιάς για τους
		// σκοπούς του ελέγχου.

		BMSkakiera[(StartingBlackKingColumn - 1),(StartingBlackKingRank - 1)] = MovingPiece;
		BMSkakiera[(StartingBlackKingColumn - 1 + 1),(StartingBlackKingRank - 1)] = ProsorinoKommati;

	}

	}


	///////////////////////////////////////////////////////////////////////////////////////////////////////////////
	// Έλεγχος του αν θα συνεχίσει να υπάρχει σαχ αν ο μαύρος βασιλιάς προσπαθήσει να διαφύγει μετακινούμενος
	// προς τα κάτω-δεξιά
	///////////////////////////////////////////////////////////////////////////////////////////////////////////////

	if ((StartingBlackKingColumn < 8)&&(StartingBlackKingRank > 1))
	{

	MovingPiece = BMSkakiera[(StartingBlackKingColumn - 1),(StartingBlackKingRank - 1)];
	ProsorinoKommati = BMSkakiera[(StartingBlackKingColumn - 1 + 1),(StartingBlackKingRank - 1 - 1)];

	if ( (ProsorinoKommati.CompareTo("Black Queen")==1)&&(ProsorinoKommati.CompareTo("Black Rook")==1)&&(ProsorinoKommati.CompareTo("Black Knight")==1)&&(ProsorinoKommati.CompareTo("Black Bishop")==1)&&(ProsorinoKommati.CompareTo("Black Pawn")==1)&&(DangerForMate == true)&&((StartingBlackKingRank - 1 - 1)>=0)&&((StartingBlackKingColumn - 1 + 1)<=7) )
	{
		
		// (Προσωρινή) μετακίνηση του βασιλιά και έλεγχος του αν συνεχίζει τότε να υπάρχει σαχ.

		BMSkakiera[(StartingBlackKingColumn - 1),(StartingBlackKingRank - 1)] = "";
		BMSkakiera[(StartingBlackKingColumn - 1 + 1),(StartingBlackKingRank - 1 - 1)] = MovingPiece;
		BlackKingCheck = CheckForBlackCheck(BMSkakiera);

		if (BlackKingCheck == false)
			DangerForMate = false;

		// Επαναφορά της σκακιέρας στην κατάσταση στην οποία βρισκόταν πριν μετακινηθεί ο βασιλιάς για τους
		// σκοπούς του ελέγχου.

		BMSkakiera[(StartingBlackKingColumn - 1),(StartingBlackKingRank - 1)] = MovingPiece;
		BMSkakiera[(StartingBlackKingColumn - 1 + 1),(StartingBlackKingRank - 1 - 1)] = ProsorinoKommati;

	}

	}


	///////////////////////////////////////////////////////////////////////////////////////////////////////////////
	// Έλεγχος του αν θα συνεχίσει να υπάρχει σαχ αν ο μαύρος βασιλιάς προσπαθήσει να διαφύγει μετακινούμενος
	// προς τα κάτω
	///////////////////////////////////////////////////////////////////////////////////////////////////////////////

	if (StartingBlackKingRank > 1)
	{

	MovingPiece = BMSkakiera[(StartingBlackKingColumn - 1),(StartingBlackKingRank - 1)];
	ProsorinoKommati = BMSkakiera[(StartingBlackKingColumn - 1),(StartingBlackKingRank - 1 - 1)];

	if ( (ProsorinoKommati.CompareTo("Black Queen")==1)&&(ProsorinoKommati.CompareTo("Black Rook")==1)&&(ProsorinoKommati.CompareTo("Black Knight")==1)&&(ProsorinoKommati.CompareTo("Black Bishop")==1)&&(ProsorinoKommati.CompareTo("Black Pawn")==1)&&(DangerForMate == true)&&((StartingBlackKingRank - 1 - 1)>=0) )
	{
	
		// (Προσωρινή) μετακίνηση του βασιλιά προς τα πάνω και έλεγχος του αν συνεχίζει τότε να υπάρχει σαχ.
		
		BMSkakiera[(StartingBlackKingColumn - 1),(StartingBlackKingRank - 1)] = "";
		BMSkakiera[(StartingBlackKingColumn - 1),(StartingBlackKingRank - 1 - 1)] = MovingPiece;
		BlackKingCheck = CheckForBlackCheck(BMSkakiera);

		if (BlackKingCheck == false)
			DangerForMate = false;

		// Επαναφορά της σκακιέρας στην κατάσταση στην οποία βρισκόταν πριν μετακινηθεί ο βασιλιάς για τους
		// σκοπούς του ελέγχου.

		BMSkakiera[(StartingBlackKingColumn - 1),(StartingBlackKingRank - 1)] = MovingPiece;
		BMSkakiera[(StartingBlackKingColumn - 1),(StartingBlackKingRank - 1 - 1)] = ProsorinoKommati;

	}

	}


	///////////////////////////////////////////////////////////////////////////////////////////////////////////////
	// Έλεγχος του αν θα συνεχίσει να υπάρχει σαχ αν ο μαύρος βασιλιάς προσπαθήσει να διαφύγει μετακινούμενος
	// προς τα κάτω-αριστερά
	///////////////////////////////////////////////////////////////////////////////////////////////////////////////

	if ((StartingBlackKingColumn > 1)&&(StartingBlackKingRank > 1))
	{

	MovingPiece = BMSkakiera[(StartingBlackKingColumn - 1),(StartingBlackKingRank - 1)];
	ProsorinoKommati = BMSkakiera[(StartingBlackKingColumn - 1 - 1),(StartingBlackKingRank - 1 - 1)];

	if ( (ProsorinoKommati.CompareTo("Black Queen")==1)&&(ProsorinoKommati.CompareTo("Black Rook")==1)&&(ProsorinoKommati.CompareTo("Black Knight")==1)&&(ProsorinoKommati.CompareTo("Black Bishop")==1)&&(ProsorinoKommati.CompareTo("Black Pawn")==1)&&(DangerForMate == true)&&((StartingBlackKingRank - 1 - 1)>=0)&&((StartingBlackKingColumn - 1 - 1)>=0) )
	{
		
		// (Προσωρινή) μετακίνηση του βασιλιά και έλεγχος του αν συνεχίζει τότε να υπάρχει σαχ.

		BMSkakiera[(StartingBlackKingColumn - 1),(StartingBlackKingRank - 1)] = "";
		BMSkakiera[(StartingBlackKingColumn - 1 - 1),(StartingBlackKingRank - 1 - 1)] = MovingPiece;
		BlackKingCheck = CheckForBlackCheck(BMSkakiera);

		if (BlackKingCheck == false)
			DangerForMate = false;

		// Επαναφορά της σκακιέρας στην κατάσταση στην οποία βρισκόταν πριν μετακινηθεί ο βασιλιάς για τους
		// σκοπούς του ελέγχου.

		BMSkakiera[(StartingBlackKingColumn - 1),(StartingBlackKingRank - 1)] = MovingPiece;
		BMSkakiera[(StartingBlackKingColumn - 1 - 1),(StartingBlackKingRank - 1 - 1)] = ProsorinoKommati;

	}

	}


	///////////////////////////////////////////////////////////////////////////////////////////////////////////////
	// Έλεγχος του αν θα συνεχίσει να υπάρχει σαχ αν ο μαύρος βασιλιάς προσπαθήσει να διαφύγει μετακινούμενος
	// προς τα αριστερά
	///////////////////////////////////////////////////////////////////////////////////////////////////////////////

	if (StartingBlackKingColumn > 1)
	{

	MovingPiece = BMSkakiera[(StartingBlackKingColumn - 1),(StartingBlackKingRank - 1)];
	ProsorinoKommati = BMSkakiera[(StartingBlackKingColumn - 1 - 1),(StartingBlackKingRank - 1)];

	if ( (ProsorinoKommati.CompareTo("Black Queen")==1)&&(ProsorinoKommati.CompareTo("Black Rook")==1)&&(ProsorinoKommati.CompareTo("Black Knight")==1)&&(ProsorinoKommati.CompareTo("Black Bishop")==1)&&(ProsorinoKommati.CompareTo("Black Pawn")==1)&&(DangerForMate == true)&&((StartingBlackKingColumn - 1 - 1)>=0) )
	{
		
		// (Προσωρινή) μετακίνηση του βασιλιά και έλεγχος του αν συνεχίζει τότε να υπάρχει σαχ.

		BMSkakiera[(StartingBlackKingColumn - 1),(StartingBlackKingRank - 1)] = "";
		BMSkakiera[(StartingBlackKingColumn - 1 - 1),(StartingBlackKingRank - 1)] = MovingPiece;
		BlackKingCheck = CheckForBlackCheck(BMSkakiera);

		if (BlackKingCheck == false)
			DangerForMate = false;

		// Επαναφορά της σκακιέρας στην κατάσταση στην οποία βρισκόταν πριν μετακινηθεί ο βασιλιάς για τους
		// σκοπούς του ελέγχου.

		BMSkakiera[(StartingBlackKingColumn - 1),(StartingBlackKingRank - 1)] = MovingPiece;
		BMSkakiera[(StartingBlackKingColumn - 1 - 1),(StartingBlackKingRank - 1)] = ProsorinoKommati;

	}

	}


	///////////////////////////////////////////////////////////////////////////////////////////////////////////////
	// Έλεγχος του αν θα συνεχίσει να υπάρχει σαχ αν ο μαύρος βασιλιάς προσπαθήσει να διαφύγει μετακινούμενος
	// προς τα πάνω-αριστερά
	///////////////////////////////////////////////////////////////////////////////////////////////////////////////

	if ((StartingBlackKingColumn > 1)&&(StartingBlackKingRank < 8))
	{

	MovingPiece = BMSkakiera[(StartingBlackKingColumn - 1),(StartingBlackKingRank - 1)];
	ProsorinoKommati = BMSkakiera[(StartingBlackKingColumn - 1 - 1),(StartingBlackKingRank - 1 + 1)];

	if ( (ProsorinoKommati.CompareTo("Black Queen")==1)&&(ProsorinoKommati.CompareTo("Black Rook")==1)&&(ProsorinoKommati.CompareTo("Black Knight")==1)&&(ProsorinoKommati.CompareTo("Black Bishop")==1)&&(ProsorinoKommati.CompareTo("Black Pawn")==1)&&(DangerForMate == true)&&((StartingBlackKingRank - 1 + 1)<=7)&&((StartingBlackKingColumn - 1 - 1)>=0) )
	{
		
		// (Προσωρινή) μετακίνηση του βασιλιά και έλεγχος του αν συνεχίζει τότε να υπάρχει σαχ.

		BMSkakiera[(StartingBlackKingColumn - 1),(StartingBlackKingRank - 1)] = "";
		BMSkakiera[(StartingBlackKingColumn - 1 - 1),(StartingBlackKingRank - 1 + 1)] = MovingPiece;
		BlackKingCheck = CheckForBlackCheck(BMSkakiera);

		if (BlackKingCheck == false)
			DangerForMate = false;

		// Επαναφορά της σκακιέρας στην κατάσταση στην οποία βρισκόταν πριν μετακινηθεί ο βασιλιάς για τους
		// σκοπούς του ελέγχου.

		BMSkakiera[(StartingBlackKingColumn - 1),(StartingBlackKingRank - 1)] = MovingPiece;
		BMSkakiera[(StartingBlackKingColumn - 1 - 1),(StartingBlackKingRank - 1 + 1)] = ProsorinoKommati;

	}

	}

	if (DangerForMate == true)
		Mate = true;

	}

	return Mate;
	}





	
public static bool CheckForWhiteCheck(string[,] WCSkakiera)               
{
                                       
													          
	// TODO: Add your control notification handler code here

	bool KingCheck;

	///////////////////////////////////////////////////////////////////////////////////////////////////////////////
	// Εύρεση των συντεταγμένων του βασιλιά.
	// Αν σε κάποιο τετράγωνο βρεθεί ότι υπάρχει ένας βασιλιάς, τότε απλά καταγράφεται η τιμή του εν λόγω
	// τετραγώνου στις αντίστοιχες μεταβλητές που δηλώνουν τη στήλη και τη γραμμή στην οποία υπάρχει λευκός
	// βασιλιάς.
	// ΠΡΟΣΟΧΗ: Γράφω (i+1) αντί για i και (j+1) αντί για j γιατί το πρώτο στοιχείο του πίνακα WCWCSkakiera[(8),(8)]
	// είναι το WCSkakiera[(0),(0)] και ΟΧΙ το WCSkakiera[(1),(1)]!
	///////////////////////////////////////////////////////////////////////////////////////////////////////////////

	for (i = 0; i <= 7; i++)
	{
		for (j = 0; j <= 7; j++)
		{
			
			if (WCSkakiera[(i),(j)].CompareTo("White King") == 0)
			{
				WhiteKingColumn = (i+1);
				WhiteKingRank = (j+1);
			}

		}
	}

	///////////////////////////////////////////////////////////////
	// Έλεγχος του αν ο λευκός βασιλιάς υφίσταται "σαχ"
	///////////////////////////////////////////////////////////////

	KingCheck = false;

	////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	// Ελέγχουμε αρχικά αν υπάρχει κίνδυνος για το λευκό βασιλιά ΑΠΟ ΤΑ ΔΕΞΙΑ ΤΟΥ. Για να μην βγούμε έξω από τα
	// όρια της WCSkakiera[(8),(8)] έχουμε προσθέσει τον έλεγχο (WhiteKingColumn + 1) <= 8 στο "if". Αρχικά ο "κίνδυνος"
	// από τα "δεξιά" είναι υπαρκτός, άρα DangerFromRight = true. Ωστόσο αν βρεθεί ότι στα δεξιά του λευκού βασι-
	// λιά υπάρχει κάποιο λευκό κομμάτι, τότε δεν είναι δυνατόν ο εν λόγω βασιλιάς να υφίσταται σαχ από τα δεξιά
	// του (αφού θα "προστατεύεται" από το κομμάτι ιδίου χρώματος), οπότε η DangerFromRight = false και ο έλεγχος
	// για απειλές από τα δεξιά σταματάει (για αυτό και έχω προσθέσει την προϋπόθεση (DangerFromRight == true) στα
	// "if" που κάνουν αυτόν τον έλεγχο).
	// Αν όμως δεν υπάρχει κανένα λευκό κομμάτι δεξιά του βασιλιά για να τον προστατεύει, τότε συνεχίζει να
	// υπάρχει πιθανότητα να απειλείται ο βασιλιάς από τα δεξιά του, οπότε ο έλεγχος συνεχίζεται.
	// Σημείωση: Ο έλεγχος γίνεται για πιθανό σαχ από πύργο ή βασίλισσα αντίθετου χρώματος.
	////////////////////////////////////////////////////////////////////////////////////////////////////////////////

	DangerFromRight = true;

	for(int klopa = 1; klopa<=7;klopa++)
	{
	if ( ((WhiteKingColumn + klopa) <= 8) && (DangerFromRight == true) )
	{
		if ((WCSkakiera[(WhiteKingColumn + klopa - 1),(WhiteKingRank - 1)].CompareTo("Black Rook") == 0)||(WCSkakiera[(WhiteKingColumn + klopa - 1),(WhiteKingRank - 1)].CompareTo("Black Queen") == 0))
			KingCheck = true;
		else if ((WCSkakiera[(WhiteKingColumn + klopa - 1),(WhiteKingRank - 1)].CompareTo("White Pawn") == 0)||(WCSkakiera[(WhiteKingColumn + klopa - 1),(WhiteKingRank - 1)].CompareTo("White Rook") == 0)||(WCSkakiera[(WhiteKingColumn + klopa - 1),(WhiteKingRank - 1)].CompareTo("White Knight") == 0)||(WCSkakiera[(WhiteKingColumn + klopa - 1),(WhiteKingRank - 1)].CompareTo("White Bishop") == 0)||(WCSkakiera[(WhiteKingColumn + klopa - 1),(WhiteKingRank - 1)].CompareTo("White Queen") == 0))
			DangerFromRight = false;
		else if ((WCSkakiera[(WhiteKingColumn + klopa - 1),(WhiteKingRank - 1)].CompareTo("Black Pawn") == 0)||(WCSkakiera[(WhiteKingColumn + klopa - 1),(WhiteKingRank - 1)].CompareTo("Black Knight") == 0)||(WCSkakiera[(WhiteKingColumn + klopa - 1),(WhiteKingRank - 1)].CompareTo("Black Bishop") == 0)||(WCSkakiera[(WhiteKingColumn + klopa - 1),(WhiteKingRank - 1)].CompareTo("Black King") == 0))
			DangerFromRight = false;
	}
	}


	///////////////////////////////////////////////////////////////////////////////////////////////////////
	// Έλεγχος αν υπάρχει κίνδυνος για το λευκό βασιλιά ΑΠΟ ΤΑ ΑΡΙΣΤΕΡΑ ΤΟΥ (από πύργο ή βασίλισσα).
	///////////////////////////////////////////////////////////////////////////////////////////////////////

	DangerFromLeft = true;

	for(int klopa = 1; klopa<=7;klopa++)
	{
	if ( ((WhiteKingColumn - klopa) >= 1) && (DangerFromLeft == true) )
	{
		if ((WCSkakiera[(WhiteKingColumn - klopa - 1),(WhiteKingRank - 1)].CompareTo("Black Rook") == 0)||(WCSkakiera[(WhiteKingColumn - klopa - 1),(WhiteKingRank - 1)].CompareTo("Black Queen") == 0))
			KingCheck = true;
		else if ((WCSkakiera[(WhiteKingColumn - klopa - 1),(WhiteKingRank - 1)].CompareTo("White Pawn") == 0)||(WCSkakiera[(WhiteKingColumn - klopa - 1),(WhiteKingRank - 1)].CompareTo("White Rook") == 0)||(WCSkakiera[(WhiteKingColumn - klopa - 1),(WhiteKingRank - 1)].CompareTo("White Knight") == 0)||(WCSkakiera[(WhiteKingColumn - klopa - 1),(WhiteKingRank - 1)].CompareTo("White Bishop") == 0)||(WCSkakiera[(WhiteKingColumn - klopa - 1),(WhiteKingRank - 1)].CompareTo("White Queen") == 0))
			DangerFromLeft = false;
		else if ((WCSkakiera[(WhiteKingColumn - klopa - 1),(WhiteKingRank - 1)].CompareTo("Black Pawn") == 0)||(WCSkakiera[(WhiteKingColumn - klopa - 1),(WhiteKingRank - 1)].CompareTo("Black Knight") == 0)||(WCSkakiera[(WhiteKingColumn - klopa - 1),(WhiteKingRank - 1)].CompareTo("Black Bishop") == 0)||(WCSkakiera[(WhiteKingColumn - klopa - 1),(WhiteKingRank - 1)].CompareTo("Black King") == 0))
			DangerFromLeft = false;
	}
	}


	///////////////////////////////////////////////////////////////////////////////////////////////////////
	// Έλεγχος αν υπάρχει κίνδυνος για το λευκό βασιλιά ΑΠΟ ΠΑΝΩ (από πύργο ή βασίλισσα).
	///////////////////////////////////////////////////////////////////////////////////////////////////////


	DangerFromUp = true;

	for(int klopa = 1; klopa<=7;klopa++)
	{
	if ( ((WhiteKingRank + klopa) <= 8) && (DangerFromUp == true) )
	{
		if ((WCSkakiera[(WhiteKingColumn - 1),(WhiteKingRank + klopa- 1)].CompareTo("Black Rook") == 0)||(WCSkakiera[(WhiteKingColumn - 1),(WhiteKingRank + klopa- 1)].CompareTo("Black Queen") == 0))
			KingCheck = true;
		else if ((WCSkakiera[(WhiteKingColumn - 1),(WhiteKingRank + klopa- 1)].CompareTo("White Pawn") == 0)||(WCSkakiera[(WhiteKingColumn - 1),(WhiteKingRank + klopa- 1)].CompareTo("White Rook") == 0)||(WCSkakiera[(WhiteKingColumn - 1),(WhiteKingRank + klopa- 1)].CompareTo("White Knight") == 0)||(WCSkakiera[(WhiteKingColumn - 1),(WhiteKingRank + klopa- 1)].CompareTo("White Bishop") == 0)||(WCSkakiera[(WhiteKingColumn - 1),(WhiteKingRank + klopa- 1)].CompareTo("White Queen") == 0))
			DangerFromUp = false;
		else if ((WCSkakiera[(WhiteKingColumn - 1),(WhiteKingRank + klopa - 1)].CompareTo("Black Pawn") == 0)||(WCSkakiera[(WhiteKingColumn - 1),(WhiteKingRank + klopa - 1)].CompareTo("Black Knight") == 0)||(WCSkakiera[(WhiteKingColumn - 1),(WhiteKingRank + klopa - 1)].CompareTo("Black Bishop") == 0)||(WCSkakiera[(WhiteKingColumn - 1),(WhiteKingRank + klopa - 1)].CompareTo("Black King") == 0))
			DangerFromUp = false;
	}
	}


	///////////////////////////////////////////////////////////////////////////////////////////////////////
	// Έλεγχος αν υπάρχει κίνδυνος για το λευκό βασιλιά ΑΠΟ ΚΑΤΩ (από πύργο ή βασίλισσα).
	///////////////////////////////////////////////////////////////////////////////////////////////////////

	DangerFromDown = true;

	for(int klopa = 1; klopa<=7;klopa++)
	{
	if ( ((WhiteKingRank - klopa) >= 1) && (DangerFromDown == true) )
	{
		if ((WCSkakiera[(WhiteKingColumn - 1),(WhiteKingRank - klopa- 1)].CompareTo("Black Rook") == 0)||(WCSkakiera[(WhiteKingColumn - 1),(WhiteKingRank - klopa- 1)].CompareTo("Black Queen") == 0))
			KingCheck = true;
		else if ((WCSkakiera[(WhiteKingColumn - 1),(WhiteKingRank - klopa- 1)].CompareTo("White Pawn") == 0)||(WCSkakiera[(WhiteKingColumn - 1),(WhiteKingRank - klopa- 1)].CompareTo("White Rook") == 0)||(WCSkakiera[(WhiteKingColumn - 1),(WhiteKingRank - klopa- 1)].CompareTo("White Knight") == 0)||(WCSkakiera[(WhiteKingColumn - 1),(WhiteKingRank - klopa- 1)].CompareTo("White Bishop") == 0)||(WCSkakiera[(WhiteKingColumn - 1),(WhiteKingRank - klopa- 1)].CompareTo("White Queen") == 0))
			DangerFromDown = false;
		else if ((WCSkakiera[(WhiteKingColumn - 1),(WhiteKingRank - klopa - 1)].CompareTo("Black Pawn") == 0)||(WCSkakiera[(WhiteKingColumn - 1),(WhiteKingRank - klopa - 1)].CompareTo("Black Knight") == 0)||(WCSkakiera[(WhiteKingColumn - 1),(WhiteKingRank - klopa - 1)].CompareTo("Black Bishop") == 0)||(WCSkakiera[(WhiteKingColumn - 1),(WhiteKingRank - klopa - 1)].CompareTo("Black King") == 0))
			DangerFromDown = false;
	}
	}


	////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	// Έλεγχος αν υπάρχει κίνδυνος για το λευκό βασιλιά ΑΠΟ ΠΑΝΩ-ΔΕΞΙΑ ΤΟΥ (από βασίλισσα ή αξιωματικό).
	////////////////////////////////////////////////////////////////////////////////////////////////////////////////

	DangerFromUpRight = true;

	for(int klopa = 1; klopa<=7;klopa++)
	{
	if ( ((WhiteKingColumn + klopa) <= 8) && ((WhiteKingRank + klopa) <= 8) && (DangerFromUpRight == true) )
	{
		if ((WCSkakiera[(WhiteKingColumn + klopa - 1),(WhiteKingRank + klopa - 1)].CompareTo("Black Bishop") == 0)||(WCSkakiera[(WhiteKingColumn + klopa - 1),(WhiteKingRank + klopa - 1)].CompareTo("Black Queen") == 0))
			KingCheck = true;
		else if ((WCSkakiera[(WhiteKingColumn + klopa - 1),(WhiteKingRank + klopa - 1)].CompareTo("White Pawn") == 0)||(WCSkakiera[(WhiteKingColumn + klopa - 1),(WhiteKingRank + klopa - 1)].CompareTo("White Rook") == 0)||(WCSkakiera[(WhiteKingColumn + klopa - 1),(WhiteKingRank + klopa - 1)].CompareTo("White Knight") == 0)||(WCSkakiera[(WhiteKingColumn + klopa - 1),(WhiteKingRank + klopa - 1)].CompareTo("White Bishop") == 0)||(WCSkakiera[(WhiteKingColumn + klopa - 1),(WhiteKingRank + klopa - 1)].CompareTo("White Queen") == 0))
			DangerFromUpRight = false;
		else if ((WCSkakiera[(WhiteKingColumn + klopa - 1),(WhiteKingRank + klopa - 1)].CompareTo("Black Pawn") == 0)||(WCSkakiera[(WhiteKingColumn + klopa - 1),(WhiteKingRank + klopa - 1)].CompareTo("Black Rook") == 0)||(WCSkakiera[(WhiteKingColumn + klopa - 1),(WhiteKingRank + klopa - 1)].CompareTo("Black Knight") == 0)||(WCSkakiera[(WhiteKingColumn + klopa - 1),(WhiteKingRank + klopa - 1)].CompareTo("Black King") == 0))
			DangerFromUpRight = false;
	}
	}


	////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	// Έλεγχος αν υπάρχει κίνδυνος για το λευκό βασιλιά ΑΠΟ ΚΑΤΩ-ΑΡΙΣΤΕΡΑ ΤΟΥ (από βασίλισσα ή αξιωματικό).
	////////////////////////////////////////////////////////////////////////////////////////////////////////////////

	DangerFromDownLeft = true;

	for(int klopa = 1; klopa<=7;klopa++)
	{
	if ( ((WhiteKingColumn - klopa) >= 1) && ((WhiteKingRank - klopa) >= 1) && (DangerFromDownLeft == true) )
	{
		if ((WCSkakiera[(WhiteKingColumn - klopa - 1),(WhiteKingRank - klopa - 1)].CompareTo("Black Bishop") == 0)||(WCSkakiera[(WhiteKingColumn - klopa - 1),(WhiteKingRank - klopa - 1)].CompareTo("Black Queen") == 0))
			KingCheck = true;
		else if ((WCSkakiera[(WhiteKingColumn - klopa - 1),(WhiteKingRank - klopa - 1)].CompareTo("White Pawn") == 0)||(WCSkakiera[(WhiteKingColumn - klopa - 1),(WhiteKingRank - klopa - 1)].CompareTo("White Rook") == 0)||(WCSkakiera[(WhiteKingColumn - klopa - 1),(WhiteKingRank - klopa - 1)].CompareTo("White Knight") == 0)||(WCSkakiera[(WhiteKingColumn - klopa - 1),(WhiteKingRank - klopa - 1)].CompareTo("White Bishop") == 0)||(WCSkakiera[(WhiteKingColumn - klopa - 1),(WhiteKingRank - klopa - 1)].CompareTo("White Queen") == 0))
			DangerFromDownLeft = false;
		else if ((WCSkakiera[(WhiteKingColumn - klopa - 1),(WhiteKingRank - klopa - 1)].CompareTo("Black Pawn") == 0)||(WCSkakiera[(WhiteKingColumn - klopa - 1),(WhiteKingRank - klopa - 1)].CompareTo("Black Rook") == 0)||(WCSkakiera[(WhiteKingColumn - klopa - 1),(WhiteKingRank - klopa - 1)].CompareTo("Black Knight") == 0)||(WCSkakiera[(WhiteKingColumn - klopa - 1),(WhiteKingRank - klopa - 1)].CompareTo("Black King") == 0))
			DangerFromDownLeft = false;
	}
	}

	////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	// Έλεγχος αν υπάρχει κίνδυνος για το λευκό βασιλιά ΑΠΟ ΚΑΤΩ-ΔΕΞΙΑ ΤΟΥ (από βασίλισσα ή αξιωματικό).
	////////////////////////////////////////////////////////////////////////////////////////////////////////////////

	DangerFromDownRight = true;

	for(int klopa = 1; klopa<=7;klopa++)
	{
	if ( ((WhiteKingColumn + klopa) <= 8) && ((WhiteKingRank - klopa) >= 1) && (DangerFromDownRight == true) )
	{
		if ((WCSkakiera[(WhiteKingColumn + klopa - 1),(WhiteKingRank - klopa - 1)].CompareTo("Black Bishop") == 0)||(WCSkakiera[(WhiteKingColumn + klopa - 1),(WhiteKingRank - klopa - 1)].CompareTo("Black Queen") == 0))
			KingCheck = true;
		else if ((WCSkakiera[(WhiteKingColumn + klopa - 1),(WhiteKingRank - klopa - 1)].CompareTo("White Pawn") == 0)||(WCSkakiera[(WhiteKingColumn + klopa - 1),(WhiteKingRank - klopa - 1)].CompareTo("White Rook") == 0)||(WCSkakiera[(WhiteKingColumn + klopa - 1),(WhiteKingRank - klopa - 1)].CompareTo("White Knight") == 0)||(WCSkakiera[(WhiteKingColumn + klopa - 1),(WhiteKingRank - klopa - 1)].CompareTo("White Bishop") == 0)||(WCSkakiera[(WhiteKingColumn + klopa - 1),(WhiteKingRank - klopa - 1)].CompareTo("White Queen") == 0))
			DangerFromDownRight = false;
		else if ((WCSkakiera[(WhiteKingColumn + klopa - 1),(WhiteKingRank - klopa - 1)].CompareTo("Black Pawn") == 0)||(WCSkakiera[(WhiteKingColumn + klopa - 1),(WhiteKingRank - klopa - 1)].CompareTo("Black Rook") == 0)||(WCSkakiera[(WhiteKingColumn + klopa - 1),(WhiteKingRank - klopa - 1)].CompareTo("Black Knight") == 0)||(WCSkakiera[(WhiteKingColumn + klopa - 1),(WhiteKingRank - klopa - 1)].CompareTo("Black King") == 0))
			DangerFromDownRight = false;
	}
	}


	////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	// Έλεγχος αν υπάρχει κίνδυνος για το λευκό βασιλιά ΑΠΟ ΠΑΝΩ-ΑΡΙΣΤΕΡΑ ΤΟΥ (από βασίλισσα ή αξιωματικό).
	////////////////////////////////////////////////////////////////////////////////////////////////////////////////

	DangerFromUpLeft = true;

	for(int klopa = 1; klopa<=7;klopa++)
	{
	if ( ((WhiteKingColumn - klopa) >= 1) && ((WhiteKingRank + klopa) <= 8) && (DangerFromUpLeft == true) )
	{
		if ((WCSkakiera[(WhiteKingColumn - klopa - 1),(WhiteKingRank + klopa - 1)].CompareTo("Black Bishop") == 0)||(WCSkakiera[(WhiteKingColumn - klopa - 1),(WhiteKingRank + klopa - 1)].CompareTo("Black Queen") == 0))
			KingCheck = true;
		else if ((WCSkakiera[(WhiteKingColumn - klopa - 1),(WhiteKingRank + klopa - 1)].CompareTo("White Pawn") == 0)||(WCSkakiera[(WhiteKingColumn - klopa - 1),(WhiteKingRank + klopa - 1)].CompareTo("White Rook") == 0)||(WCSkakiera[(WhiteKingColumn - klopa - 1),(WhiteKingRank + klopa - 1)].CompareTo("White Knight") == 0)||(WCSkakiera[(WhiteKingColumn - klopa - 1),(WhiteKingRank + klopa - 1)].CompareTo("White Bishop") == 0)||(WCSkakiera[(WhiteKingColumn - klopa - 1),(WhiteKingRank + klopa - 1)].CompareTo("White Queen") == 0))
			DangerFromUpLeft = false;
		else if ((WCSkakiera[(WhiteKingColumn - klopa - 1),(WhiteKingRank + klopa - 1)].CompareTo("Black Pawn") == 0)||(WCSkakiera[(WhiteKingColumn - klopa - 1),(WhiteKingRank + klopa - 1)].CompareTo("Black Rook") == 0)||(WCSkakiera[(WhiteKingColumn - klopa - 1),(WhiteKingRank + klopa - 1)].CompareTo("Black Knight") == 0)||(WCSkakiera[(WhiteKingColumn - klopa - 1),(WhiteKingRank + klopa - 1)].CompareTo("Black King") == 0))
			DangerFromUpLeft = false;
	}
	}



	//////////////////////////////////////////////////////////////////////////
	// Έλεγχος για το αν ο λευκός βασιλιάς απειλείται από πιόνι.
	//////////////////////////////////////////////////////////////////////////

	if (((WhiteKingColumn + 1) <= 8) && ((WhiteKingRank + 1) <= 8))
	{
		if (WCSkakiera[(WhiteKingColumn + 1 - 1),(WhiteKingRank + 1 - 1)].CompareTo("Black Pawn") == 0)
		{
			KingCheck = true;
		}
	}


	if (((WhiteKingColumn - 1) >= 1) && ((WhiteKingRank + 1) <= 8))
	{
		if (WCSkakiera[(WhiteKingColumn - 1 - 1),(WhiteKingRank + 1 - 1)].CompareTo("Black Pawn") == 0)
		{
			KingCheck = true;
		}
	}


	///////////////////////////////////////////////////////////////////////
	// Έλεγχος για το αν ο λευκός βασιλιάς απειλείται από ίππο.
	///////////////////////////////////////////////////////////////////////
	
	if (((WhiteKingColumn + 1) <= 8) && ((WhiteKingRank + 2) <= 8))
        if (WCSkakiera[(WhiteKingColumn + 1 - 1),(WhiteKingRank + 2 - 1)].CompareTo("Black Knight") == 0)
			KingCheck = true;
	
	if (((WhiteKingColumn + 2) <= 8) && ((WhiteKingRank - 1) >= 1))
		if (WCSkakiera[(WhiteKingColumn + 2 - 1),(WhiteKingRank - 1 - 1)].CompareTo("Black Knight") == 0)
			KingCheck = true;
	
	if (((WhiteKingColumn + 1) <= 8) && ((WhiteKingRank - 2) >= 1))
		if (WCSkakiera[(WhiteKingColumn + 1 - 1),(WhiteKingRank - 2 - 1)].CompareTo("Black Knight") == 0)
			KingCheck = true;

	if (((WhiteKingColumn - 1) >= 1) && ((WhiteKingRank - 2) >= 1))
		if (WCSkakiera[(WhiteKingColumn - 1 - 1),(WhiteKingRank - 2 - 1)].CompareTo("Black Knight") == 0)
			KingCheck = true;

	if (((WhiteKingColumn - 2) >= 1) && ((WhiteKingRank - 1) >= 1))
		if (WCSkakiera[(WhiteKingColumn - 2 - 1),(WhiteKingRank - 1 - 1)].CompareTo("Black Knight") == 0)
			KingCheck = true;

	if (((WhiteKingColumn - 2) >= 1) && ((WhiteKingRank + 1) <= 8))
		if (WCSkakiera[(WhiteKingColumn - 2 - 1),(WhiteKingRank + 1 - 1)].CompareTo("Black Knight") == 0)
			KingCheck = true;

	if (((WhiteKingColumn - 1) >= 1) && ((WhiteKingRank + 2) <= 8))
		if (WCSkakiera[(WhiteKingColumn - 1 - 1),(WhiteKingRank + 2 - 1)].CompareTo("Black Knight") == 0)
			KingCheck = true;

	if (((WhiteKingColumn + 2) <= 8) && ((WhiteKingRank + 1) <= 8))
		if (WCSkakiera[(WhiteKingColumn + 2 - 1),(WhiteKingRank + 1 - 1)].CompareTo("Black Knight") == 0)
			KingCheck = true;

	return KingCheck;
	}



	
public static bool CheckForWhiteMate(string[,]  WMSkakiera)                   
	{                         
	// TODO: Add your control notification handler code here

	bool Mate;

	/////////////////////////////////////////////////////////////////////////////////////////////////////////
	// Μεταβλητή που χρησιμεύει στον έλεγχο για το αν υπάρχει ματ (βλ. συναρτήσεις CheckForWhiteMate() και
	// CheckForBlackMate()).
	// Αναλυτικότερα, το πρόγραμμα ελέγχει αν αρχικά υπάρχει σαχ και, αν υπάρχει, ελέγχει αν αυτό το
	// σαχ μπορεί να αποφευχθεί με τη μετακίνηση του υπό απειλή βασιλιά σε κάποιο γειτονικό τετράγωνο.
	// Η μεταβλητή καταγράφει το αν συνεχίζει να υπάρχει πιθανότητα να υπάρχει ματ στη σκακιέρα.
	/////////////////////////////////////////////////////////////////////////////////////////////////////////

	bool DangerForMate;

	////////////////////////////////////////////////////////////
	// Έλεγχος του αν υπάρχει "ματ" στον λευκό βασιλιά
	////////////////////////////////////////////////////////////

	Mate = false;
	DangerForMate = true;    // Αρχικά, προφανώς υπάρχει πιθανότητα να υπάρχει ματ στη σκακιέρα.
	                         // Αν, ωστόσο, κάποια στιγμή βρεθεί ότι αν ο βασιλιάς μπορεί να μετακινηθεί
						     // σε ένα διπλανό τετράγωνο και να πάψει να υφίσταται σαχ, τότε παύει να
							 // υπάρχει πιθανότητα να υπάρχει ματ (προφανώς) και η μεταβλητή παίρνει την
							 // τιμή false.


	//////////////////////////////////////////////////////////////
	// Εύρεση των αρχικών συντεταγμένων του βασιλιά
	//////////////////////////////////////////////////////////////

	for (i = 0; i <= 7; i++)
	{
		for (j = 0; j <= 7; j++)
		{
			
			if (WMSkakiera[(i),(j)].CompareTo("White King") == 0)
			{
				StartingWhiteKingColumn = (i+1);
				StartingWhiteKingRank = (j+1);
			}

		}
	}


	//////////////////////////////////////////////////
	// Έλεγχος αν ο λευκός βασιλιάς είναι ματ
	//////////////////////////////////////////////////


	if (m_WhichColorPlays.CompareTo("White") == 0)
	{

	////////////////////////////////////////////////
	// Έλεγχος αν υπάρχει σαχ αυτή τη στιγμή
	////////////////////////////////////////////////

	WhiteKingCheck = CheckForWhiteCheck(WMSkakiera);

	if ( WhiteKingCheck == false )     // Αν αυτή τη στιγμή δεν υφίσταται σαχ, τότε να μη συνεχιστεί ο έλεγχος
		DangerForMate = false;         // καθώς ΔΕΝ συνεχίζει να υφίσταται πιθανότητα να υπάρχει ματ.

	///////////////////////////////////////////////////////////////////////////////////////////////////////////////
	// Έλεγχος του αν θα συνεχίσει να υπάρχει σαχ αν ο λευκός βασιλιάς προσπαθήσει να διαφύγει μετακινούμενος
	// προς τα πάνω
	///////////////////////////////////////////////////////////////////////////////////////////////////////////////

	if (StartingWhiteKingRank < 8)
	{

	MovingPiece = WMSkakiera[(StartingWhiteKingColumn - 1),(StartingWhiteKingRank - 1)];
	ProsorinoKommati = WMSkakiera[(StartingWhiteKingColumn - 1),(StartingWhiteKingRank - 1 + 1)];

	if ( (ProsorinoKommati.CompareTo("White Queen")==1)&&(ProsorinoKommati.CompareTo("White Rook")==1)&&(ProsorinoKommati.CompareTo("White Knight")==1)&&(ProsorinoKommati.CompareTo("White Bishop")==1)&&(ProsorinoKommati.CompareTo("White Pawn")==1)&&(DangerForMate == true)&&((StartingWhiteKingRank - 1 + 1)<=7) )
	{
	
	// (Προσωρινή) μετακίνηση του βασιλιά προς τα πάνω και έλεγχος του αν συνεχίζει τότε να υπάρχει σαχ.
	// Ο έλεγχος γίνεται μόνο αν στο τετράγωνο που μετακινείται προσωρινά ο βασιλιάς δεν υπάρχει άλλο κομμάτι
	// του ίδιου χρώματος που να τον εμποδίζει και αν, φυσικά, ο βασιλιάς δεν βγαίνει έξω από τη σκακιέρα με
	// αυτή του την κίνηση και αν, προφανώς, συνεχίζει να υπάρχει πιθανότητα να ύπάρχει ματ (καθώς αν δεν
	// υπάρχει τέτοια πιθανότητα, τότε ο έλεγχος είναι άχρηστος).
		
		WMSkakiera[(StartingWhiteKingColumn - 1),(StartingWhiteKingRank - 1)] = "";
		WMSkakiera[(StartingWhiteKingColumn - 1),(StartingWhiteKingRank - 1 + 1)] = MovingPiece;
		WhiteKingCheck = CheckForWhiteCheck(WMSkakiera);

		if (WhiteKingCheck == false)
			DangerForMate = false;

		// Επαναφορά της σκακιέρας στην κατάσταση στην οποία βρισκόταν πριν μετακινηθεί ο βασιλιάς για τους
		// σκοπούς του ελέγχου.

		WMSkakiera[(StartingWhiteKingColumn - 1),(StartingWhiteKingRank - 1)] = MovingPiece;
		WMSkakiera[(StartingWhiteKingColumn - 1),(StartingWhiteKingRank - 1 + 1)] = ProsorinoKommati;

	}

	}

	
	///////////////////////////////////////////////////////////////////////////////////////////////////////////////
	// Έλεγχος του αν θα συνεχίσει να υπάρχει σαχ αν ο λευκός βασιλιάς προσπαθήσει να διαφύγει μετακινούμενος
	// προς τα πάνω-δεξιά
	///////////////////////////////////////////////////////////////////////////////////////////////////////////////

	if ((StartingWhiteKingColumn < 8)&&(StartingWhiteKingRank < 8))
	{

	MovingPiece = WMSkakiera[(StartingWhiteKingColumn - 1),(StartingWhiteKingRank - 1)];
	ProsorinoKommati = WMSkakiera[(StartingWhiteKingColumn - 1 + 1),(StartingWhiteKingRank - 1 + 1)];

	if ( (ProsorinoKommati.CompareTo("White Queen")==1)&&(ProsorinoKommati.CompareTo("White Rook")==1)&&(ProsorinoKommati.CompareTo("White Knight")==1)&&(ProsorinoKommati.CompareTo("White Bishop")==1)&&(ProsorinoKommati.CompareTo("White Pawn")==1)&&(DangerForMate == true)&&((StartingWhiteKingRank - 1 + 1)<=7)&&((StartingWhiteKingColumn - 1 + 1)<=7) )
	{
		
		// (Προσωρινή) μετακίνηση του βασιλιά και έλεγχος του αν συνεχίζει τότε να υπάρχει σαχ.

		WMSkakiera[(StartingWhiteKingColumn - 1),(StartingWhiteKingRank - 1)] = "";
		WMSkakiera[(StartingWhiteKingColumn - 1 + 1),(StartingWhiteKingRank - 1 + 1)] = MovingPiece;
		WhiteKingCheck = CheckForWhiteCheck(WMSkakiera);

		if (WhiteKingCheck == false)
			DangerForMate = false;

		// Επαναφορά της σκακιέρας στην κατάσταση στην οποία βρισκόταν πριν μετακινηθεί ο βασιλιάς για τους
		// σκοπούς του ελέγχου.

		WMSkakiera[(StartingWhiteKingColumn - 1),(StartingWhiteKingRank - 1)] = MovingPiece;
		WMSkakiera[(StartingWhiteKingColumn - 1 + 1),(StartingWhiteKingRank - 1 + 1)] = ProsorinoKommati;

	}

	}


	///////////////////////////////////////////////////////////////////////////////////////////////////////////////
	// Έλεγχος του αν θα συνεχίσει να υπάρχει σαχ αν ο λευκός βασιλιάς προσπαθήσει να διαφύγει μετακινούμενος
	// προς τα δεξιά
	///////////////////////////////////////////////////////////////////////////////////////////////////////////////

	if (StartingWhiteKingColumn < 8)
	{

	MovingPiece = WMSkakiera[(StartingWhiteKingColumn - 1),(StartingWhiteKingRank - 1)];
	ProsorinoKommati = WMSkakiera[(StartingWhiteKingColumn - 1 + 1),(StartingWhiteKingRank - 1)];

	if ( (ProsorinoKommati.CompareTo("White Queen")==1)&&(ProsorinoKommati.CompareTo("White Rook")==1)&&(ProsorinoKommati.CompareTo("White Knight")==1)&&(ProsorinoKommati.CompareTo("White Bishop")==1)&&(ProsorinoKommati.CompareTo("White Pawn")==1)&&(DangerForMate == true)&&((StartingWhiteKingColumn - 1 + 1)<=7) )
	{
		
		// (Προσωρινή) μετακίνηση του βασιλιά και έλεγχος του αν συνεχίζει τότε να υπάρχει σαχ.

		WMSkakiera[(StartingWhiteKingColumn - 1),(StartingWhiteKingRank - 1)] = "";
		WMSkakiera[(StartingWhiteKingColumn - 1 + 1),(StartingWhiteKingRank - 1)] = MovingPiece;
		WhiteKingCheck = CheckForWhiteCheck(WMSkakiera);

		if (WhiteKingCheck == false)
			DangerForMate = false;

		// Επαναφορά της σκακιέρας στην κατάσταση στην οποία βρισκόταν πριν μετακινηθεί ο βασιλιάς για τους
		// σκοπούς του ελέγχου.

		WMSkakiera[(StartingWhiteKingColumn - 1),(StartingWhiteKingRank - 1)] = MovingPiece;
		WMSkakiera[(StartingWhiteKingColumn - 1 + 1),(StartingWhiteKingRank - 1)] = ProsorinoKommati;

	}

	}


	///////////////////////////////////////////////////////////////////////////////////////////////////////////////
	// Έλεγχος του αν θα συνεχίσει να υπάρχει σαχ αν ο λευκός βασιλιάς προσπαθήσει να διαφύγει μετακινούμενος
	// προς τα κάτω-δεξιά
	///////////////////////////////////////////////////////////////////////////////////////////////////////////////

	if ((StartingWhiteKingColumn < 8)&&(StartingWhiteKingRank > 1))
	{

	MovingPiece = WMSkakiera[(StartingWhiteKingColumn - 1),(StartingWhiteKingRank - 1)];
	ProsorinoKommati = WMSkakiera[(StartingWhiteKingColumn - 1 + 1),(StartingWhiteKingRank - 1 - 1)];

	if ( (ProsorinoKommati.CompareTo("White Queen")==1)&&(ProsorinoKommati.CompareTo("White Rook")==1)&&(ProsorinoKommati.CompareTo("White Knight")==1)&&(ProsorinoKommati.CompareTo("White Bishop")==1)&&(ProsorinoKommati.CompareTo("White Pawn")==1)&&(DangerForMate == true)&&((StartingWhiteKingRank - 1 - 1)>=0)&&((StartingWhiteKingColumn - 1 + 1)<=7) )
	{
		
		// (Προσωρινή) μετακίνηση του βασιλιά και έλεγχος του αν συνεχίζει τότε να υπάρχει σαχ.

		WMSkakiera[(StartingWhiteKingColumn - 1),(StartingWhiteKingRank - 1)] = "";
		WMSkakiera[(StartingWhiteKingColumn - 1 + 1),(StartingWhiteKingRank - 1 - 1)] = MovingPiece;
		WhiteKingCheck = CheckForWhiteCheck(WMSkakiera);

		if (WhiteKingCheck == false)
			DangerForMate = false;

		// Επαναφορά της σκακιέρας στην κατάσταση στην οποία βρισκόταν πριν μετακινηθεί ο βασιλιάς για τους
		// σκοπούς του ελέγχου.

		WMSkakiera[(StartingWhiteKingColumn - 1),(StartingWhiteKingRank - 1)] = MovingPiece;
		WMSkakiera[(StartingWhiteKingColumn - 1 + 1),(StartingWhiteKingRank - 1 - 1)] = ProsorinoKommati;

	}

	}


	///////////////////////////////////////////////////////////////////////////////////////////////////////////////
	// Έλεγχος του αν θα συνεχίσει να υπάρχει σαχ αν ο λευκός βασιλιάς προσπαθήσει να διαφύγει μετακινούμενος
	// προς τα κάτω
	///////////////////////////////////////////////////////////////////////////////////////////////////////////////

	if (StartingWhiteKingRank > 1)
	{

	MovingPiece = WMSkakiera[(StartingWhiteKingColumn - 1),(StartingWhiteKingRank - 1)];
	ProsorinoKommati = WMSkakiera[(StartingWhiteKingColumn - 1),(StartingWhiteKingRank - 1 - 1)];

	if ( (ProsorinoKommati.CompareTo("White Queen")==1)&&(ProsorinoKommati.CompareTo("White Rook")==1)&&(ProsorinoKommati.CompareTo("White Knight")==1)&&(ProsorinoKommati.CompareTo("White Bishop")==1)&&(ProsorinoKommati.CompareTo("White Pawn")==1)&&(DangerForMate == true)&&((StartingWhiteKingRank - 1 - 1)>=0) )
	{
	
		// (Προσωρινή) μετακίνηση του βασιλιά προς τα πάνω και έλεγχος του αν συνεχίζει τότε να υπάρχει σαχ.
		
		WMSkakiera[(StartingWhiteKingColumn - 1),(StartingWhiteKingRank - 1)] = "";
		WMSkakiera[(StartingWhiteKingColumn - 1),(StartingWhiteKingRank - 1 - 1)] = MovingPiece;
		WhiteKingCheck = CheckForWhiteCheck(WMSkakiera);

		if (WhiteKingCheck == false)
			DangerForMate = false;

		// Επαναφορά της σκακιέρας στην κατάσταση στην οποία βρισκόταν πριν μετακινηθεί ο βασιλιάς για τους
		// σκοπούς του ελέγχου.

		WMSkakiera[(StartingWhiteKingColumn - 1),(StartingWhiteKingRank - 1)] = MovingPiece;
		WMSkakiera[(StartingWhiteKingColumn - 1),(StartingWhiteKingRank - 1 - 1)] = ProsorinoKommati;

	}

	}


	///////////////////////////////////////////////////////////////////////////////////////////////////////////////
	// Έλεγχος του αν θα συνεχίσει να υπάρχει σαχ αν ο λευκός βασιλιάς προσπαθήσει να διαφύγει μετακινούμενος
	// προς τα κάτω-αριστερά
	///////////////////////////////////////////////////////////////////////////////////////////////////////////////

	if ((StartingWhiteKingColumn > 1)&&(StartingWhiteKingRank > 1))
	{

	MovingPiece = WMSkakiera[(StartingWhiteKingColumn - 1),(StartingWhiteKingRank - 1)];
	ProsorinoKommati = WMSkakiera[(StartingWhiteKingColumn - 1 - 1),(StartingWhiteKingRank - 1 - 1)];

	if ( (ProsorinoKommati.CompareTo("White Queen")==1)&&(ProsorinoKommati.CompareTo("White Rook")==1)&&(ProsorinoKommati.CompareTo("White Knight")==1)&&(ProsorinoKommati.CompareTo("White Bishop")==1)&&(ProsorinoKommati.CompareTo("White Pawn")==1)&&(DangerForMate == true)&&((StartingWhiteKingRank - 1 - 1)>=0)&&((StartingWhiteKingColumn - 1 - 1)>=0) )
	{
		
		// (Προσωρινή) μετακίνηση του βασιλιά και έλεγχος του αν συνεχίζει τότε να υπάρχει σαχ.

		WMSkakiera[(StartingWhiteKingColumn - 1),(StartingWhiteKingRank - 1)] = "";
		WMSkakiera[(StartingWhiteKingColumn - 1 - 1),(StartingWhiteKingRank - 1 - 1)] = MovingPiece;
		WhiteKingCheck = CheckForWhiteCheck(WMSkakiera);

		if (WhiteKingCheck == false)
			DangerForMate = false;

		// Επαναφορά της σκακιέρας στην κατάσταση στην οποία βρισκόταν πριν μετακινηθεί ο βασιλιάς για τους
		// σκοπούς του ελέγχου.

		WMSkakiera[(StartingWhiteKingColumn - 1),(StartingWhiteKingRank - 1)] = MovingPiece;
		WMSkakiera[(StartingWhiteKingColumn - 1 - 1),(StartingWhiteKingRank - 1 - 1)] = ProsorinoKommati;

	}

	}


	///////////////////////////////////////////////////////////////////////////////////////////////////////////////
	// Έλεγχος του αν θα συνεχίσει να υπάρχει σαχ αν ο λευκός βασιλιάς προσπαθήσει να διαφύγει μετακινούμενος
	// προς τα αριστερά
	///////////////////////////////////////////////////////////////////////////////////////////////////////////////

	if (StartingWhiteKingColumn > 1)
	{

	MovingPiece = WMSkakiera[(StartingWhiteKingColumn - 1),(StartingWhiteKingRank - 1)];
	ProsorinoKommati = WMSkakiera[(StartingWhiteKingColumn - 1 - 1),(StartingWhiteKingRank - 1)];

	if ( (ProsorinoKommati.CompareTo("White Queen")==1)&&(ProsorinoKommati.CompareTo("White Rook")==1)&&(ProsorinoKommati.CompareTo("White Knight")==1)&&(ProsorinoKommati.CompareTo("White Bishop")==1)&&(ProsorinoKommati.CompareTo("White Pawn")==1)&&(DangerForMate == true)&&((StartingWhiteKingColumn - 1 - 1)>=0) )
	{
		
		// (Προσωρινή) μετακίνηση του βασιλιά και έλεγχος του αν συνεχίζει τότε να υπάρχει σαχ.

		WMSkakiera[(StartingWhiteKingColumn - 1),(StartingWhiteKingRank - 1)] = "";
		WMSkakiera[(StartingWhiteKingColumn - 1 - 1),(StartingWhiteKingRank - 1)] = MovingPiece;
		WhiteKingCheck = CheckForWhiteCheck(WMSkakiera);

		if (WhiteKingCheck == false)
			DangerForMate = false;

		// Επαναφορά της σκακιέρας στην κατάσταση στην οποία βρισκόταν πριν μετακινηθεί ο βασιλιάς για τους
		// σκοπούς του ελέγχου.

		WMSkakiera[(StartingWhiteKingColumn - 1),(StartingWhiteKingRank - 1)] = MovingPiece;
		WMSkakiera[(StartingWhiteKingColumn - 1 - 1),(StartingWhiteKingRank - 1)] = ProsorinoKommati;

	}

	}


	///////////////////////////////////////////////////////////////////////////////////////////////////////////////
	// Έλεγχος του αν θα συνεχίσει να υπάρχει σαχ αν ο λευκός βασιλιάς προσπαθήσει να διαφύγει μετακινούμενος
	// προς τα πάνω-αριστερά
	///////////////////////////////////////////////////////////////////////////////////////////////////////////////

	if ((StartingWhiteKingColumn > 1)&&(StartingWhiteKingRank < 8))
	{

	MovingPiece = WMSkakiera[(StartingWhiteKingColumn - 1),(StartingWhiteKingRank - 1)];
	ProsorinoKommati = WMSkakiera[(StartingWhiteKingColumn - 1 - 1),(StartingWhiteKingRank - 1 + 1)];

	if ( (ProsorinoKommati.CompareTo("White Queen")==1)&&(ProsorinoKommati.CompareTo("White Rook")==1)&&(ProsorinoKommati.CompareTo("White Knight")==1)&&(ProsorinoKommati.CompareTo("White Bishop")==1)&&(ProsorinoKommati.CompareTo("White Pawn")==1)&&(DangerForMate == true)&&((StartingWhiteKingRank - 1 + 1)<=7)&&((StartingWhiteKingColumn - 1 - 1)>=0) )
	{
		
		// (Προσωρινή) μετακίνηση του βασιλιά και έλεγχος του αν συνεχίζει τότε να υπάρχει σαχ.

		WMSkakiera[(StartingWhiteKingColumn - 1),(StartingWhiteKingRank - 1)] = "";
		WMSkakiera[(StartingWhiteKingColumn - 1 - 1),(StartingWhiteKingRank - 1 + 1)] = MovingPiece;
		WhiteKingCheck = CheckForWhiteCheck(WMSkakiera);

		if (WhiteKingCheck == false)
			DangerForMate = false;

		// Επαναφορά της σκακιέρας στην κατάσταση στην οποία βρισκόταν πριν μετακινηθεί ο βασιλιάς για τους
		// σκοπούς του ελέγχου.

		WMSkakiera[(StartingWhiteKingColumn - 1),(StartingWhiteKingRank - 1)] = MovingPiece;
		WMSkakiera[(StartingWhiteKingColumn - 1 - 1),(StartingWhiteKingRank - 1 + 1)] = ProsorinoKommati;

	}

	}

	if (DangerForMate == true)
		Mate = true;

	}

	return Mate;
	}


// Function to find the dangerous squares in the chessboard
public static void DangerousSquares(string[,] Skakiera_Thinking_Danger, string fromFunction, string otherSideColour)
{
    String MovingPiece_tmp;
    //String mySideColour = "";    // The colour of the "side" for which we find the dangerous squares

    //if(otherSideColour.CompareTo("Black") == 0)
    //    mySideColour = "White";
    //else if(otherSideColour.CompareTo("White") == 0)
    //    mySideColour = "Black";

    // Find dangerous squares
    bool[,] Skakiera_Dangerous_Squares_tmp = new bool[8, 8];
    int[,] Number_of_defenders = new int[8, 8];
    int[,] Number_of_attackers = new int[8, 8];
    int[,] Value_of_defenders = new int[8, 8];
    int[,] Value_of_attackers = new int[8, 8];
    int[,] Exception_defender_column = new int[8, 8];
    int[,] Exception_defender_rank = new int[8, 8];

    int m_StartingColumnNumber111;
    int m_FinishingColumnNumber111;
    int m_StartingRank111;
    int m_FinishingRank111;

    // Scan the chessboard . if a piece of HY/Human is found . check all
    // possible destinations in the chessboard . check correctness of
    // the move analyzed . check legality of the move analyzed . if
    // correct and legal, then do the move.
    // NOTE: In all column and rank numbers I add +1, because I must transform
    // them from the 0...7 'measure system' of the chessboard (='Skakiera' in Greek) table
    // to the 1...8 'measure system' of the chessboard.

    // find the dangerous squares in the chessboard, where if the player moving them (HY or Human,
    // depending on the thinking depth) moves its piece, will immediately loose it.
    for (int i2 = 0; i2 <= 7; i2++)
    {
        for (int j2 = 0; j2 <= 7; j2++)
        {
            Skakiera_Dangerous_Squares_tmp[i2, j2] = false;
        }
    }

    // Initialize variables for finding the dangerous squares
    for (int di = 0; di <= 7; di++)
    {
        for (int dj = 0; dj <= 7; dj++)
        {
            Number_of_attackers[di, dj] = 0;
            Number_of_defenders[di, dj] = 0;
            Value_of_attackers[di, dj] = 0;
            Value_of_defenders[di, dj] = 0;
            Exception_defender_column[di, dj] = -9;
            Exception_defender_rank[di, dj] = -9;
        }
    }

    for (int iii2 = 0; iii2 <= 7; iii2++)
    {
        for (int jjj2 = 0; jjj2 <= 7; jjj2++)
        {
            //if ((((((Skakiera_Thinking_Danger[(iii2), (jjj2)].CompareTo("White King") == 0) || (Skakiera_Thinking_Danger[(iii2), (jjj2)].CompareTo("White Queen") == 0) || (Skakiera_Thinking_Danger[(iii2), (jjj2)].CompareTo("White Rook") == 0) || (Skakiera_Thinking_Danger[(iii2), (jjj2)].CompareTo("White Knight") == 0) || (Skakiera_Thinking_Danger[(iii2), (jjj2)].CompareTo("White Bishop") == 0) || (Skakiera_Thinking_Danger[(iii2), (jjj2)].CompareTo("White Pawn") == 0)) && (m_PlayerColor.CompareTo("Black") == 0)) || (((Skakiera_Thinking_Danger[(iii2), (jjj2)].CompareTo("Black King") == 0) || (Skakiera_Thinking_Danger[(iii2), (jjj2)].CompareTo("Black Queen") == 0) || (Skakiera_Thinking_Danger[(iii2), (jjj2)].CompareTo("Black Rook") == 0) || (Skakiera_Thinking_Danger[(iii2), (jjj2)].CompareTo("Black Knight") == 0) || (Skakiera_Thinking_Danger[(iii2), (jjj2)].CompareTo("Black Bishop") == 0) || (Skakiera_Thinking_Danger[(iii2), (jjj2)].CompareTo("Black Pawn") == 0)) && (m_PlayerColor.CompareTo("White") == 0)))))
            if ((((((Skakiera_Thinking_Danger[(iii2), (jjj2)].CompareTo("White King") == 0) || (Skakiera_Thinking_Danger[(iii2), (jjj2)].CompareTo("White Queen") == 0) || (Skakiera_Thinking_Danger[(iii2), (jjj2)].CompareTo("White Rook") == 0) || (Skakiera_Thinking_Danger[(iii2), (jjj2)].CompareTo("White Knight") == 0) || (Skakiera_Thinking_Danger[(iii2), (jjj2)].CompareTo("White Bishop") == 0) || (Skakiera_Thinking_Danger[(iii2), (jjj2)].CompareTo("White Pawn") == 0)) && (otherSideColour.CompareTo("Black") == 0)) || (((Skakiera_Thinking_Danger[(iii2), (jjj2)].CompareTo("Black King") == 0) || (Skakiera_Thinking_Danger[(iii2), (jjj2)].CompareTo("Black Queen") == 0) || (Skakiera_Thinking_Danger[(iii2), (jjj2)].CompareTo("Black Rook") == 0) || (Skakiera_Thinking_Danger[(iii2), (jjj2)].CompareTo("Black Knight") == 0) || (Skakiera_Thinking_Danger[(iii2), (jjj2)].CompareTo("Black Bishop") == 0) || (Skakiera_Thinking_Danger[(iii2), (jjj2)].CompareTo("Black Pawn") == 0)) && (otherSideColour.CompareTo("White") == 0)))))
                {

                // find squares where the computer opponent can hit
                for (int w2 = 0; w2 <= 7; w2++)
                {
                    for (int r2 = 0; r2 <= 7; r2++)
                    {
                        MovingPiece_tmp = Skakiera_Thinking_Danger[(iii2), (jjj2)];
                        m_StartingColumnNumber111 = iii2 + 1;
                        m_FinishingColumnNumber111 = w2 + 1;
                        m_StartingRank111 = jjj2 + 1;
                        m_FinishingRank111 = r2 + 1;

                        // check the move
                        bool MoveOk = MoveFilter(Skakiera_Thinking_Danger, MovingPiece_tmp, m_StartingColumnNumber111, m_FinishingColumnNumber111, m_StartingRank111, m_FinishingRank111);

                        if (MoveOk == true)
                        {
                            m_WhoPlays = "Human";
                            m_WrongColumn = false;
                            m_OrthotitaKinisis = ElegxosOrthotitas(Skakiera_Thinking_Danger, MovingPiece_tmp);
                            if (m_OrthotitaKinisis == true)
                                m_NomimotitaKinisis = ElegxosNomimotitas(Skakiera_Thinking_Danger, MovingPiece_tmp);
                            // restore normal value of m_whoplays
                            m_WhoPlays = "HY";
                            if ((m_OrthotitaKinisis == true) && (m_NomimotitaKinisis == true))
                            {
                                // Another attacker on that square found!
                                Number_of_attackers[(m_FinishingColumnNumber111 - 1), (m_FinishingRank111 - 1)] = Number_of_attackers[(m_FinishingColumnNumber111 - 1), (m_FinishingRank111 - 1)] + 1;
                                Skakiera_Dangerous_Squares_tmp[(m_FinishingColumnNumber111 - 1), (m_FinishingRank111 - 1)] = true;
                                // Calculate the value (total value) of the attackers
                                if ((MovingPiece_tmp.CompareTo("White Rook") == 0) || (MovingPiece_tmp.CompareTo("Black Rook") == 0))
                                    Value_of_attackers[(m_FinishingColumnNumber111 - 1), (m_FinishingRank111 - 1)] = Value_of_attackers[(m_FinishingColumnNumber111 - 1), (m_FinishingRank111 - 1)] + 5;
                                else if ((MovingPiece_tmp.CompareTo("White Bishop") == 0) || (MovingPiece_tmp.CompareTo("Black Bishop") == 0))
                                    Value_of_attackers[(m_FinishingColumnNumber111 - 1), (m_FinishingRank111 - 1)] = Value_of_attackers[(m_FinishingColumnNumber111 - 1), (m_FinishingRank111 - 1)] + 3;
                                else if ((MovingPiece_tmp.CompareTo("White Knight") == 0) || (MovingPiece_tmp.CompareTo("Black Knight") == 0))
                                    Value_of_attackers[(m_FinishingColumnNumber111 - 1), (m_FinishingRank111 - 1)] = Value_of_attackers[(m_FinishingColumnNumber111 - 1), (m_FinishingRank111 - 1)] + 3;
                                else if ((MovingPiece_tmp.CompareTo("White Queen") == 0) || (MovingPiece_tmp.CompareTo("Black Queen") == 0))
                                    Value_of_attackers[(m_FinishingColumnNumber111 - 1), (m_FinishingRank111 - 1)] = Value_of_attackers[(m_FinishingColumnNumber111 - 1), (m_FinishingRank111 - 1)] + 9;
                                else if ((MovingPiece_tmp.CompareTo("White Pawn") == 0) || (MovingPiece_tmp.CompareTo("Black Pawn") == 0))
                                    Value_of_attackers[(m_FinishingColumnNumber111 - 1), (m_FinishingRank111 - 1)] = Value_of_attackers[(m_FinishingColumnNumber111 - 1), (m_FinishingRank111 - 1)] + 1;
                            }
                        }
                    }
                }
            }
        }
    }


    // Find squares that are also 'protected' by a piece of the the other side.
    // If protected, then the square is not really dangerous
    // Initialize all variables used to find exceptions in the non-dangerous squares.
    // Exceptions definition: If human can hit a square and the computer defends it with its pieces, then the
    // square is not dangerous. However, if the computer has only one (1) piece to defend that square, then
    // it cannot move that specific piece to that square (because then the square would have no defenders and
    // would become again a dangerous square!).

    for (int iii3 = 0; iii3 <= 7; iii3++)
    {
        for (int jjj3 = 0; jjj3 <= 7; jjj3++)
        {
            //if ((((((Skakiera_Thinking_Danger[(iii3), (jjj3)].CompareTo("White King") == 0) || (Skakiera_Thinking_Danger[(iii3), (jjj3)].CompareTo("White Queen") == 0) || (Skakiera_Thinking_Danger[(iii3), (jjj3)].CompareTo("White Rook") == 0) || (Skakiera_Thinking_Danger[(iii3), (jjj3)].CompareTo("White Knight") == 0) || (Skakiera_Thinking_Danger[(iii3), (jjj3)].CompareTo("White Bishop") == 0) || (Skakiera_Thinking_Danger[(iii3), (jjj3)].CompareTo("White Pawn") == 0)) && (m_PlayerColor.CompareTo("White") == 0)) || (((Skakiera_Thinking_Danger[(iii3), (jjj3)].CompareTo("Black King") == 0) || (Skakiera_Thinking_Danger[(iii3), (jjj3)].CompareTo("Black Queen") == 0) || (Skakiera_Thinking_Danger[(iii3), (jjj3)].CompareTo("Black Rook") == 0) || (Skakiera_Thinking_Danger[(iii3), (jjj3)].CompareTo("Black Knight") == 0) || (Skakiera_Thinking_Danger[(iii3), (jjj3)].CompareTo("Black Bishop") == 0) || (Skakiera_Thinking_Danger[(iii3), (jjj3)].CompareTo("Black Pawn") == 0)) && (m_PlayerColor.CompareTo("Black") == 0)))))
            if ((((((Skakiera_Thinking_Danger[(iii3), (jjj3)].CompareTo("White King") == 0) || (Skakiera_Thinking_Danger[(iii3), (jjj3)].CompareTo("White Queen") == 0) || (Skakiera_Thinking_Danger[(iii3), (jjj3)].CompareTo("White Rook") == 0) || (Skakiera_Thinking_Danger[(iii3), (jjj3)].CompareTo("White Knight") == 0) || (Skakiera_Thinking_Danger[(iii3), (jjj3)].CompareTo("White Bishop") == 0) || (Skakiera_Thinking_Danger[(iii3), (jjj3)].CompareTo("White Pawn") == 0)) && (otherSideColour.CompareTo("White") == 0)) || (((Skakiera_Thinking_Danger[(iii3), (jjj3)].CompareTo("Black King") == 0) || (Skakiera_Thinking_Danger[(iii3), (jjj3)].CompareTo("Black Queen") == 0) || (Skakiera_Thinking_Danger[(iii3), (jjj3)].CompareTo("Black Rook") == 0) || (Skakiera_Thinking_Danger[(iii3), (jjj3)].CompareTo("Black Knight") == 0) || (Skakiera_Thinking_Danger[(iii3), (jjj3)].CompareTo("Black Bishop") == 0) || (Skakiera_Thinking_Danger[(iii3), (jjj3)].CompareTo("Black Pawn") == 0)) && (otherSideColour.CompareTo("Black") == 0)))))
                {
                for (int w1 = 0; w1 <= 7; w1++)
                {
                    for (int r1 = 0; r1 <= 7; r1++)
                    {
                        MovingPiece_tmp = Skakiera_Thinking_Danger[(iii3), (jjj3)];
                        m_StartingColumnNumber111 = iii3 + 1;
                        m_FinishingColumnNumber111 = w1 + 1;
                        m_StartingRank111 = jjj3 + 1;
                        m_FinishingRank111 = r1 + 1;

                        // Έλεγχος της κίνησης
                        // check the move
                        bool MoveOk = MoveFilter(Skakiera_Thinking_Danger, MovingPiece_tmp, m_StartingColumnNumber111, m_FinishingColumnNumber111, m_StartingRank111, m_FinishingRank111);

                        if (MoveOk == true)
                        {
                            // Απόδοση τιμών στις μεταβλητές m_WhoPlays και m_WrongColumn, οι οποίες είναι απαραίτητες για να λειτουργήσει σωστά οι συναρτήσεις ElegxosNomimotitas και ElegxosOrthotitas
                            m_WhoPlays = "Human";
                            m_WrongColumn = false;
                            m_OrthotitaKinisis = ElegxosOrthotitas(Skakiera_Thinking_Danger, MovingPiece_tmp);
                            if (m_OrthotitaKinisis == true)
                                m_NomimotitaKinisis = ElegxosNomimotitas(Skakiera_Thinking_Danger, MovingPiece_tmp);
                            // Επαναφορά της κανονικής τιμής της m_WhoPlays
                            m_WhoPlays = "HY";

                            // You can count for all moves that "defend" a square,
                            // except the move of a pawn forward! :)
                            if ((MovingPiece_tmp.CompareTo("White Pawn") == 0) || (MovingPiece_tmp.CompareTo("Black Pawn") == 0))
                            {
                                if (m_FinishingColumnNumber111 == m_StartingColumnNumber111)
                                    m_OrthotitaKinisis = false;
                            }

                            m_WhoPlays = "HY";
                            if ((m_OrthotitaKinisis == true) && (m_NomimotitaKinisis == true))
                            {
                                // Changed in version 0.5
                                // A new defender for that square is found!
                                Number_of_defenders[(m_FinishingColumnNumber111 - 1), (m_FinishingRank111 - 1)] = Number_of_defenders[(m_FinishingColumnNumber111 - 1), (m_FinishingRank111 - 1)] + 1;

                                // Calculate the value (total value) of the defenders
                                if ((MovingPiece_tmp.CompareTo("White Rook") == 0) || (MovingPiece_tmp.CompareTo("Black Rook") == 0))
                                    Value_of_defenders[(m_FinishingColumnNumber111 - 1), (m_FinishingRank111 - 1)] = Value_of_defenders[(m_FinishingColumnNumber111 - 1), (m_FinishingRank111 - 1)] + 5;
                                else if ((MovingPiece_tmp.CompareTo("White Bishop") == 0) || (MovingPiece_tmp.CompareTo("Black Bishop") == 0))
                                    Value_of_defenders[(m_FinishingColumnNumber111 - 1), (m_FinishingRank111 - 1)] = Value_of_defenders[(m_FinishingColumnNumber111 - 1), (m_FinishingRank111 - 1)] + 3;
                                else if ((MovingPiece_tmp.CompareTo("White Knight") == 0) || (MovingPiece_tmp.CompareTo("Black Knight") == 0))
                                    Value_of_defenders[(m_FinishingColumnNumber111 - 1), (m_FinishingRank111 - 1)] = Value_of_defenders[(m_FinishingColumnNumber111 - 1), (m_FinishingRank111 - 1)] + 3;
                                else if ((MovingPiece_tmp.CompareTo("White Queen") == 0) || (MovingPiece_tmp.CompareTo("Black Queen") == 0))
                                    Value_of_defenders[(m_FinishingColumnNumber111 - 1), (m_FinishingRank111 - 1)] = Value_of_defenders[(m_FinishingColumnNumber111 - 1), (m_FinishingRank111 - 1)] + 9;
                                else if ((MovingPiece_tmp.CompareTo("White Pawn") == 0) || (MovingPiece_tmp.CompareTo("Black Pawn") == 0))
                                    Value_of_defenders[(m_FinishingColumnNumber111 - 1), (m_FinishingRank111 - 1)] = Value_of_defenders[(m_FinishingColumnNumber111 - 1), (m_FinishingRank111 - 1)] + 1;

                                // Record the coordinates of the defender.
                                // If the defender found is the only one, then that defender cannot move to that square,
                                // since then the square would be again dangerous (since its only defender would have moved into it!)
                                // If more than one defenders is found, then no exceptions exist.
                                if (Number_of_defenders[(m_FinishingColumnNumber111 - 1), (m_FinishingRank111 - 1)] == 1)
                                {
                                    Exception_defender_column[(m_FinishingColumnNumber111 - 1), (m_FinishingRank111 - 1)] = (m_StartingColumnNumber111 - 1);
                                    Exception_defender_rank[(m_FinishingColumnNumber111 - 1), (m_FinishingRank111 - 1)] = (m_StartingRank111 - 1);
                                }
                                // PLAYING: Change 1 to 2 ???
                                if (Number_of_defenders[(m_FinishingColumnNumber111 - 1), (m_FinishingRank111 - 1)] > 1)
                                {
                                    Exception_defender_column[(m_FinishingColumnNumber111 - 1), (m_FinishingRank111 - 1)] = -99;
                                    Exception_defender_rank[(m_FinishingColumnNumber111 - 1), (m_FinishingRank111 - 1)] = -99;
                                }
                            }
                        }
                    }
                }
            }
        }
    }


    
    for (int y = 0; y < 8; y++)
    {
        for (int u = 0; u < 8; u++)
        {
            if ((Number_of_defenders[(y), (u)] <= Number_of_attackers[(y), (u)]) && ((Value_of_defenders[(y), (u)]) > Value_of_attackers[(y), (u)]))
            {
                Skakiera_Dangerous_Squares_tmp[(y), (u)] = true;
            }
            else
            {
                Skakiera_Dangerous_Squares_tmp[(y), (u)] = false;
            }
        }
    }


    //public static bool[,] Skakiera_Dangerous_Squares_0 = new bool[8, 8];
    //public static bool[,] Skakiera_Dangerous_Squares_1 = new bool[8, 8];
    //public static bool[,] Skakiera_Dangerous_Squares_2 = new bool[8, 8];
    //public static bool[,] Skakiera_Dangerous_Squares_3 = new bool[8, 8];
    //public static bool[,] Skakiera_Dangerous_Squares_4 = new bool[8, 8];
    //public static bool[,] Skakiera_Dangerous_Squares_5 = new bool[8, 8];

    // Load the dangerous squares values in the respective arrays for every thinking depth
    if (fromFunction.CompareTo("ComputerMove0") == 0)
    {
        for (int y = 0; y < 8; y++)
        {
            for (int u = 0; u < 8; u++)
            {
                Skakiera_Dangerous_Squares_0[y,u] = Skakiera_Dangerous_Squares_tmp[(y), (u)];
            }
        }
    }
    else if (fromFunction.CompareTo("ComputerMove1") == 0)
    {
        for (int y = 0; y < 8; y++)
        {
            for (int u = 0; u < 8; u++)
            {
                Skakiera_Dangerous_Squares_1[y, u] = Skakiera_Dangerous_Squares_tmp[(y), (u)];
            }
        }
    }
    else if (fromFunction.CompareTo("ComputerMove2") == 0)
    {
        for (int y = 0; y < 8; y++)
        {
            for (int u = 0; u < 8; u++)
            {
                Skakiera_Dangerous_Squares_2[y, u] = Skakiera_Dangerous_Squares_tmp[(y), (u)];
            }
        }
    }
    else if (fromFunction.CompareTo("ComputerMove3") == 0)
    {
        for (int y = 0; y < 8; y++)
        {
            for (int u = 0; u < 8; u++)
            {
                Skakiera_Dangerous_Squares_3[y, u] = Skakiera_Dangerous_Squares_tmp[(y), (u)];
            }
        }
    }
    else if (fromFunction.CompareTo("ComputerMove4") == 0)
    {
        for (int y = 0; y < 8; y++)
        {
            for (int u = 0; u < 8; u++)
            {
                Skakiera_Dangerous_Squares_4[y, u] = Skakiera_Dangerous_Squares_tmp[(y), (u)];
            }
        }
    }
    else if (fromFunction.CompareTo("ComputerMove5") == 0)
    {
        for (int y = 0; y < 8; y++)
        {
            for (int u = 0; u < 8; u++)
            {
                Skakiera_Dangerous_Squares_5[y, u] = Skakiera_Dangerous_Squares_tmp[(y), (u)];
            }
        }
    }

}


public static bool MoveFilter(string[,] Skakiera_Thinking_M, string MovingPieceK, int m_StartingColumnNumberM, int m_FinishingColumnNumberM, int m_StartingRankM, int m_FinishingRankM)
{
    bool MoveOK = false;


    if (                                              // Move in diagonals
    (((MovingPieceK.CompareTo("White King") == 0) ||
    (MovingPieceK.CompareTo("White Queen") == 0) ||
    (MovingPieceK.CompareTo("White Bishop") == 0))
    &&
    (((Math.Abs(m_FinishingColumnNumberM - m_StartingColumnNumberM)) == (Math.Abs(m_FinishingRankM - m_StartingRankM))) && (m_FinishingColumnNumberM != m_StartingColumnNumberM) && (m_FinishingRankM != m_StartingRankM)))
    ||
        (((MovingPieceK.CompareTo("Black King") == 0) ||
    (MovingPieceK.CompareTo("Black Queen") == 0) ||
    (MovingPieceK.CompareTo("Black Bishop") == 0))
    &&
    (((Math.Abs(m_FinishingColumnNumberM - m_StartingColumnNumberM)) == (Math.Abs(m_FinishingRankM - m_StartingRankM))) && (m_FinishingColumnNumberM != m_StartingColumnNumberM) && (m_FinishingRankM != m_StartingRankM)))
    ||
        // Move in RankMs and columns
    (((MovingPieceK.CompareTo("White King") == 0) ||
    (MovingPieceK.CompareTo("White Queen") == 0) ||
    (MovingPieceK.CompareTo("White Rook") == 0))
    &&
    ((m_FinishingColumnNumberM == m_StartingColumnNumberM)
    || (m_FinishingRankM == m_StartingRankM)))
    ||
        // Move in RankMs and columns
    (((MovingPieceK.CompareTo("Black King") == 0) ||
    (MovingPieceK.CompareTo("Black Queen") == 0) ||
    (MovingPieceK.CompareTo("Black Rook") == 0))
    &&
    ((m_FinishingColumnNumberM == m_StartingColumnNumberM)
    || (m_FinishingRankM == m_StartingRankM)))
    ||
        // Move as a pawn...
    (((MovingPieceK.CompareTo("White Pawn") == 0))
    &&
    ((m_FinishingColumnNumberM == m_StartingColumnNumberM)
    || ((m_FinishingColumnNumberM == (m_StartingColumnNumberM - 1)) && ((m_FinishingRankM == (m_StartingRankM + 1) || (m_FinishingRankM == (m_StartingRankM + 2)))))
    || ((m_FinishingColumnNumberM == (m_StartingColumnNumberM + 1)) && ((m_FinishingRankM == (m_StartingRankM + 1) || (m_FinishingRankM == (m_StartingRankM + 2)))))
    ))
    ||
        // Move as a pawn...
    (((MovingPieceK.CompareTo("Black Pawn") == 0))
    &&
    ((m_FinishingColumnNumberM == m_StartingColumnNumberM)
    || ((m_FinishingColumnNumberM == (m_StartingColumnNumberM - 1)) && ((m_FinishingRankM == (m_StartingRankM + 1) || (m_FinishingRankM == (m_StartingRankM + 2)))))
    || ((m_FinishingColumnNumberM == (m_StartingColumnNumberM + 1)) && ((m_FinishingRankM == (m_StartingRankM + 1) || (m_FinishingRankM == (m_StartingRankM + 2)))))
    ))
    ||
        // Move as a knight!
    (((MovingPieceK.CompareTo("White Knight") == 0))
    &&
    (((m_FinishingColumnNumberM == (m_StartingColumnNumberM + 1)) && (m_FinishingRankM == (m_StartingRankM + 2)))
    || ((m_FinishingColumnNumberM == (m_StartingColumnNumberM + 2)) && (m_FinishingRankM == (m_StartingRankM + 1)))
    || ((m_FinishingColumnNumberM == (m_StartingColumnNumberM + 2)) && (m_FinishingRankM == (m_StartingRankM - 1)))
    || ((m_FinishingColumnNumberM == (m_StartingColumnNumberM + 1)) && (m_FinishingRankM == (m_StartingRankM - 2)))
    || ((m_FinishingColumnNumberM == (m_StartingColumnNumberM - 1)) && (m_FinishingRankM == (m_StartingRankM - 2)))
    || ((m_FinishingColumnNumberM == (m_StartingColumnNumberM - 2)) && (m_FinishingRankM == (m_StartingRankM - 1)))
    || ((m_FinishingColumnNumberM == (m_StartingColumnNumberM - 2)) && (m_FinishingRankM == (m_StartingRankM + 1)))
    || ((m_FinishingColumnNumberM == (m_StartingColumnNumberM - 1)) && (m_FinishingRankM == (m_StartingRankM + 2)))
    ))
            ||
        // Move as a knight!
    (((MovingPieceK.CompareTo("Black Knight") == 0))
    &&
    (((m_FinishingColumnNumberM == (m_StartingColumnNumberM + 1)) && (m_FinishingRankM == (m_StartingRankM + 2)))
    || ((m_FinishingColumnNumberM == (m_StartingColumnNumberM + 2)) && (m_FinishingRankM == (m_StartingRankM + 1)))
    || ((m_FinishingColumnNumberM == (m_StartingColumnNumberM + 2)) && (m_FinishingRankM == (m_StartingRankM - 1)))
    || ((m_FinishingColumnNumberM == (m_StartingColumnNumberM + 1)) && (m_FinishingRankM == (m_StartingRankM - 2)))
    || ((m_FinishingColumnNumberM == (m_StartingColumnNumberM - 1)) && (m_FinishingRankM == (m_StartingRankM - 2)))
    || ((m_FinishingColumnNumberM == (m_StartingColumnNumberM - 2)) && (m_FinishingRankM == (m_StartingRankM - 1)))
    || ((m_FinishingColumnNumberM == (m_StartingColumnNumberM - 2)) && (m_FinishingRankM == (m_StartingRankM + 1)))
    || ((m_FinishingColumnNumberM == (m_StartingColumnNumberM - 1)) && (m_FinishingRankM == (m_StartingRankM + 2)))
    ))
        )

    {
        MoveOK = true;
    }

    return MoveOK;
}


// 2011 CHANGED
public static void ComputerMove(string[,] Skakiera_Thinking)
{
    Mate = false;

    int iii;
    int jjj;
    double maximum_so_far_score = 0;
    String MoveDesc = "";

    // 2011 START [MiniMax algorithm]
    NodeLevel_1_count  = 0;       NodeLevel_2_count  = 0;
    NodeLevel_3_count  = 0;       NodeLevel_4_count  = 0;
    NodeLevel_5_count  = 0;       NodeLevel_6_count  = 0;
    NodeLevel_7_count  = 0;       NodeLevel_8_count  = 0;
    NodeLevel_9_count  = 0;       NodeLevel_10_count = 0;
    NodeLevel_11_count = 0;       NodeLevel_12_count = 0;
    NodeLevel_13_count = 0;       NodeLevel_14_count = 0;
    NodeLevel_15_count = 0;       NodeLevel_16_count = 0;
    NodeLevel_17_count = 0;       NodeLevel_18_count = 0;
    NodeLevel_19_count = 0;       NodeLevel_20_count = 0;
    Nodes_Total_count  = 0;

    for (int iii1 = 0; iii1 < 1000000; iii1++)
    {
        for (int jjj1 = 0; jjj1 < 11; jjj1++)
        {
            NodesAnalysis[iii1, jjj1, 0] = 0;
            NodesAnalysis[iii1, jjj1, 1] = 0;
        }
    }
    // 2011 END

    // store the initial position in the chessboard
    for (int iii1 = 0; iii1 <= 7; iii1++)
    {
        for (int jjj1 = 0; jjj1 <= 7; jjj1++)
        {
            Skakiera_Thinking_init[(iii1), (jjj1)] = Skakiera_Thinking[iii1, jjj1];
        }
    }

    if(DEBUG_huo == true)    Console.WriteLine(String.Concat("Skakiera_Thinking - e4: ", Skakiera_Thinking[(4), (3)].ToString()));
    //Console.ReadKey();
    if(m_PlayerColor.CompareTo("White") == 0)
        maximum_so_far_score = 100;
    else if(m_PlayerColor.CompareTo("Black") == 0)
        maximum_so_far_score = -100;

    DangerousSquares(Skakiera_Thinking, "ComputerMove0", m_PlayerColor);

        for (iii = 0; iii <= 7; iii++)
        {
            for (jjj = 0; jjj <= 7; jjj++)
            {

                if (DEBUG_huo == true)
                {
                    if ((iii == 4) && (jjj == 3))
                    {
                        Console.WriteLine(String.Concat("Piece in square e4: ", Skakiera_Thinking[(4), (3)].ToString(), " [Move=", Move.ToString(), "]"));
                        //Console.ReadKey();
                    }
                }

                if (((((Skakiera_Thinking[(iii), (jjj)].CompareTo("White King") == 0) || (Skakiera_Thinking[(iii), (jjj)].CompareTo("White Queen") == 0) || (Skakiera_Thinking[(iii), (jjj)].CompareTo("White Rook") == 0) || (Skakiera_Thinking[(iii), (jjj)].CompareTo("White Knight") == 0) || (Skakiera_Thinking[(iii), (jjj)].CompareTo("White Bishop") == 0) || (Skakiera_Thinking[(iii), (jjj)].CompareTo("White Pawn") == 0)) && (m_PlayerColor.CompareTo("Black") == 0)) || (((Skakiera_Thinking[(iii), (jjj)].CompareTo("Black King") == 0) || (Skakiera_Thinking[(iii), (jjj)].CompareTo("Black Queen") == 0) || (Skakiera_Thinking[(iii), (jjj)].CompareTo("Black Rook") == 0) || (Skakiera_Thinking[(iii), (jjj)].CompareTo("Black Knight") == 0) || (Skakiera_Thinking[(iii), (jjj)].CompareTo("Black Bishop") == 0) || (Skakiera_Thinking[(iii), (jjj)].CompareTo("Black Pawn") == 0)) && (m_PlayerColor.CompareTo("White") == 0))))
                {
                    // Show what is in square e4. Have the computer play e2->e4 and then try to eat that pawn
                    // in order to show how the value of one square in chessboard changes
                    if (DEBUG_huo == true)
                        Console.WriteLine(String.Concat("AA e4: ", Skakiera_Thinking[(iii), (jjj)].ToString()));

                    for (int w = 0; w <= 7; w++)
                    {
                        for (int r = 0; r <= 7; r++)
                        {
                            MovingPiece = Skakiera_Thinking[(iii), (jjj)];
                            m_StartingColumnNumber = iii + 1;
                            m_FinishingColumnNumber = w + 1;
                            m_StartingRank = jjj + 1;
                            m_FinishingRank = r + 1;

                            bool MoveOk = MoveFilter(Skakiera_Thinking, MovingPiece, m_StartingColumnNumber, m_FinishingColumnNumber, m_StartingRank, m_FinishingRank);

                            if((MoveOk == true) && (Skakiera_Dangerous_Squares_0[(m_FinishingColumnNumber-1),(m_FinishingRank-1)] == false))
                            //if(MoveOk == true)
                            {
                                number_of_moves_analysed++;
                                m_WhoPlays = "Human";
                                m_WrongColumn = false;

                                // Check correctness of move
                                m_OrthotitaKinisis = ElegxosOrthotitas(Skakiera_Thinking, MovingPiece);
                                // if move is correct, then check the legality also
                                if (m_OrthotitaKinisis == true)
                                    m_NomimotitaKinisis = ElegxosNomimotitas(Skakiera_Thinking, MovingPiece);

                                if (SHOW_thinking == true)
                                {
                                    if (m_StartingColumnNumber == 1)
                                        HY_Starting_Column_Text = "a";
                                    else if (m_StartingColumnNumber == 2)
                                        HY_Starting_Column_Text = "b";
                                    else if (m_StartingColumnNumber == 3)
                                        HY_Starting_Column_Text = "c";
                                    else if (m_StartingColumnNumber == 4)
                                        HY_Starting_Column_Text = "d";
                                    else if (m_StartingColumnNumber == 5)
                                        HY_Starting_Column_Text = "e";
                                    else if (m_StartingColumnNumber == 6)
                                        HY_Starting_Column_Text = "f";
                                    else if (m_StartingColumnNumber == 7)
                                        HY_Starting_Column_Text = "g";
                                    else if (m_StartingColumnNumber == 8)
                                        HY_Starting_Column_Text = "h";
                                    if (m_FinishingColumnNumber == 1)
                                        HY_Finishing_Column_Text = "a";
                                    else if (m_FinishingColumnNumber == 2)
                                        HY_Finishing_Column_Text = "b";
                                    else if (m_FinishingColumnNumber == 3)
                                        HY_Finishing_Column_Text = "c";
                                    else if (m_FinishingColumnNumber == 4)
                                        HY_Finishing_Column_Text = "d";
                                    else if (m_FinishingColumnNumber == 5)
                                        HY_Finishing_Column_Text = "e";
                                    else if (m_FinishingColumnNumber == 6)
                                        HY_Finishing_Column_Text = "f";
                                    else if (m_FinishingColumnNumber == 7)
                                        HY_Finishing_Column_Text = "g";
                                    else if (m_FinishingColumnNumber == 8)
                                        HY_Finishing_Column_Text = "h";
                                    MoveDesc = String.Concat(HY_Starting_Column_Text, m_StartingRank.ToString(), " -> ", HY_Finishing_Column_Text, m_FinishingRank.ToString());
                                    //Console.WriteLine(String.Concat(MoveDesc, " (", m_OrthotitaKinisis.ToString(), ",", m_NomimotitaKinisis.ToString(), ")"));
                                }

                                // restore the normal value of the m_WhoPlays
                                m_WhoPlays = "HY";

                                // if the move under analysis is correct and legal, then do it and measure its score

                                if ((m_OrthotitaKinisis == true) && (m_NomimotitaKinisis == true))
                                {
                                    // temporarily perform the move
                                    ProsorinoKommati = Skakiera_Thinking[(m_StartingColumnNumber - 1), (m_StartingRank - 1)];
                                    Skakiera_Thinking[(m_StartingColumnNumber - 1), (m_StartingRank - 1)] = "";
                                    Skakiera_Thinking[(m_FinishingColumnNumber - 1), (m_FinishingRank - 1)] = MovingPiece;

                                    //DangerousSquares(Skakiera_Thinking, "ComputerMove1", m_PlayerColor);
                                    Temp_Score_Human_before_2 = CountScore(Skakiera_Thinking);

                                    if (SHOW_thinking == true)
                                        Console.WriteLine(String.Concat("Node 1 move: ", MoveDesc, " (score: ", Temp_Score_Human_before_2.ToString(), ")"));

                                    if (((m_PlayerColor.CompareTo("White") == 0) && (Temp_Score_Human_before_2 <= maximum_so_far_score))
                                    || ((m_PlayerColor.CompareTo("Black") == 0) && (Temp_Score_Human_before_2 >= maximum_so_far_score)))
                                    {
                                        maximum_so_far_score = Temp_Score_Human_before_2;
                                        NodeLevel_1_count++;
                                        if (SHOW_thinking == true) Console.WriteLine(String.Concat("Started analyzing move - Node 1 count: ", NodeLevel_1_count.ToString()));
                                        m_WhoPlays = "Human";
                                        ComputerMove_2(Skakiera_Thinking);
                                    }

                                    // Restore the initial position in the chessboard
                                    Skakiera_Thinking[(m_StartingColumnNumber - 1), (m_StartingRank - 1)] = Skakiera_Thinking_init[(m_StartingColumnNumber - 1), (m_StartingRank - 1)];
                                    Skakiera_Thinking[(m_FinishingColumnNumber - 1), (m_FinishingRank - 1)] = Skakiera_Thinking_init[(m_FinishingColumnNumber - 1), (m_FinishingRank - 1)];
                                    //for (int iii1 = 0; iii1 <= 7; iii1++)
                                    //{
                                    //    for (int jjj1 = 0; jjj1 <= 7; jjj1++)
                                    //    {
                                    //        Skakiera_Thinking[(iii1), (jjj1)] = Skakiera_Thinking_init[iii1, jjj1];
                                    //    }
                                    //}


                                    if (DEBUG_huo == true)
                                    {
                                        if (((m_FinishingColumnNumber - 1) == 4) && ((m_FinishingRank - 1) == 3))
                                        {
                                            Console.WriteLine(String.Concat("After e4: ", Skakiera_Thinking[(iii), (jjj)].ToString()), " (after)");
                                            //Console.ReadKey();
                                        }
                                    }
                                }
                            }
                        }
                    }

                }


            }


    }


    // DO THE BEST MOVE FOUND

        // 2011 START skakos [MiniMax algorithm - skakos]
        // IMPORTANT NOTE: This works for Thinking Depth = 4 !!!
        // Add more "for loops" to handle more deep thinking depths.
        // Remove the "// Find node 1 move with the best score" part to stop using the MiniMax algorithm.
        int counter1, counter2, counter3, counter4, counter5, counter6;

        Console.WriteLine("Started calculating the best move");

        //for (counter6 = 1; counter6 <= NodeLevel_4_count; counter6++)
        //{
        //    if (NodesAnalysis[counter6, 4, 0] <= NodesAnalysis[Int32.Parse(NodesAnalysis[counter6, 4, 1].ToString()), 3, 0])
        //        NodesAnalysis[Int32.Parse(NodesAnalysis[counter6, 4, 1].ToString()), 3, 0] = NodesAnalysis[counter6, 4, 0];
        //}


        for (counter5 = 1; counter5 <= NodeLevel_4_count; counter5++)
        {
            if (NodesAnalysis[counter5, 4, 0] > NodesAnalysis[Int32.Parse(NodesAnalysis[counter5, 4, 1].ToString()), 3, 0])
                NodesAnalysis[Int32.Parse(NodesAnalysis[counter5, 4, 1].ToString()), 3, 0] = NodesAnalysis[counter5, 4, 0];
        }

        // skakos - IMPROVE THAT!
        //for (counter3 = 1; counter3 <= NodeLevel_3_count; counter3++)
        //{
        //    for (counter4 = 1; counter4 <= NodeLevel_4_count; counter4++)
        //    {
        //        if (NodesAnalysis[counter4, 4, 1] == counter3)
        //        {
        //            if (counter4 == 1)
        //                NodesAnalysis[counter3, 3, 0] = NodesAnalysis[counter4, 4, 0];

        //            if (counter4 > 1)
        //                if (NodesAnalysis[counter4, 4, 0] < NodesAnalysis[counter3, 3, 0])
        //                    NodesAnalysis[counter3, 3, 0] = NodesAnalysis[counter4, 4, 0];
        //        }
        //    }
        //}

        for (counter4 = 1; counter4 <= NodeLevel_4_count; counter4++)
        {
            if (NodesAnalysis[counter4, 4, 0] < NodesAnalysis[Int32.Parse(NodesAnalysis[counter4, 4, 1].ToString()), 3, 0])
                NodesAnalysis[Int32.Parse(NodesAnalysis[counter4, 4, 1].ToString()), 3, 0] = NodesAnalysis[counter4, 4, 0];
        }

        //for (counter2 = 1; counter2 <= NodeLevel_2_count; counter2++)
        //{
        //    for (counter3 = 1; counter3 <= NodeLevel_3_count; counter3++)
        //    {
        //        if (NodesAnalysis[counter3, 3, 1] == counter2)
        //        {
        //            if (counter3 == 1)
        //                NodesAnalysis[counter2, 2, 0] = NodesAnalysis[counter3, 3, 0];

        //            if (counter3 > 1)
        //                if (NodesAnalysis[counter3, 3, 0] > NodesAnalysis[counter2, 2, 0])
        //                    NodesAnalysis[counter2, 2, 0] = NodesAnalysis[counter3, 3, 0];
        //        }
        //    }
        //}

        for (counter3 = 1; counter3 <= NodeLevel_3_count; counter3++)
        {
            if (NodesAnalysis[counter3, 3, 0] > NodesAnalysis[Int32.Parse(NodesAnalysis[counter3, 3, 1].ToString()), 2, 0])
                NodesAnalysis[Int32.Parse(NodesAnalysis[counter3, 3, 1].ToString()), 2, 0] = NodesAnalysis[counter3, 3, 0];
        }

        //for (counter1 = 1; counter1 <= NodeLevel_1_count; counter1++)
        //{
        //    for (counter2 = 1; counter2 <= NodeLevel_2_count; counter2++)
        //    {
        //        if (NodesAnalysis[counter2, 2, 1] == counter1)
        //        {
        //            if (counter2 == 1)
        //                NodesAnalysis[counter1, 1, 0] = NodesAnalysis[counter2, 2, 0];

        //            if (counter2 > 1)
        //                if (NodesAnalysis[counter2, 2, 0] < NodesAnalysis[counter1, 1, 0])
        //                    NodesAnalysis[counter1, 1, 0] = NodesAnalysis[counter2, 2, 0];
        //        }
        //    }
        //}

        for (counter2 = 1; counter2 <= NodeLevel_2_count; counter2++)
        {
            if (NodesAnalysis[counter2, 2, 0] < NodesAnalysis[Int32.Parse(NodesAnalysis[counter2, 2, 1].ToString()), 1, 0])
                NodesAnalysis[Int32.Parse(NodesAnalysis[counter2, 2, 1].ToString()), 1, 0] = NodesAnalysis[counter2, 2, 0];
        }

        Console.WriteLine(String.Concat("Depth 1 counter: ", NodeLevel_1_count.ToString()));  // Correct number: 20 (see http://www.chess.com/chessopedia/view/mathematics-and-chess)
        Console.WriteLine(String.Concat("Depth 2 counter: ", NodeLevel_2_count.ToString()));  // Correct number: 400
        Console.WriteLine(String.Concat("Depth 3 counter: ", NodeLevel_3_count.ToString()));  // Correct number: 8902
        Console.WriteLine(String.Concat("Depth 4 counter: ", NodeLevel_4_count.ToString()));  // Correct number: 197742 
        Console.WriteLine(String.Concat("Depth 5 counter: ", NodeLevel_5_count.ToString()));
        Console.WriteLine(String.Concat("Depth 6 counter: ", NodeLevel_6_count.ToString()));

        // Find node 1 move with the best score
        double temp_score = NodesAnalysis[1, 1, 0];
        //Console.WriteLine(String.Concat("Initial score: ", temp_score.ToString()));
        Best_Move_StartingColumnNumber = Int32.Parse(NodesAnalysis[1, 7, 0].ToString());
        Best_Move_FinishingColumnNumber =   Int32.Parse(NodesAnalysis[1, 8, 0].ToString());
        Best_Move_StartingRank = Int32.Parse(NodesAnalysis[1, 9, 0].ToString());
        Best_Move_FinishingRank = Int32.Parse(NodesAnalysis[1, 10, 0].ToString());

        for (counter1 = 2; counter1 <= NodeLevel_1_count; counter1++)
        {
            //Console.WriteLine("In the node 1 analysis for loop");
            if (NodesAnalysis[counter1, 1, 0] > temp_score)
            {
                Random random_number = new Random();
			    int Arithmos = random_number.Next(1, 20);

                if (Arithmos > 10)
                {
                    Best_Move_StartingColumnNumber = Int32.Parse(NodesAnalysis[counter1, 7, 0].ToString());
                    Best_Move_FinishingColumnNumber = Int32.Parse(NodesAnalysis[counter1, 8, 0].ToString());
                    Best_Move_StartingRank = Int32.Parse(NodesAnalysis[counter1, 9, 0].ToString());
                    Best_Move_FinishingRank = Int32.Parse(NodesAnalysis[counter1, 10, 0].ToString());
                    //Console.WriteLine(String.Concat("Best_Move_StartingColumnNumber ", Best_Move_StartingColumnNumber.ToString()));
                    //Console.WriteLine(String.Concat("Best_Move_StartingRank: ", Best_Move_StartingRank.ToString()));
                    //Console.WriteLine(String.Concat("Best_Move_FinishingColumnNumbe: ", Best_Move_FinishingColumnNumber.ToString()));
                    //Console.WriteLine(String.Concat("Best_Move_FinishingRank: ", Best_Move_FinishingRank.ToString()));
                }
            }
        }

        // Limit of total nodes (total positions analyzed): 1000000
        Console.WriteLine(String.Concat("Total final positions analyzed: ", Nodes_Total_count.ToString()));

        // 2011 END


        /////////////////////////////////////////////////////////////////////////////////////////////////
        // REDRAW THE CHESSBOARD
        /////////////////////////////////////////////////////////////////////////////////////////////////

        // Restore the initial position
        for (iii = 0; iii <= 7; iii++)
        {
            for (jjj = 0; jjj <= 7; jjj++)
            {
                Skakiera_Thinking[(iii), (jjj)] = Skakiera_Thinking_init[(iii), (jjj)];
            }
        }

        MovingPiece = Skakiera[(Best_Move_StartingColumnNumber - 1), (Best_Move_StartingRank - 1)];
        Console.WriteLine(String.Concat("Moving piece: ", MovingPiece));
        Skakiera[(Best_Move_StartingColumnNumber - 1), (Best_Move_StartingRank - 1)] = "";

        if (Best_Move_StartingColumnNumber == 1)
            HY_Starting_Column_Text = "a";
        else if (Best_Move_StartingColumnNumber == 2)
            HY_Starting_Column_Text = "b";
        else if (Best_Move_StartingColumnNumber == 3)
            HY_Starting_Column_Text = "c";
        else if (Best_Move_StartingColumnNumber == 4)
            HY_Starting_Column_Text = "d";
        else if (Best_Move_StartingColumnNumber == 5)
            HY_Starting_Column_Text = "e";
        else if (Best_Move_StartingColumnNumber == 6)
            HY_Starting_Column_Text = "f";
        else if (Best_Move_StartingColumnNumber == 7)
            HY_Starting_Column_Text = "g";
        else if (Best_Move_StartingColumnNumber == 8)
            HY_Starting_Column_Text = "h";

        // position piece to the square of destination

        Skakiera[(Best_Move_FinishingColumnNumber - 1), (Best_Move_FinishingRank - 1)] = MovingPiece;

        if (Best_Move_FinishingColumnNumber == 1)
            HY_Finishing_Column_Text = "a";
        else if (Best_Move_FinishingColumnNumber == 2)
            HY_Finishing_Column_Text = "b";
        else if (Best_Move_FinishingColumnNumber == 3)
            HY_Finishing_Column_Text = "c";
        else if (Best_Move_FinishingColumnNumber == 4)
            HY_Finishing_Column_Text = "d";
        else if (Best_Move_FinishingColumnNumber == 5)
            HY_Finishing_Column_Text = "e";
        else if (Best_Move_FinishingColumnNumber == 6)
            HY_Finishing_Column_Text = "f";
        else if (Best_Move_FinishingColumnNumber == 7)
            HY_Finishing_Column_Text = "g";
        else if (Best_Move_FinishingColumnNumber == 8)
            HY_Finishing_Column_Text = "h";

        // if king is moved, no castling can occur
        if (MovingPiece.CompareTo("White King") == 0)
            White_King_Moved = true;
        else if (MovingPiece.CompareTo("Black King") == 0)
            Black_King_Moved = false;
        else if (MovingPiece.CompareTo("White Rook") == 0)
        {
            if ((Best_Move_StartingColumnNumber == 1) && (Best_Move_StartingRank == 1))
                White_Rook_a1_Moved = false;
            else if ((Best_Move_StartingColumnNumber == 8) && (Best_Move_StartingRank == 1))
                White_Rook_h1_Moved = false;
        }
        else if (MovingPiece.CompareTo("Black Rook") == 0)
        {
            if ((Best_Move_StartingColumnNumber == 1) && (Best_Move_StartingRank == 8))
                Black_Rook_a8_Moved = false;
            else if ((Best_Move_StartingColumnNumber == 8) && (Best_Move_StartingRank == 8))
                Black_Rook_h8_Moved = false;
        }

        // is there a pawn to promote?
        if (((MovingPiece.CompareTo("White Pawn") == 0) || (MovingPiece.CompareTo("Black Pawn") == 0)) && (m_WhoPlays.CompareTo("HY") == 0))
        {

            if (Best_Move_FinishingRank == 8)
            {
                Skakiera[(Best_Move_FinishingColumnNumber - 1), (Best_Move_FinishingRank - 1)] = "White Queen";
                Console.WriteLine("Κάνω βασίλισσα!");
            }
            else if (Best_Move_FinishingRank == 1)
            {
                Skakiera[(Best_Move_FinishingColumnNumber - 1), (Best_Move_FinishingRank - 1)] = "Black Queen";
                Console.WriteLine("Κάνω βασίλισσα!");
            }

        }


        //////////////////////////////////////////////////////////////////////
        // show HY move
        //////////////////////////////////////////////////////////////////////

        String NextLine = String.Concat(HY_Starting_Column_Text, Best_Move_StartingRank.ToString(), " -> ", HY_Finishing_Column_Text, Best_Move_FinishingRank.ToString());
        Console.WriteLine(String.Concat("My move is: ", NextLine));

        // Αν ο υπολογιστής παίζει με τα λευκά, τότε αυξάνεται τώρα το νούμερο της κίνησης.
        if (m_PlayerColor.CompareTo("Black") == 0)
            Move = Move + 1;

        // now it is the other color's turn to play
        if (m_PlayerColor.CompareTo("Black") == 0)
            m_WhichColorPlays = "Black";
        else if (m_PlayerColor.CompareTo("White") == 0)
            m_WhichColorPlays = "White";

        // now it is the human's turn to play
        m_WhoPlays = "Human";
}


// 2011: This function has changed
public static double CountScore(string[,] CSSkakiera)             
	{
    //Console.WriteLine("CountScore_Human called");
	// count score for human moves analyzed
	// SEE RESPECTIVE CountScore funtion for analytical comments in English!
	// All pieces values here are increased by +2 relatively to the respective values
	// in CountScore. This is to show/emphasize to the computer that its human opponent
	// will aim at killing his pieces!

	double Current_Move_Score = 0;

	for (i = 0; i <= 7; i++)
	{
		for (j = 0; j <= 7; j++)
		{
			if (CSSkakiera[(i),(j)].CompareTo("White Pawn") == 0)
				Current_Move_Score = Current_Move_Score + 1;
			else if (CSSkakiera[(i),(j)].CompareTo("White Rook") == 0)
				Current_Move_Score = Current_Move_Score + 7;
			else if (CSSkakiera[(i),(j)].CompareTo("White Knight") == 0)
				Current_Move_Score = Current_Move_Score + 5;
			else if (CSSkakiera[(i),(j)].CompareTo("White Bishop") == 0)
				Current_Move_Score = Current_Move_Score + 5;
			else if (CSSkakiera[(i),(j)].CompareTo("White Queen") == 0)
					Current_Move_Score = Current_Move_Score + 11;
			else if (CSSkakiera[(i),(j)].CompareTo("White King") == 0)
				Current_Move_Score = Current_Move_Score + 17;
			else if (CSSkakiera[(i),(j)].CompareTo("Black Pawn") == 0)
				Current_Move_Score = Current_Move_Score - 1;
			else if (CSSkakiera[(i),(j)].CompareTo("Black Rook") == 0)
				Current_Move_Score = Current_Move_Score - 7;
			else if (CSSkakiera[(i),(j)].CompareTo("Black Knight") == 0)
				Current_Move_Score = Current_Move_Score - 5;
			else if (CSSkakiera[(i),(j)].CompareTo("Black Bishop") == 0)
				Current_Move_Score = Current_Move_Score - 5;
			else if (CSSkakiera[(i),(j)].CompareTo("Black Queen") == 0)
					Current_Move_Score = Current_Move_Score - 11;
			else if (CSSkakiera[(i),(j)].CompareTo("Black King") == 0)
				Current_Move_Score = Current_Move_Score - 17;

		}
	}

    if (Move < 11)
    {
        // control the center with your pawns

        if (CSSkakiera[3, 2].CompareTo("White Pawn") == 0)
            Current_Move_Score = Current_Move_Score + 0.4;

        if (CSSkakiera[3, 3].CompareTo("White Pawn") == 0)
            Current_Move_Score = Current_Move_Score + 0.4;

        if (CSSkakiera[4, 2].CompareTo("White Pawn") == 0)
            Current_Move_Score = Current_Move_Score + 0.4;

        if (CSSkakiera[4, 3].CompareTo("White Pawn") == 0)
            Current_Move_Score = Current_Move_Score + 0.4;

        if (CSSkakiera[3, 5].CompareTo("Black Pawn") == 0)
            Current_Move_Score = Current_Move_Score - 0.4;

        if (CSSkakiera[3, 4].CompareTo("Black Pawn") == 0)
            Current_Move_Score = Current_Move_Score - 0.4;

        if (CSSkakiera[4, 5].CompareTo("Black Pawn") == 0)
            Current_Move_Score = Current_Move_Score - 0.4;

        if (CSSkakiera[4, 4].CompareTo("Black Pawn") == 0)
            Current_Move_Score = Current_Move_Score - 0.4;

        // don't play a4, h4, etc

        if (CSSkakiera[0, 3].CompareTo("White Pawn") == 0)
            Current_Move_Score = Current_Move_Score - 0.4;

        if (CSSkakiera[1, 3].CompareTo("White Pawn") == 0)
            Current_Move_Score = Current_Move_Score - 0.4;

        if (CSSkakiera[6, 3].CompareTo("White Pawn") == 0)
            Current_Move_Score = Current_Move_Score - 0.4;

        if (CSSkakiera[7, 3].CompareTo("White Pawn") == 0)
            Current_Move_Score = Current_Move_Score - 0.4;

        if (CSSkakiera[0, 4].CompareTo("Black Pawn") == 0)
            Current_Move_Score = Current_Move_Score + 0.4;

        if (CSSkakiera[1, 4].CompareTo("Black Pawn") == 0)
            Current_Move_Score = Current_Move_Score + 0.4;

        if (CSSkakiera[6, 4].CompareTo("Black Pawn") == 0)
            Current_Move_Score = Current_Move_Score + 0.4;

        if (CSSkakiera[7, 4].CompareTo("Black Pawn") == 0)
            Current_Move_Score = Current_Move_Score + 0.4;

        // don't play the rook

        if (CSSkakiera[0, 0].CompareTo("") == 0)
            Current_Move_Score = Current_Move_Score - 0.4;

        if (CSSkakiera[7, 0].CompareTo("") == 0)
            Current_Move_Score = Current_Move_Score - 0.4;

        if (CSSkakiera[0, 7].CompareTo("") == 0)
            Current_Move_Score = Current_Move_Score + 0.4;

        if (CSSkakiera[7, 7].CompareTo("") == 0)
            Current_Move_Score = Current_Move_Score + 0.4;

        // Μην παίζεις τους ίππους στη γωνία

        if (CSSkakiera[0, 2].CompareTo("White Knight") == 0)
            Current_Move_Score = Current_Move_Score - 0.4;

        if (CSSkakiera[7, 2].CompareTo("White Knight") == 0)
            Current_Move_Score = Current_Move_Score - 0.4;

        if (CSSkakiera[0, 5].CompareTo("Black Knight") == 0)
            Current_Move_Score = Current_Move_Score + 0.4;

        if (CSSkakiera[7, 5].CompareTo("Black Knight") == 0)
            Current_Move_