GO Solution For UVa 10196 - Check The Check. In this post we will see how we can solve this challenge in GoLang for UVa Online Judge.

Problem Description

Your task is to write a program that reads a chess board configuration and answers if there’s a king under attack (i.e. “in check”). A king is in check if it’s in a square which is attacked by an oponnet’s piece (i.e. it’s in square which can be taken by an oponnet’s piece in his next move).

White

...

You can find the full details of the problem Check The Check at UVa Online Judge

Sample Input

..k.....
ppp.pppp
........
.R...B..
........
........
PPPPPPPP
K.......

rnbqkbnr
pppppppp
........
........
........
........
PPPPPPPP
RNBQKBNR

rnbqk.nr
ppp..ppp
....p...
...p....
.bPP....
.....N..
PP..PPPP
RNBQKB.R

........
........
........
........
........
........
........
........

Sample Output

Game #1: black king is in check.
Game #2: no king is in check.
Game #3: white king is in check.

Solution: Please check the main.go snippet for the solution.

Solution originally posted at: Github by @codingsince1985