Description:
In this challenge you are asked to calculate how many boxes are available to be taken in a move in the paper game
Dots and Boxes
Alias format & Parameters
The alias will be in the format:
$boxes(<lines going horizontal>,<lines going vertical>)
A line
going horizontal/vertical is
represented by "1".
No line
going horizontal/vertical in this position is
represented by "0".
The positions are read from left to right, top to bottom. To fully understand the data format, please see the examples below.
The input grid can consist of boxes which are already taken/filled. See figure 3. You can assume the grid will always be a square.
Simple examples
figure 1
$boxes(11 10 11,100 001) = 1
figure 2
$boxes(100 010 001 011,1111 1101 1100) = 4
figure 3
$boxes(111 110 101 111,1111 1101 1100) = 5
figure 4
$boxes(11111 10000 00000 01100 11101 11111,100100 101111 011011 100100 000000) = 5
figure 5
$boxes(111 000 011 111,0010 1100 0000) = 0
Validation
You can assume;
- The grid only consists of 1's and 0's and new cols/rows are seperated by spaces
- Grid is a square
- Up to a grid size 10x10 will be tested.
Further reading & Sources
Example:
$boxes(11 00 00,111 111) = 4
$boxes(01 00 00,111 111) = 2
$boxes(000 000 000 111,1111 1111 1000) = 0
$boxes(111 000 000 111,1111 1111 1000) = 9
$boxes(0010 1000 0000 0000 0000,00110 11110 11110 10010) = 5
Rules:
Alias name must be 'boxes'
No dlls, coms, sockets
One submission per user per entry type.
Script must give correct results after consecutive runs.
Testing conditions:
Alias will be run on mIRC v6.35 and loaded into the remotes section.
Last closing bracket can be omitted }
Your code will be taken for EXACTLY as-is.
Alias will be run on a mIRC with no variables set - a clean mIRC.