Closed sabu36 closed 4 years ago
I'm trying to figure out if they can be reorganized.
no allocation
probability distribution
weights
uniform initialization
no adjustments
with adjustments
stair initialization
no adjustments
with adjustments
with allocation
points
probability distribution
rectangles
probability distribution
weights
uniform initialization
no adjustments
with adjustments
stair initialization
no adjustments
with adjustments
Still haven't figured out the details but the following might work.
new Config properties:
allocator: whole | stars | quadrants | dominoes
placer: distUniform | distNormal | weightsUniform | weightsStair
weightAdjuster: none | linearTaxicabDistance // only used for placer: weights-
And possibly:
/**
* @typedef { [number, number] } Point
* @typedef { [Point, Point] } Rectangle
*/
/** @type { Point[] | Rectangle[] } */
const allocation = allocators[config.allocator](totalStones, config);
/** @type { Point[] } */
const stones = placers[config.placer](totalStones, config, allocation);
/** @type { Placement[] } */
const placements = assignPlayers(stones, config.handicap);
Now the combinations can be tried on the webpage, although some options are on top of each other and can't be selected. Dropdown menus that only show pairable options might be better.
The only combination that seems to be working as intended is whole-board + uniform-distribution. There's no placer that can be paired with allocator stars
yet.
There are type check errors related to using .reduce()
on Point[] | Rectangle[]
. I tried typeof
and instanceof
to narrow down the type but I couldn't make them work.
After some bug fixes, I followed along with console.log()
and Grid.consoleLog()
, and all the combinations seem to be working as intended. (I could test overlapped options by clicking on an option above and using an arrow key.)
I also added a place-holder option to place star points as they are.
The same type check errors remain (one more but the same reason).
Trying to improve the situation, I split allocators and placers into "point" and "rectangle" subcategories.
I ran into 2 problems:
|
for config.allocator
and config.placer
, leading to the similar type check error as before.I fixed the type check errors by separating out "type of allocator" into its own radio-fieldset, as well as splitting point- and rectangle-based allocators and placers.
Having only one radio button didn't count as RadioNodeList and led to "DOM failure" so I added "dummy" to some radio-fieldset's.
The bottom half of the webpage needs reorganization. I don't have any ideas yet but do you, @runarberg ? And sorry for the chaos.
One idea is to separate into tabs:
I haven't verified what's going on internally but the redone generators work without errors.
I added another basic generator called
stair
, in which weights are equal to distance to nearest edge (or with offset from margins). I haven't figured out how to test a new generator without adding it to the menu so it's still untested.In addition, quadrant and domino shuffles now have 4 options each, which are just combination with other generators.