ACSL Programming Project


December 11th, 2013

ACSL Programming Project due by Monday, December 16th

Duodecim Scripta

PROBLEM: Duodecim Scripta, 12 Lines, is an ancient Roman board game. It is played on a board as shown below with each of its two players starting with 15 markers on his home square. Each player’s markers are a different color. The object of the game is for a player to move all his markers to his opponent’s home square.

HOME-1	I	II	III	IV	V	VI	VII	VIII	IX	X	XI	XII
HOME-2	XXIV	XXIII	XXII	XXI	XX	XIX	XVIII	XVII	XVI	XV	XIV	XIII

The rules of the game are as follows:
1. For each turn, three number cubes are rolled. The markers are moved according to the result of the roll. A player can move one, two or three of his markers by using the result of the 3 number cubes or by combining them. A roll of a 5, a 4 and a 3 can be played as follows: move one marker 12 squares forward, or move one piece 9 squares forward and a second piece 3 squares forward, or move one piece 3 squares forward, a second piece 4 squares forward and a third piece 5 squares forward. The three number cube results can be combined in any of the many combinations possible to move one, two or three markers.

2. If a player’s marker is alone on a square and an opponent’s marker lands on the square, then the player’s marker must be placed back on his home square. If two or more markers are on one square, then the opponent may not land there. No more than five markers may occupy the same square.

Your task is to play a given result of a roll of the number cubes with the following priorities:

Your markers will start from HOME-1. Move as many of your markers as possible as far as possible off your home square. That is, if you can move all three markers, do so. If you can only move two markers using all three number cubes, move one of the markers as far from the home square as possible and move the second marker using the remaining number cube. Otherwise, move one marker using the highest sum possible. If no moves are possible off the home square print the word “none”.

INPUT: Given: how many of the numbered squares your markers occupy, the number of your markers at given locations, how many of the numbered squares your opponent occupies, the number of your opponent’s markers at given locations and the results of the number cube roll. Sample data 1 states that you have 3 occupied squares as follows: 4 markers at location 4, 5 markers at location 7, and 2 markers at location 10. Your opponent has 4 occupied squares as follows: 2 markers at location 9, 1 marker at location 13, 5 markers at location 15 and 3 markers at location 21. The results of the roll are 3, 4 and 5.

OUTPUT: Print the location of all your markers not on the Home-1 space. In the example above you can move all three markers with the following result: 1 marker at location 3, 5 at location 4, 1 at location 5, 5 at location 7, and 2 at location 10.

SAMPLE INPUT				SAMPLE OUTPUT

1.  3, 4,4,5,7,2,10,4,2,9,1,13,5,15,3,21,3,4,5		1.  1,3,5,4,1,5,5,7,2,10
2.  3,5,1,5,2,2,3,3,5,4,5,5,5,6, 1,2,3			2.  5,1,5,2,4,3
3.  3,5,1,5,2,2,3,3,5,4,5,5,5,6,3,6,4			3.  5,1,5,2,3,3,1,10