aboutsummaryrefslogtreecommitdiff
path: root/configs/gen_corners.py
blob: e1f570109ed1ccde71a107f48da1f77d68d97953 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import json

import sys  # hacky way to import utils for now
sys.path.append("..")
from utils import rgb_to_hex


corner_shape = [  # giving all 4 corners have the same shape
    [0, 0, 0, 0],
    [0, 1, 1, 0],
    [0, 1, 1, 0],
    [0, 0, 0, 0],
]

center_color = [0, 0, 0]
corner_colors = {  # assuming each corner will only have two colors (center_color and a corner-specific color)
    0: [255, 0, 0],
    1: [0, 255, 0],
    2: [0, 0, 255],
    3: [255, 255, 255,]
}

center_color = rgb_to_hex(center_color)
corner_colors = {key: rgb_to_hex(val) for key, val in corner_colors.items()}

corner_colored_shapes = {
    corner_ind: [[corner_color if cell else center_color for cell in row] for row in corner_shape]
    for corner_ind, corner_color in corner_colors.items()
}

with open("corners_hollow4x4_v0.json", "w") as f:
    json.dump({
        "corner_colors": corner_colored_shapes,
        "corner_width": len(corner_shape[0]),
        "corner_height": len(corner_shape),
    }, f)