This is a first attempt.
The page contains JavaScript wrappers for the routines that perform and take back moves and the handler for mouse clicks.
The Giant is represented by Vizirs on every square it covers.
A 'first click' (for origin selection) on a Vizir is rounded to the lower-left corner of the 2x2 area.
The move wrappers test whether the moving piece is a Vizir, and if so drags the other 3 with it
after saving the old occupants of the destinations (to restore those on take back).
The remaining part is controlled by a custom routine giantTinker.
For Vizir moves it suppresses those that are not left-corner.
Moves with the latter are suppressed if there are friends in the destination area,
and get a burn zone covering that area added when accepted.
Captures of a Vizir by other pieces are initially rejected, but backlogged in an array of spares.
After move generation a newly ntroduced custom routine AddSpares (requires browser cache flush!)
makes two passes through the list of spares;
first it records all attacked squares, and then it test for every move whether all squares covered by the giant it hits
are under attack.
If so, the move is copied to the normal move list.
I did not address the issue of Cannons jumping over a Giant yet.
This is a first attempt. The page contains JavaScript wrappers for the routines that perform and take back moves and the handler for mouse clicks. The Giant is represented by Vizirs on every square it covers. A 'first click' (for origin selection) on a Vizir is rounded to the lower-left corner of the 2x2 area. The move wrappers test whether the moving piece is a Vizir, and if so drags the other 3 with it after saving the old occupants of the destinations (to restore those on take back).
The remaining part is controlled by a custom routine giantTinker. For Vizir moves it suppresses those that are not left-corner. Moves with the latter are suppressed if there are friends in the destination area, and get a burn zone covering that area added when accepted.
Captures of a Vizir by other pieces are initially rejected, but backlogged in an array of spares. After move generation a newly ntroduced custom routine AddSpares (requires browser cache flush!) makes two passes through the list of spares; first it records all attacked squares, and then it test for every move whether all squares covered by the giant it hits are under attack. If so, the move is copied to the normal move list.
I did not address the issue of Cannons jumping over a Giant yet.