O'Reilly logo

Game Programming using Qt 5 Beginner's Guide - Second Edition by Lorenz Haas, Witold Wysota, Pavel Strakhov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

What just happened?

To test the implementation, you can modify the algorithm to fill the board with the default piece set up by introducing the following change to the ChessAlgorithm class:

void ChessAlgorithm::newGame()
{
  setupBoard();
  board()->setFen(
      "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"
  );
} 

Running the program should show the following result:

The modification we did in this step was very simple. First, we provided a way to tell the board what each piece type looks like. This includes not only standard chess pieces but anything that fits into char and can be set inside the ChessBoard class's internal data array. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required