## Weighted Voronoi

### Botty McBotFace

Click the "?" icon in-game for instructions.

Use the popup display and maximize it for the best experience.

## Rules of the Game

## Overview:

Given a set of point-sized stones of various colors, a Weighted Voronoi diagram is a tesselation of a plane into colored regions such that every point with integer coordinates (x, y) has the color of the stones that give it the greatest pull.

## Playing a Round:

Graviational Voronoi is a n player game that works as follows:

- n players are each assigned a color, and are each allocated W units of weight
- Each player can distribute their allotted weight across a maximum of S stones on a 500x500 board.
- The first player places one stone, then the second player places one stone and so on...
- Each player places one stone until all players have placed S stones or have exhausted all their weight.
- If a player cannot place a stone (either they have used all of their weight or placed all of their stones), their turn is skipped
- Additionally, every stone must be a Euclidean distance of at least d units away from any other stone.

n, S, W, and d are set at the beginning of every game.

The winner of a round is the player with the most controlled area at the end of the round.

## Ending a Game:

- If there are n players, the game runs for a total of n rounds, allowing each player to go first.
- At the end of the game (after n rounds), each players' scores over all rounds are summed.
- The player with the highest combined score over all n rounds is declared the winner!

## Pull Calculation:

The pull for a color c at point p with coordinates (x, y) is calculated as follows:

Supposing that color c has k stones placed:

- Take all k stones and compute their Euclidean distances to point p say d1, d2, ... dk.
- Take the weights of all k stones w1, ..., wk
- pull(c, p) = (w/(d1*d1)) + (w/(d2*d2)) + ... + (w/(dk*dk)).

It's as if we're computing the color of a point based on the color that gives the greatest pull.