Sunday, December 16, 2012

How to program a chess engine in C++ language compatible with Xboard/Winboard: Chess Board Representation


Chess Board Representation is a very basic necessity in chess engine programming because it is the way to show the movements of the pieces and to visualize the current position of each player in the game. Some people prefer the use of arrays in C++ but this method below uses no arrays. It is just plain and simple way of representing the chess board. The lowercase letters r, n, b, k, q, and o represent Black's pieces and the uppercase letters R, N, B, K, Q, and P represent White's pieces. The numbers 1, 2, 3, 4, 5, 6, 7, 8 on the left represent the ranks while the letters a, b, c, d, e, f, g, h on the bottom represent the files.

Any suggestions and better ideas about how to represent the chess board for the chess engine program would be much more appreciated for the benefit of those who want to learn how to program their own chess engines. Also, a little sharing of your code would be a big bonus from you (I know you have better ideas, ways and methods in C++ programming to accomplish the same task). Thanks in advance :)

Source code:

/*
PROGRAM 7: Chess - board representation
AUTHOR: eternaltreasures
DATE: 2010 September 22
*/


#include <iostream>
#include <string>
using namespace std;

#define newline '\n'

//border represents the horizontal border lines between the ranks or rows of the chessboard
#define border "   +---+---+---+---+---+---+---+---+"

//sp represents the vertical spacer lines between the squares
#define sp " | "

/*
r1 to r8 represents the ranks or rows of the chess board, letters a to h represents the
files. The combination of these letters and numbers will be used in the coordinate
system of representing moves in chess.
*/
#define r8 "8 "
#define r7 "7 "
#define r6 "6 "
#define r5 "5 "
#define r4 "4 "
#define r3 "3 "
#define r2 "2 "
#define r1 "1 "
#define boardfiles "     a   b   c   d   e   f   g   h"

//ranks 8 and 7 are Black's initial position and ranks 1 and 2 for White.
char a8='r', b8='n', c8='b', d8='q', e8='k', f8='b', g8='n', h8='r';
char a7='o', b7='o', c7='o', d7='o', e7='o', f7='o', g7='o', h7='o';
char a6=' ', b6=' ', c6=' ', d6=' ', e6=' ', f6=' ', g6=' ', h6=' ';
char a5=' ', b5=' ', c5=' ', d5=' ', e5=' ', f5=' ', g5=' ', h5=' ';
char a4=' ', b4=' ', c4=' ', d4=' ', e4=' ', f4=' ', g4=' ', h4=' ';
char a3=' ', b3=' ', c3=' ', d3=' ', e3=' ', f3=' ', g3=' ', h3=' ';
char a2='P', b2='P', c2='P', d2='P', e2='P', f2='P', g2='P', h2='P';
char a1='R', b1='N', c1='B', d1='Q', e1='K', f1='B', g1='N', h1='R';


void introduction ()
{
cout << "   Chess Engine Program 1.0";
cout << newline;
cout << "   by eternaltreasures";
cout << newline;
cout << "   September 2010";
cout << newline;
cout << newline;
}

//function called by main () to display the chess board.
void displayboard ()
{

cout << border;
cout << newline;
cout <<r8<<sp <<a8<<sp <<b8<<sp <<c8<<sp <<d8<<sp <<e8<<sp <<f8<<sp <<g8<<sp <<h8<<sp;

cout << newline;
cout <<border;
cout << newline;
cout <<r7<<sp  <<a7<<sp <<b7<<sp <<c7<<sp <<d7<<sp <<e7<<sp <<f7<<sp <<g7<<sp <<h7<<sp;

cout << newline;
cout <<border;
cout << newline;
cout <<r6<<sp  <<a6<<sp <<b6<<sp <<c6<<sp <<d6<<sp <<e6<<sp <<f6<<sp <<g6<<sp <<h6<<sp;

cout << newline;
cout <<border;
cout << newline;
cout <<r5<<sp  <<a5<<sp <<b5<<sp <<c5<<sp <<d5<<sp <<e5<<sp <<f5<<sp <<g5<<sp <<h5<<sp;

cout << newline;
cout <<border;
cout << newline;
cout <<r4<<sp  <<a4<<sp <<b4<<sp <<c4<<sp <<d4<<sp <<e4<<sp <<f4<<sp <<g4<<sp <<h4<<sp;

cout << newline;
cout <<border;
cout << newline;
cout <<r3<<sp  <<a3<<sp <<b3<<sp <<c3<<sp <<d3<<sp <<e3<<sp <<f3<<sp <<g3<<sp <<h3<<sp;

cout << newline;
cout <<border;
cout << newline;
cout <<r2<<sp  <<a2<<sp <<b2<<sp <<c2<<sp <<d2<<sp <<e2<<sp <<f2<<sp <<g2<<sp <<h2<<sp;

cout << newline;
cout <<border;
cout << newline;
cout <<r1<<sp  <<a1<<sp <<b1<<sp <<c1<<sp <<d1<<sp <<e1<<sp <<f1<<sp <<g1<<sp <<h1<<sp;
cout << newline;
cout << border;
cout << newline;
cout << newline;
cout << boardfiles;
cout << newline;
cout << newline;
}

