Checkers or Draughts is a popular 2 player board game where the opponent discs are recorded by leaping over them. The goal of the video game is to catch as numerous discs of the challenger as possible or if the challenger has no legitimate moves delegated make.
The game takes place on an 8 * 8 chess board as revealed listed below.
Each player inhabits among the 2 sides of the chess board where the pawns are positioned. Black goes initially.
– Each player begins with 12 colored discs.
– The discs are located such that each gamer has a light square on the right side corner closest to him or her.
– Each gamer puts his/her discs on the 12 dark squares closest to him or her.
– Black relocations first and gamers alternate henceforth.
– Moves are enabled only on the dark squares, so the discs always move diagonally. discs are always limited to forward moves (towards the challenger ).
– There are 2 type of moves – Catching and Non-Capturing relocations. In both types of relocations, gamer can just move/jump to an uninhabited position.
– Non-Capturing relocations might move just one square.
– If more than 1 Non-Capturing relocations exist, any of the relocations can be played.
– A disc making a Recording relocation leaps over one of the challenger’s discs that is 1 square away from itself and lands in a straight diagonal line, which is 2 squares away from itself. A dive can make just 1 capture, but the exact same disc can record several challenger discs by doing several dives in a single relocation.
– A recorded disc is eliminated from the board.
– If a Recording move exists, the dive needs to be made. If more than one capture exists, a choice can be made.
– A gamer reaching the opponent’s side of the board is crowned as a King. King’s move resembles that of a regular disc’s move but limitation of forward only moves are raised for the King’s relocation. Multiple King’s might exist.
– White discs exist at the bottom of the board and the black discs exist at the top of the board.
Black discs are represented by character ‘b’ (ascii worth 98) and white discs are represented by character ‘w’ (ascii worth 119). King’s of respective discs are represented by ‘B’ (ascii worth 66) and ‘W’ (ascii value 87). Empty squares are represented by character ‘_’ (ascii value 95).
The very first line of the input contains the gamer’s character ‘b’ or ‘w’ suggesting the gamer’s turn.
The second line includes the size of the board (L).
L lines follow each including L characters as discussed above.
For a Non-Capturing move, print 3 lines.
The very first line including the number 1 indicating 1 hop has been made.
The 2nd line consists of 2 space apart integers indicating the position of the disc to be moved.
The third line consists of 2 area apart integers showing the brand-new position of the disc.
For a Capturing relocation,.
the very first line includes an integer suggesting the number of hops (H) made while capturing. H +1 lines follow.
The very first line consists of 2 area apart integers suggesting the disc that is making the capture.
H lines follow each line suggesting the brand-new position to which the disc has hopped to.