Programming a Chess Game in C# | Part 18 - Threefold Repetition I

Опубликовано: 24 Март 2026
на канале: OttoBotCode
3,811
73

Learn how to program a Chess game in C#!

Welcome to part 18 of my C# Chess tutorial.
In this video we start working on the final feature for our game - The Threefold Repetition Rule.
It states that a player can claim a draw if the same state is reached 3 times in a game.
Our implementation of the rule will automatically end the game with game with a draw, if a state is reached for the third time.
But when exactly are two states considered equal?
We begin by covering the three criteria which must be satisfied for state equality.
Based on the insight gained, we add methods for checking castling rights, and whether a player can capture en-passant or not.
In the next video, we will use this code to complete our implementation of the Threefold Repetition Rule.

Assets:
https://ottobotcode.com/chess/ChessAs...

Source code is available here:
  / 78701  

Chapters:
0:00 - Threefold Repetition Rule
0:23 - State Equality
2:55 - Check Castling Rights
7:24 - Check En Passant