int main ()
{
introduction ();
displayboard ();

//Move entry - it asks the player to enter the move in coordinate system of chess move notations.
string entermove = "e2e4";
cout << newline;
cout << "Enter your move:";
cin >> entermove;
cout << entermove;
}

Saturday, December 15, 2012

How to setup the TCP/IP in Chessmaster 9000 CM LIVE:


This procedure for the TCP/IP setup in Chessmaster Live or CM LIVE in Chessmaster was tested using Chessmaster 9000 in Windows XP with 2 computers in a home network connected by a common router. The procedure for the setup of TCP/IP should be similar in older versions of Chessmaster as well as newer versions such as the Chessmaster 10th edition and the Chessmaster XI or the Grandmaster edition.

How to setup the TCP/IP in Chessmaster 9000 CM LIVE:

Hosting computer:

-----------------------
1. Start Chessmaster 9000
2. CM LIVE
3. TCP/IP
4. In the Create Session Box -> Game Name -- chessmaster
5. Click Host

Joining computer:

----------------------
1. Start Chessmaster 9000
2. CM LIVE
3. TCP/IP
4. In the Create Session Box -> Game Name -- chessmaster
5. In the Join Session Box -> Host IP Address or DNS Name -> 192.168.2.10 (Start -> Run -> cmd -> ipconfig (to obtain ip address)
6. Click Join

Note: chessmaster is a sample of Game Name and 192.168.2.10 is a sample ip address.

Challenge or Starting a chess game:

--------------------------------------------------
1. Windows -> Online Information
2. Right click the Name of the player and click Challenge
3. Send Challenge
4. Other player will Accept the Challenge
5. Play the game

CHESS Puzzles, Problems with solutions - mate in 3 by Two Bishops & King

CHESS PUZZLE:

White to move and mate in 3 moves.

This chess puzzle is an endgame problem of mating the opponent King using two Bishops with the help of the friendly King.


SOLUTION:

1. Ba6.
1... Kb8.
2. Bh2+.
2... Ka8.
3. Bb7 checkmate.

CHESS Puzzles, Problems with solutions - mate in 3 by Bishop & Knight

CHESS PUZZLE:

White to move and mate in 3 moves.

This chess puzzle is an endgame problem of mating the opponent King using only the Bishop and Knight with the help of the friendly King.


SOLUTION:

1. Ba6.
1... Ka8.
2. Bb7+.
2... Kb8.
3. Nc6 mate.

CHESS Puzzles, Problems with solutions - mate in 3

CHESS PUZZLE:

White to move and mate in 3 moves.
 
In this Chess puzzle, White to move and mates Black in 3 moves. The three pawns in the 7th rank are ready to be promoted. Note that this position is symmetrical. No matter which pawn Black captures, the solution to this chess problem of promoting pieces are the same, i.e. Bishop and then Rook.


SOLUTION:


1. Bd8=B.
1. Kxc6.
4. Rb8=R.
5. Kd6.
6. Rb6 checkmate.

Top 3 best places to play Free Live Chess online on the internet


There are so many sites to play live chess online on the web but some has too few members and it's hard to find someone to play with (opponent). Some sites has cool features and good interfaces but there are too much annoying ads and longer time to load meaning longer waiting times. Some websites has so small boards that you can't make it larger. Some has problems that I don't want to mention. Some sites are purely PAID (you have to purchase membership). I have tried and played on most of these sites but based on my own experience, these chess sites below are the:


Top 3 best places to play Free Live Chess online on the internet:


1. CHESS.COM ON FACEBOOK    http://apps.facebook.com/chessfb/

Chess.com http://www.chess.com/ is the best place to play Chess online on the internet. You can play live chess, correspondence (email) chess, tournaments, chess videos to learn from, chess tactics trainer, chess openings, chess mentor (virtual chess coach). You can also join chess groups, solve the Daily Chess Puzzle, see the Game of the Day, Opening of the Day and much more.

You can either play on the Facebook site or the Chess.com site (bigger board). Lots of available players from all over the world, friendly seek graph, cool interface, play against the computer, play with your friends, chat, chess analysis, select from many chess rooms, put on your flag/country, picture or avatar, has a chess forum and so much more resources. Note that some features are available only for paid members. Also note that being a free member is good enough to enjoy playing chess!


2. Free Internet Chess Server (FICS) http://www.freechess.org/  using BABASCHESS Client http://www.babaschess.net/

Free Internet Chess Server (freechess.org) is a free chess server with over 300,000 registered users. It is one of the oldest and one of the largest internet chess servers in the world. Availability to play various chess variants. Excellent for any level of the player. You can play also against the computer or any player in the world that is available.

BabasChess is a Free Internet Chess Client (Chess GUI - Graphical User Interface) used for playing on the FICS server. BabasChess can run on Windows and Linux operating systems. It has a nice, attractive, fast and customizable playing environment, with chat, emoticons, sound effects and other cool features. It also has a powerful PGN viewer/editor, chess engines support for analyzing positions, solving mates, chess puzzles and other grandmaster or classic games. BabasChess is totally free and supports many different major languages in the world. 


3. YAHOO CHESS  http://ca.games.yahoo.com/games/login?game=Chess

You need a Yahoo ID and password in order to play. Once logged in, you can select from four rooms namely: Social, Beginner, Intermediate, and Advanced. When you select a room, wait for the Java applet to load. If you click the Play Now button, and an opponent is available, you can then press Start Game to start playing chess. You can also click the Create Table to make ready a table, set time, sound, show last move options. Once a table is created, you can Invite a player or Boot a player. The Sit button will allow you to join the game with the corresponding color (Black or White).

The Yahoo Chess Games site and server has many players from all over the world with different levels of strength. It has also a nice, easy to navigate, friendly, and cool graphical user interface.

Top 10 & Top 20 Greatest, Strongest, Best, Most Brilliant Chess Players in the World of All Time Ever in History


Note: This list is subjective.

Top 10:
1. Garry Kasparov
2. Bobby Fischer
3. Anatoly Karpov
4. Emanuel Lasker
5. Alexander Alekhine
6. Mikhail Botvinnik
7. José Raúl Capablanca
8. Vladimir Kramnik
9. Boris Spassky
10. Tigran Petrosian

Top 20:
11. Wilhelm Steinitz
12. Max Euwe 
13. Vasily Smyslov
14. Mikhail Tal
15. Paul Morphy
16. Viswanathan Anand
17. Howard Staunton
18. Siegbert Tarrasch
19. Viktor Korchnoi
20. Paul Keres


Top 10 Chess Players with the Longest Reign of Championship:


Years as
Champion -- Rank ----- Name, Country of the World Champion

 27 --------- 1 --- Emanuel Lasker (longest chess champion), Germany
 17 --------- 2 --- Alexander Alekhine, Russia, France
 16 --------- 3 --- Anatoly Karpov, Russia
 15 --------- 4 --- Garry Kasparov, Russia, Azerbaijan, Soviet Union
 13 --------- 5 --- Mikhail Botvinnik, Finland, Soviet Union
 8 ---------- 6 --- Wilhelm Steinitz, USA & Bohemia *
 7 ---------- 7 --- Vladimir Kramnik, Russia, USSR
 6 ---------- 8 --- Tigran Petrosian, Georgia, USSR
 6 ---------- 9 --- José Raúl Capablanca, Cuba
 4 --------- 10 --- Viswanathan Anand, India

Bohemia * --> Czech Republic/Germany/Austria


Top 10 Chess Players with their Highest/Best Elo Ratings Ever Recorded:


Highest/Best
ELO Ratings --- Name of Grandmaster Chessplayer & (Country)

1. 2851 ------- Garry Kasparov (Russia, Azerbaijan, Soviet Union)
2. 2826 ------- Magnus Carlsen (Norway)
3. 2813 ------- Veselin Topalov (Bulgaria)
4. 2809 ------- Vladimir Kramnik (Russia)
5. 2803 -------    Viswanathan Anand (India)
6. 2788 -------    Alexander Morozevich (Russia)
7. 2787 -------    Vassily Ivanchuk (Ukraine)
8. 2786 -------    Levon Aronian (Armenia)
9. 2785 -------    Bobby Fischer (United States of America)
10. 2780 ------    Anatoly Karpov (Russia)

Friday, December 14, 2012

Chess Engine Programming - Checking the legal moves for White and Black on the first move

/*
PROGRAM 9: Chess Engine Programming - Checking the legal moves for White and Black on the first move

PURPOSE: On the first move of White, there are only 4 valid and legal Knight moves and also
         4 valid legal Knight moves for Black, making a total of 8 acceptable Knight moves
         on the first move. This program checks this validity using a hard coded method
         but it can also be done by reading from a file containing a list of all the legal
         moves on the first move of White or Black. It can also be tested using a procedure
         by coding the rules how the Knight moves in 'L-shaped' fashion, and other methods
         such as using a coordinate system and noting the "from square" (previous location)
         going to the "to square" (destination location).
         Also, on the first move for White, there are 16 legal and valid pawn moves and the
         same is true for Black, making a total of 32 acceptable pawn moves on the first
         move for White and Black. A total of 40 legal and valid moves (8 Knight moves and 32 Pawn moves)
         are possible on the first move of White and Black.
         This program assumes White is a Human Player and the Black Player is Computer. The user
         (player) enters a move first then the program tests the validity or legality of White's
         first move (in this case 20 legal moves). If White's move is acceptable, the Computer
         player responds with a move. If White Human Player moves any other move beside the
         20 acceptable moves, it will display an error to prompt the player "Illegal move.".

LANGUAGE: C++
AUTHOR: eternaltreasures
DATE: 2010 October 6
*/

#include <iostream>
#include <string>
using namespace std;

#define newline '\n'

string player_move;
string from_valid_move_choices = "e5";
int move_counter = 0;

int main ()
{
cout << endl;
cout << "Computer Chess Engine program 1.0" << endl << endl;
cout << "[Event: Chess Game Match]" << endl;
cout << "[Site: USA]" << endl;
cout << "[Date: 2010 October 6]" << endl;
cout << "[White: Human Player]" << endl;
cout << "[Black: Computer]" << endl << endl;

move_counter = move_counter + 1;

cout << "White Player: Please enter your move. " << move_counter << "."; cin >> player_move;

if  ((player_move == "Nf3") || (player_move == "Nh3")
  || (player_move == "Nc3") || (player_move == "Na3")
  || (player_move == "a3")  || (player_move == "a4")
  || (player_move == "b3")  || (player_move == "b4")
  || (player_move == "c3")  || (player_move == "c4")
  || (player_move == "d3")  || (player_move == "d4")
  || (player_move == "e3")  || (player_move == "e4")
  || (player_move == "f3")  || (player_move == "f4")
  || (player_move == "g3")  || (player_move == "g4")
  || (player_move == "h3")  || (player_move == "h4"))
     
   cout << "Thank you! Computer Player move is " << move_counter << "... " << from_valid_move_choices << endl;
else
   cout << "Illegal move." << endl << endl;

}

How to program a chess engine in C++ language compatible with Xboard/Winboard: Selection of player color


This is a function called by the main () function to let the player select the color he/she prefers. Options include 'w' for selecting the White pieces and 'b' for selecting the Black pieces. The program checks the user input with the expected letters w or b. If the user enters any other letters or characters, it will display the valid selection choices.

Source code:

/*
PROGRAM 8: Chess Engine Programming - Selection of player color
AUTHOR: eternaltreasures
DATE: 2010 September 26
TITLE: How to program a chess engine in C++ language compatible with Xboard/Winboard:
       Selection of player color
*/

#include <iostream>
#include <string>
using namespace std;

#define newline '\n'


void selectcolor ()
{
char playercolor = 'w';

cout << newline;

cout << "Please choose your color,  w or b: ";
cin >> playercolor;
if (playercolor == 'w')
{
cout << "playercolor w=" << playercolor;
}
else if (playercolor == 'b')
{
cout << "playercolor b=" << playercolor;
}
else
{
cout << newline;
cout << "Please select:";
cout << newline;
cout << "w for White";
cout << newline;
cout << "b for Black";
cout << newline;
cout << newline;
cout << "Wrong player color=" << playercolor;
}
}

int main ()
{
selectcolor ();

return 0;
}

How to program a chess engine in C++ language compatible with Xboard/Winboard: New Game or Board Setup


This function lets the user enter n for a new game or s for board setup for analysis, solve for mate, etc. If the user enters any other characters other than n or s, it will display "Invalid entry" and show the correct choices. If the user selects the expected letters n or s, it will just display "New game = n" or "Board Setup = s". If the user enters the correct letters, a series of functions and statements will follow further to proceed to the other validations of the program (which will not be covered in this article). I will try to cover each function in the chess engine program categorically as possible to make it clear and focused to only one topic at a time.

Source code:

/*
PROGRAM 7a: Chess Engine Programming - New Game or Board Setup
AUTHOR: eternaltreasures
DATE: 2010 September 26
TITLE: How to program a chess engine in C++ language compatible with Xboard/Winboard:
       New Game or Board Setup
*/

#include <iostream>
#include <string>
using namespace std;

#define newline '\n'

void newgame ()
{
char gamesetup = 'n';

cout << newline;

cout << "Enter n for New Game, s for Board Setup: ";
cin >> gamesetup;

if (gamesetup == 'n')
{
cout << "New Game = " << gamesetup;
}
else if (gamesetup == 's')
{
cout << "Board Setup = " << gamesetup;
}
else
{
cout << newline;
cout << "Invalid entry:";
cout << newline;
cout << newline;
cout << "Please Enter:";
cout << newline;
cout << "n for New Game";
cout << newline;
cout << "s for Board Setup";
cout << newline;
cout << newline;
cout << "Invalid entry = " << gamesetup;
cout << newline;
newgame ();
}
}

int main ()
{
newgame ();

return 0;
}

How to program a chess engine in C++ language compatible with Xboard/Winboard: Event, Site, Date, Game, Player info (pgn)


This function is called by the main () function to get the user input of his/her name and country of origin. An output pgn file is generated according to the standard chess pgn game file format. The date is obtained from the system date and the chess game result is yet unknown and so therefore '-' is placed.

Source code:

/*
PROGRAM 8: Chess Engine Programming - Event, Site, Date, Game, and Player information
AUTHOR: eternaltreasures
DATE: 2010 September 26
TITLE: How to program a chess engine in C++ language compatible with Xboard/Winboard:
       Event, Site, Date, Game, and Player information for output pgn file
*/

#include <iostream>
#include <time.h>
#include <fstream>
using namespace std;

#define newline '\n'

void eventgameinfo ()
{
string eventname = "Chess Game Match";
string eventsite = "International";
time_t systemdate;
string whiteplayer = "White Player";
string blackplayer = "Black Player";
string gameresult = " - ";
cout << newline;

//Capture system date and time
time(&systemdate);

//Open the output game.pgn file     
ofstream fout;    
fout.open ("game.pgn");

cout << "Please enter your name: "; cin >> whiteplayer;
cout << "Your country of origin: "; cin >> eventsite;
cout << newline;

//Information of the Event, Site, Date, Game, Player and Result (for game.pgn file format)
cout << "[Event " << "\"" << eventname << "\"]";
cout << newline;
cout << "[Site  " << "\"" << eventsite << "\"]";
cout << newline;
cout << "[Date  " << "\"" << ctime(&systemdate) << "\"]";
cout << newline;
cout << "[White  " << "\"" << whiteplayer << "\"]";
cout << newline;
cout << "[Black  " << "\"" << blackplayer << "\"]";
cout << newline;
cout << "[Result " << "\"" << gameresult << "\"]";
cout << newline;

//Write to the game.pgn file
fout << "[Event " << "\"" << eventname << "\"]";
fout << newline;
fout << "[Site  " << "\"" << eventsite << "\"]";
fout << newline;
fout << "[Date  " << "\"" << ctime(&systemdate) << "\"]";
fout << newline;
fout << "[White  " << "\"" << whiteplayer << "\"]";
fout << newline;
fout << "[Black  " << "\"" << blackplayer << "\"]";
fout << newline;
fout << "[Result " << "\"" << gameresult << "\"]";
fout << newline;

}

int main ()
{
eventgameinfo ();

return 0;
}

Chess Engine Programming - the 3 most important elements of a chess engine which enable it to think and decide the best


Legal Move Generator


This chess engine component checks whether the moves are valid or legal. There are certain movement rules for each piece of the board as well as special moves. There are 5 important pawn moves: Promotion, En passant (e.p.), Capture, Two-square move, and one-square move. Knights move in L-shaped squares and can move backwards. Bishops move along diagonals of the same color and can also move backwards. Rooks move any number of squares straight vertically or straight horizontally. Castling is a special rook movement in which it jumps over the King. The Queen moves like a Bishop and a Rook. It moves along diagonals, files, and ranks any number of squares forward or backward. The King can move any direction as long as it is one square only. The only exception to this rule is when it is castling wherein it moves two squares. The Legal Move Generator also checks Draws by three-fold repetition, Draw by 50-move rule, Draw by insufficient material to checkmate, White King checks, Black King checks, Checkmate and more.


Score Evaluation Function

This is the "brain" of the chess engine. It "thinks" and forms the basis for decision of the chess engine. It assigns values for any situation within the board. For every movement of the pieces there is a corresponding score computed. For example a move leading to a checkmate would have a high score, an exchange leading to a material advantage, a pawn promotion, a move making the opponent's pieces in a cramped position, centered pawns, centered Knights, centered Bishops, isolated pawns, rook-pawns, doubled pawns, discovered checks, rook battery, absolute pin, forks, regular pin, etc.


Search Algorithm

Chess engine programmers often use the Minimax algorithm to search the best move possible in a given particular board position and situation. It takes and tests moves from the Legal Move Generator and checks to find the minimum score for the opponent while maximum score for the engine. Minimax can also be understood as an algorithm to search for the best possible move in a given situation. The more move turns (plies) it searches, the deeper and better will be the move that will be generated. Time is also a function to bring out the best move. Transposition tables also provide a superior search return. Searches from a book of similar played games with known variations leading to a win is also a good supplement.

Thursday, December 13, 2012

Chess engine programming: Analysis of legal moves, plies, and total move combinations of chess pieces


Chess is one of the oldest classic games played on a board. The chess board is an 8 x 8 grid consisting a total of 64 equal squares. Chess is a game of perfect information because each player knows and sees all the moves and all the pieces in the board at all times. On the starting position of the game, White has 8 pawns, 2 rooks, 2 knights, 2 bishops, 1 queen, and 1 king for a total of 16 White pieces. Black on the other hand has exactly the same kinds and quantities of pieces but of the opposite color for a total of 16 Black pieces. With all the White and Black pieces combined, the total number of pieces at the start of the game of chess is 32.

On White's first move, there are a total of 20 legal or valid moves. On Black's first move, there are also a total of 20 legal or valid moves. There are a total of 400 possible move combinations (20 x 20) on each player's first moves. In chess engine programming terminologies, a player's turn is called a ply. Thus, 2 plies mean that White has made a move on his turn and Black has replied a move on Black's turn. Another way to understand a ply is to think that a pair of one White and one Black move equals 2 plies.

White's 20 legal moves on the first move:


Pawn moves
1. a3
2. a4
3. b3
4. b4
5. c3
6. c4
7. d3
8. d4
9. e3
10. e4
11. f3
12. f4
13. g3
14. g4
15. h3
16. h4

Knight moves
17. Nf3
18. Nh3
19. Nc3
20. Na3


Black's 20 legal moves on the first move:


Pawn moves
1. a6
2. a5
3. b6
4. b5
5. c6
6. c5
7. d6
8. d5
9. e6
10. e5
11. f6
12. f5
13. g6
14. g5
15. h6
16. h5

Knight moves
17. Nf6
18. Nh6
19. Nc6
20. Na6

Monday, December 10, 2012

How to Play Blindfold Chess: Basic Tips Tricks, Tactics, Techniques, Memory Trainer, Learning Methods to Visualize Board

Bb4 - Black's King Bishop checks the White King
Bb5 - White's King Bishop checks the Black King
Dividing the Board into 4 equal parts
Left diagonals
Nd5 - Centered Knight controls 8 critical squares on the Queen and King side
Ne4 - Centered Knight controls 8 critical squares on the King and Queen side
Nf5 - Control of the Kingside castling enemy territory
Qa4 - White's Queen checks Black's King on White territory (within 4th rank)
  
Qd5 - White's Queen forks Black's Rook and Knight
Qe4 - White's Queen delivers a forking check on the Black King and Rook
Qe5 - White's Queen checks Black's King and forks Black's Rook and Knight

Qh5 - White's Queen checks Black's King on enemy territory (5th rank)
Queen side (a-file to d-file), King side (e-file to h-file).
Ranks 1 to 4 is White's territory, Ranks 5 to 8 is Black's territory.
Right diagonals.
Two center diagonals - a1h8 and h1a8.
Upper left diagonals.
Upper right diagonals.