You are given a set of points in the unit square with the property that no three points lie on a single line. You play against an opponent, alternating moves. The aim is to connect points in such a way that a closed cycle of at least 3 points is formed. A player who closes a cycle of length scores points.
A player may choose any two points to join with a straight line, as long as that line does not cross an existing line segment in the game.
If a player closes a cycle, then all points on the cycle are removed from the game, along with each line that has an endpoint on the cycle.
The game continues until fewer than three points remain. You cannot ``skip'' a turn. The winner is the player with the most points.
For example, consider the following board.
Player 1 and player 2 play as shown in the left diagram below. Player 2 has formed a 3-cycle, so player 2 scores 3 points and the triangle is removed, as in the right diagram below.
You are required to write a program to play this game against an opponent, with the aim of winning the game. We will provide interface specifications and a driver program that checks the legality of moves.
Think about some special cases:
We will run tournaments for various kinds of dot maps.