Skip to content

Commit

Permalink
Increase board size to 15, change multiplier layout
Browse files Browse the repository at this point in the history
  • Loading branch information
Jcparkyn committed Jan 4, 2024
1 parent 38a02c5 commit 0552264
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 28 deletions.
4 changes: 2 additions & 2 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<script>
"use strict";
const cellSizePx = 55;
const gridSize = 14;
const gridSize = 15;
const gapPx = 4;
customElements.define('scroll-repeat', class extends HTMLElement {
constructor() { super(); }
Expand All @@ -43,7 +43,7 @@
const grid = document.querySelector(".grid");
const maxDim = Math.max(this.offsetWidth, this.offsetHeight);
const offsetWidth = this.offsetWidth;
const visualGridSizePx = cellSizePx * (gridSize + 1) + gapPx * gridSize;
const visualGridSizePx = cellSizePx * gridSize + gapPx * gridSize;
// Zoom level that would fit one partial grid perfectly in the scroll-repeat
const zoomToFit = maxDim / partialGridSizePx;
// Zoom level that would fit the "visual" grid (with duplicated edges) perfectly in the scroll-repeat
Expand Down
4 changes: 2 additions & 2 deletions public/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
--col-placed-tile: #fff;
--col-cell: #2d2d2d;
--col-success: #84ff7a;
--grid-size: 14;
--grid-size: 15;
--grid-gap: 4px;
--default-board-size: calc((var(--cell-size) + var(--grid-gap)) * (var(--grid-size) + 1));
--tile-border-radius: 10px;
Expand Down Expand Up @@ -114,7 +114,7 @@ dialog > form {
display: grid;
grid-template-columns: auto auto auto;
grid-template-rows: auto auto auto;
grid-gap: var(--grid-gap);
grid-gap: calc(var(--grid-gap) * 2);
}

.grid {
Expand Down
49 changes: 25 additions & 24 deletions src/Checker.elm
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ type CheckerResult

gridSize : Int
gridSize =
14
15


maxRackSize : Int
Expand All @@ -43,36 +43,37 @@ maxRackSize =
multipliers : Array2D Multiplier
multipliers =
let
normalize n =
abs (n - gridSize // 2)
-- Repeat a tile in all four quadrants
tile ( x, y ) val =
[ ( ( x, y ), val )
, ( ( y, -x ), val )
, ( ( -x, -y ), val )
, ( ( -y, x ), val )
]

multDict =
Dict.fromList
[ ( ( 7, 7 ), Multiplier 1 3 )
, ( ( 7, 0 ), Multiplier 1 3 )
, ( ( 0, 7 ), Multiplier 1 3 )
, ( ( 7, 4 ), Multiplier 2 1 )
, ( ( 4, 7 ), Multiplier 2 1 )
, ( ( 2, 6 ), Multiplier 3 1 )
, ( ( 6, 2 ), Multiplier 3 1 )
, ( ( 1, 5 ), Multiplier 2 1 )
, ( ( 0, 4 ), Multiplier 2 1 )
, ( ( 4, 0 ), Multiplier 2 1 )
, ( ( 5, 1 ), Multiplier 2 1 )
, ( ( 6, 6 ), Multiplier 1 2 )
, ( ( 5, 5 ), Multiplier 1 2 )
, ( ( 4, 4 ), Multiplier 1 2 )
, ( ( 3, 3 ), Multiplier 1 2 )
, ( ( 2, 2 ), Multiplier 3 1 )
, ( ( 1, 1 ), Multiplier 2 1 )
, ( ( 0, 0 ), Multiplier 1 2 )
]
Dict.fromList <|
( ( 0, 0 ), Multiplier 1 2 )
:: tile ( 6, 1 ) (Multiplier 1 2)
++ tile ( 3, 4 ) (Multiplier 1 2)
++ tile ( 2, 7 ) (Multiplier 1 2)
++ tile ( 5, 6 ) (Multiplier 1 3)
++ tile ( 4, 3 ) (Multiplier 1 3)
++ tile ( 2, 2 ) (Multiplier 3 1)
++ tile ( 7, 7 ) (Multiplier 3 1)
++ tile ( 5, 2 ) (Multiplier 3 1)
++ tile ( 7, 0 ) (Multiplier 3 1)
++ tile ( 7, 4 ) (Multiplier 2 1)
++ tile ( 1, 1 ) (Multiplier 2 1)
++ tile ( 6, 5 ) (Multiplier 2 1)
++ tile ( 4, 7 ) (Multiplier 2 1)
++ tile ( 3, 0 ) (Multiplier 2 1)
in
Array2D.initialize gridSize
gridSize
(\x y ->
multDict
|> Dict.get ( normalize x, normalize y )
|> Dict.get ( x - gridSize // 2, y - gridSize // 2 )
|> Maybe.withDefault (Multiplier 1 1)
)

Expand Down

0 comments on commit 0552264

Please sign in to comment.