I recently posted a randomization program in TypeScript.
Here's an example (19 x 19, 6 stones) with explanations on how the algorithm works:
Subdivide the board into small rectangles:
. a b c d e f g h i j k l m n o p q r s
1 + + + + + + + + + + + + + + + + + + +
2 + + + + + + + + + + + + + + + + + + +
3 + + # # # + % % % + # # # + % % % + +
4 + + # # # + % % % + # # # + % % % + +
5 + + + + + + + + + + + + + + + + + + +
6 + + % % % + # # # + % % % + # # # + +
7 + + % % % + # # # + % % % + # # # + +
8 + + + + + + + + + + + + + + + + + + +
9 + + # # # + % % % + # # # + % % % + +
10 + + # # # + % % % + # # # + % % % + +
11 + + # # # + % % % + # # # + % % % + +
12 + + + + + + + + + + + + + + + + + + +
13 + + % % % + # # # + % % % + # # # + +
14 + + % % % + # # # + % % % + # # # + +
15 + + + + + + + + + + + + + + + + + + +
16 + + # # # + % % % + # # # + % % % + +
17 + + # # # + % % % + # # # + % % % + +
18 + + + + + + + + + + + + + + + + + + +
19 + + + + + + + + + + + + + + + + + + +
Pick a pair of adjoining small rectangles and combine them to make
one big rectangle for each stone to be placed.
Picking a rectangle makes its neighbors half as likely to be picked.
In the following diagram, numbers are weights for placing a stone
in the next step and shown in a manner of a windmill
('v'ertical and 'h'orizontal):
v + h v + + h h v + h h
v + + v + + + + h h + v
h h v h h h + v
. a b c d e f g h i j k l m n o p q r s
1 + + + + + + + + + + + + + + + + + + +
2 + + + + + + + + + + + + + + + + + + +
3 + + 1 % % % 3 2 1 + 2 % 1 + + + + + +
4 + + 3 3 3 3 % % 1 + 2 % % + + + + + +
5 + + + + + + + + + + 2 % % + + + + + +
6 + + 1 # 1 + + + + + % % 2 + + + + + +
7 + + 2 # # + + + + + 1 1 1 + + + + + +
8 + + 3 # # + + + + + + + + + + + + + +
9 + + # # 3 + + + + + + + + + + + + + +
10 + + # # 2 + + + + + + + + + + + + + +
11 + + 1 1 1 + + + + + + + + + + + + + +
12 + + + + + + + + + + + + + + + + + + +
13 + + 1 % % % 3 2 1 + + + + + 1 # 1 + +
14 + + 3 3 3 3 % % 1 + + + + + 2 # # + +
15 + + + + + + + + + + + + + + 2 # # + +
16 + + 1 # # # 3 2 1 + + + + + # # 2 + +
17 + + 3 3 3 3 # # 1 + + + + + 1 1 2 + +
18 + + + + + + + + + + + + + + + + + + +
19 + + + + + + + + + + + + + + + + + + +
Place stones:
. a b c d e f g h i j k l m n o p q r s
1 + + + + + + + + + + + + + + + + + + +
2 + + + + + + + + + + + + + + + + + + +
3 + + + + + + + + + + + + + + + + + + +
4 + + @ + + + + + + + + + + + + + + + +
5 + + + + + + + + + + + + + + + + + + +
6 + + + + + + + + + + + + + + + + + + +
7 + + + + + + + + + + + @ + + + + + + +
8 + + + + + + + + + + + + + + + + + + +
9 + + + @ + + + + + + + + + + + + + + +
10 + + + + + + + + + + + + + + + + + + +
11 + + + + + + + + + + + + + + + + + + +
12 + + + + + + + + + + + + + + + + + + +
13 + + + + + + + @ + + + + + + + + + + +
14 + + + + + + + + + + + + + + + + + + +
15 + + + + + + + + + + + + + + @ + + + +
16 + + + + + + + + + + + + + + + + + + +
17 + + + + + @ + + + + + + + + + + + + +
18 + + + + + + + + + + + + + + + + + + +
19 + + + + + + + + + + + + + + + + + + +
Other implementation considerations:
- In Custom Game screen, when Handicap is not “None”, show checkbox, something like “Randomize? handicap stones”.
- The algorithm accepts parameters for (a) minimum separation between a stone and the edge of the board, and (b) minimum separation between two stones. Whether to fix them to canonical values, say (2, 1), or to allow user customization.
- When a combination of parameters doesn’t leave enough space for the algorithm to work (corresponding to when the program throws an error), show a pop-up message akin to when AI doesn’t accept particular game settings. This would be unusual for larger board sizes but more common for smaller ones.
- In the list of challenges, show the warning icon (currently used to indicate custom komi).
- I hardly ever play handicap games.
- I play handicap games but am not interested in randomized ones.
- I like the idea of randomization but not the particular algorithm.
- I like the idea of randomization and am ok with the algorithm, at least until a better one is found.
- (self)
0 voters
EDIT:
One can try plain randomization as well as quadrant shuffling (“favor placing in every quadrant”) here:
https://runarberg.github.io/random-go-stone-placements/