Programming a Chess Game in C# | Part 12 - Pawn Promotions

Опубликовано: 23 Март 2026
на канале: OttoBotCode
4,745
101

Learn how to program a Chess game in C#!

Welcome to part 12 of my C# Chess tutorial.
In this part, we add pawn promotions to the game!
We begin by writing a class which represents the pawn promotion move.
After that, we add code to the Pawn class to make it generate these moves.
To enable the player to choose the promotion piece, we then create a "Promotion Menu".
When a player wants to promote a pawn, we show this menu on the screen.
Finally, when a piece has been chosen, we execute the resulting move.

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

Source code is available here:
  / 78701  

Chapters:
0:00 - Plan
0:11 - Pawn Promotions
1:00 - Promotion Move
5:45 - Generate The Move
10:01 - Design Promotion Menu
15:19 - Make Menu Usable
17:51 - Show Menu & Execute Promotions
22:15 - End Result!