Conquer Chess
Chess and Starcraft combined
Loading...
Searching...
No Matches
Functions
test_rules.cpp File Reference
#include "test_rules.h"
#include "game_controller.h"
#include <cassert>
Include dependency graph for test_rules.cpp:

Functions

void test_rule_1_2 ()
 
void test_rule_1_4_1 ()
 
void test_rule_1_5 ()
 
void test_rule_2_1 ()
 
void test_rule_2_2 ()
 
void test_rule_2_3 ()
 
void test_rule_3_1 ()
 
void test_rule_3_2 ()
 
void test_rule_3_3 ()
 
void test_rule_3_4 ()
 
void test_rule_3_5 ()
 
void test_rule_3_6 ()
 
void test_rule_3_7 ()
 
void test_rules ()
 Test if the FIDE Laws of Chess are followed.
 

Function Documentation

◆ test_rule_1_2()

void test_rule_1_2 ( )

[1.2] The player with the light-coloured pieces (White) makes the first move, then the players move alternately, with the player with the dark-coloured pieces (Black) making the next move.

In Conquer Chess, white can make multiple moves during the time of the first move. After waiting for the duration of one chess move, black can start doing its many moves.

◆ test_rule_1_4_1()

void test_rule_1_4_1 ( )

[1.4.1] The player who achieves this goal is said to have ‘checkmated’ the opponent’s king and to have won the game. Leaving one’s own king under attack, exposing one’s own king to attack and also 'capturing' the opponent’s king is not allowed.

◆ test_rule_1_5()

void test_rule_1_5 ( )

[1.5]. If the position is such that neither player can possibly checkmate the opponent’s king, the game is drawn (see Article 5.2.2).

◆ test_rule_2_1()

void test_rule_2_1 ( )

[2.1] The chessboard is composed of an 8 x 8 grid of 64 equal squares alternately light (the ‘white’ squares) and dark (the ‘black’ squares).

The chessboard is placed between the players in such a way that the near corner square to the right of the player is white.

◆ test_rule_2_2()

void test_rule_2_2 ( )

[2.2] At the beginning of the game White has 16 light-coloured pieces (the ‘white’ pieces); Black has 16 dark-coloured pieces (the ‘black’ pieces).

◆ test_rule_2_3()

void test_rule_2_3 ( )

[2.3]. The initial position of the pieces on the chessboard is as follows:

rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1

◆ test_rule_3_1()

void test_rule_3_1 ( )

[3.1] It is not permitted to move a piece to a square occupied by a piece of the same colour.

[3.1.1] If a piece moves to a square occupied by an opponent's piece the latter is captured and removed from the chessboard as part of the same move.

[3.1.2] A piece is said to attack an opponent's piece if the piece could make a capture on that square according to Articles 3.2 to 3.8.

[3.1.3] A piece is considered to attack a square even if this piece is constrained from moving to that square because it would then leave or place the king of its own colour under attack.

◆ test_rule_3_2()

void test_rule_3_2 ( )
  • [3.2] The bishop may move to any square along a diagonal on which it stands.

◆ test_rule_3_3()

void test_rule_3_3 ( )
  • [3.3] The rook may move to any square along the file or the rank on which it stands.

◆ test_rule_3_4()

void test_rule_3_4 ( )

[3.4] The queen may move to any square along the file, the rank or a diagonal on which it stands.

◆ test_rule_3_5()

void test_rule_3_5 ( )

[3.5] When making these moves, the bishop, rook or queen may not move over any intervening pieces.

◆ test_rule_3_6()

void test_rule_3_6 ( )

[3.6] The knight may move to one of the squares nearest to that on which it stands but not on the same rank, file or diagonal.

◆ test_rule_3_7()

void test_rule_3_7 ( )

[3.7] The pawn:

  • [3.7.1] The pawn may move forward to the square immediately in front of it on the same file, provided that this square is unoccupied, or

[3.7.2] on its first move the pawn may move as in 3.7.1 or alternatively it may advance two squares along the same file, provided that both squares are unoccupied, or

[3.7.3] the pawn may move to a square occupied by an opponent's piece diagonally in front of it on an adjacent file, capturing that piece.

[3.7.3.1] A pawn occupying a square on the same rank as and on an adjacent file to an opponent's pawn which has just advanced two squares in one move from its original square may capture this opponent's pawn as though the latter had been moved only one square.

[3.7.3.2] This capture is only legal on the move following this advance and is called an ‘en passant' capture.

[3.7.3.3] When a player, having the move, plays a pawn to the rank furthest from its starting position, he/she must exchange that pawn as part of the same move for a new queen, rook, bishop or knight of the same colour on the intended square of arrival. This is called the square of ‘promotion'.

[3.7.3.4] The player's choice is not restricted to pieces that have been captured previously.

[3.7.3.5] This exchange of a pawn for another piece is called promotion, and the effect of the new piece is immediate.

◆ test_rules()

void test_rules ( )

Test if the FIDE Laws of Chess are followed.