CCC Othello Problem

Been stuck trying to complete the 2006 problem 5 for 3 days, so i decide to suck in my pride look at the key, I tried the key multiple times and requires me to have a good understand of 2D array handling(which i suck at). So i was wondering if any can give the answer and some what explain the process.

Its a bit long...

Othello is a game played on a 8x8 board(like a checker board). The game invovles placing circular discs one at a time on the board. The discs are coloured black on one side and white on the other. One player places his/her discs with the white side up and the other player places his/her discs with the black side up.

The game starts with some discs already placed on the board.

A move is valid if the following two conditions are satisfied:

1. The piece placed on board is adjacent to a piece on the board(diagonally also counts).

2.at least one of your opponents discs must be flipped. You flip your opponents pieces as long your opponents pieces are between your pieces.

In the CCC version of Othello the board may start with one of the 3 configurations. Play will always start with the black player taking the first turn, and the alternating white to black for the rest of the turns. You must write a program to simulate taking turns in an Othello game and at the end report how many pieces of each colour are on the board.

Input Specifications:
The users will enter three components of input.

First the user will enter a letter representing the configuration of the initial board.

Here are the initial configurations for the board.

(This is where picture comes in i will just explain.)
Configuration A has 4 discs, 2 of them are black and the other two are white.
they are placed on the center of the 8x8 board in a diagonial pattern.
W|B
B|W

Configuration B has 16 discs in an X formation on the 8x8 board. one line of the X is black and the other is white.

Configuartion C has 34 discs on the 8x8 board 2 colomns are all black and the other 2 colomns next to it is all white.

The second component of input will be an integer n, where 0<=n<=30 which indicates the number of monves in the simulation. The third component of input is n pairs of integers (R,C) where 1<=R<=8 and 1<=C<=8, nad R represents the row and C represents the column of the next move.

Remember that the first move will be made by the black player, the next move will also assume that all moves (R,C) will be valid moves on empty spaces on the board.

Output specifications
The program will output the number of black discs showing followed by the number of white discs showing on the board after the moves have been made. You are not responsible for displaying a picture of the board.

Sample input 1
a 1 5 6
Sample output for input 1
4 1
Sample input 2
b 0
Sample output for input 1
8 8

EDIT: links if you need them. http://mmhs.ca/ccc/2006/2006juniorproblems.pdf
http://mmhs.ca/ccc/2006/2006j5othello.txt
Last edited on
Topic archived. No new replies allowed.