CodePSU 2019 - Advanced


2019-03-24 09:15 AKDT

CodePSU 2019 - Advanced


2019-03-24 13:15 AKDT
The end is near!
Contest is over.
Not yet started.
Contest is starting in -671 days 2:42:26

Time elapsed


Time remaining


Problem B
Chess Kills

This question requires you to use some basic knowledge of chess.

Joe is trying to play speed chess. While he knows how to play chess, there can be up to $32$ pieces on the board at any given moment, and some of them can kill his opponents’ pieces, others can’t. Processing all of this in a limited period of time is way too much for Joe. Luckily, Joe is a programmer and decides that he can use a computer vision application that has been sitting around at the Autonomous Systems Lab at Southorp Grimmyn and use it in his free time to play chess.

The computer visions app is already set up to recognize different chess pieces on a $8\times 8$ board and turn them into a $8$ lines of comma-separated text data denoting whether a box in the board has a chess piece (turns out Bob wasn’t the first one to use this program for chess). Bob is always playing as white and his pieces always start from the top of the board. But these comma-separated lines of information just confused Joe more. So, Joe’s new problem is to somehow build a program that can use the comma-separated outputs given by the defense program and isolate which pieces of his can kill how many of his enemy’s pieces. He implements his chess strategies according to those outputs.

It’s your job to interpret the comma-separated file that Joe gives you and help him win some chess matches for once.


There are always exactly $8$ lines of input to this program. Each line is composed of $15$ characters. The data that is being comma separated can be one of a few things.

  • Your King (K) - exactly one such piece

  • Your Queen (Q) - up to one such piece

  • Your knight (k) - up to $2$ such pieces

  • Your bishop (b) - up to $2$ such pieces

  • Your rook (r) - up to $2$ such pieces

  • Your pawn (p) - up to $8$ such pieces

  • Enemy unit (x) - up to $16$ such pieces …


The output is composed of multiple lines of a character followed by a number. The order of the output should follow the same order as specified above (i.e. K,Q,k,b,r,p) The character is the symbol representing one of your chess pieces. This is followed by an integer representing the total number of your opponent’s pieces that your pieces of that type can take. Pieces that cannot take any other piece are not mentioned. If there are no kills possible, output “No Kills Possible”

Sample Input 1 Sample Output 1
 , , , ,p, , , 
 ,K, , , ,x, , 
 ,b,p,x, ,Q,b, 
p, ,x, ,p, , , 
 , ,p, ,k, ,x, 
 ,p,x, ,r,x, , 
 , , , , , , ,p
p, , , , ,p,k, 
Q: 3
k: 4
b: 2
r: 2
p: 1
Sample Input 2 Sample Output 2
 , , , , , , , 
 , , , , , , , 
 , , , , , , , 
 , , , , , , , 
No Kills Possible