Moving pieces

In order to move pieces first create a board (see other guides). Then, once you have a board call:

board.movePieceByPos(
	new PiecePosition(fromX,fromY),
	new PiecePosition(toX,toY)
);

When you build the PiecePosition objects above you must make sure that the fromX, fromY, toX, toY values passed to the method are valid numbers in the [0..8) range. You must also make sure that a piece is in the from position and that the two position does not have a piece. If you fail to do that then the method may fail with an exception or some worse way. Using this method the board will do no verification that the move is a valid chess move in any way. You must make sure of that (parse a correct PGN file, do it yourself etc.). Currently the board does not support verficiation of moves, although that is in the TODO list.

fromX: fromY: toX: toY:


errors:

Copyright Mark Veltzer © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024 mark.veltzer@gmail.com