## On the Subject of Cell Lab

Luckily, modules don’t do mitosis.

This module displays a lot of text. This is the data of a multicellular species. However, some bits of data have been lost. In order to solve the module, fix this data. Note: you will have to calculate H, S and V each only once.

The bottom three lines of text display the red, green and blue values in a range of 0–255. These must be converted to HSV.

### RGB to HSV

In order to calculate the hue, you must first obtain the range it is in. In the table + indicates the highest channel, and - the lowest. If there are ties pick the first entry in the table in reading order that applies partially (255, 255, 0 can be +0- and 0+-, so we take the +0- entry)

 +0- 0+- -+0 -0+ 0-+ +-0 0–60 60–120 120–180 180–240 240–300 300–360

Then use the following formula to get an offset value O. Minimum, maximum and the value in between are respectively labeled as C-, C+ and C*

O = (C*-C-)/(C+-C-) * 60

If your colour had an odd position in the table, add O to the left value. Otherwise subtract O from the right value. Round this value down to get your hue.

To get your saturation use the formula below and round down.

S = (C+-C-)/C+ * 100

To get your brightness use the formula below and round down.

V = C+/2.55

If any calculations did not make sense due to division by zero, ignore their values. They will not be used later.

Note: a normal HSV converter rounds differently. Please refrain from using them to avoid off-by-one errors.

### HSV to Data

With these HSV values themselves we can’t do a lot, so we need to convert these values.

If either the brightness or the saturation is below 5, ignore these steps and set the split mass to never.

The split mass and split angle are based on the hue, labeled as H:

msplit = (H%15) * 0.22ng

θ = ⌊H/15⌋ * 15

The children have their angles based on saturation (child 1) and brightness (child 2), respectively labeled S and V

α = ((S-5)%24) * 15

β = ((V-5)%24) * 15

The next calculations are for the boxes to check. If the calculation results in a 1 it must be checked.

Bp = ⌊(V-5)/48⌋

Bc1 = ⌊(S-5)/24⌋ % 2

Bc2 = ⌊(V-5)/24⌋ % 2

Note: ⌊x⌋ is a floor function. It rounds down the value within the brackets.

### Cell Type

Cells come in various types. Take the amount of other cells that have a specific cell as a child, double it, and add 1 if the cell also gets referred to by itself. plug this number into the table below to get a cells type.

 0 1 2 3 4 5 lipocyte keratinocyte flagellocyte phagocyte photocyte devorocyte lp kt fl pg pt dv

### User Interface

To cycle through your cells, press the M# text next to Edit mode.

To edit values, press them (as long as you’re allowed to edit them).

The module will automatically solve once everything is put in correctly.