Skip to content

Commit

Permalink
get rid of fromDimensions
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianHicks committed Jan 12, 2020
1 parent 4b4ddaf commit d906071
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 23 deletions.
23 changes: 1 addition & 22 deletions src/Grid.elm
@@ -1,4 +1,4 @@
module Grid exposing (FromRowsAndColumnsProblem, Grid, fromDimensions, fromRowsAndColumns, fromRowsAndColumnsArray, get, getWrapping, indexedMap, initialize, map, rotate, set, toArrays, topLeft, update, view, windows)
module Grid exposing (FromRowsAndColumnsProblem, Grid, fromRowsAndColumns, fromRowsAndColumnsArray, get, getWrapping, indexedMap, initialize, map, rotate, set, toArrays, topLeft, update, view, windows)

import Array exposing (Array)
import Color.Transparent as Color exposing (Color)
Expand Down Expand Up @@ -30,27 +30,6 @@ initialize { rows, columns } init =
}


{-| TODO remove this or initialize
-}
fromDimensions : ({ row : Int, column : Int } -> a) -> { rows : Int, columns : Int } -> Grid a
fromDimensions initter { rows, columns } =
Grid
{ width = columns
, height = rows
, items =
Array.initialize rows
(\rowNum ->
Array.initialize columns
(\colNum ->
initter
{ row = rowNum
, column = colNum
}
)
)
}


{-| Construct a grid from a list of lists. The outer list is a list of rows,
and the inner lists are values in columns.
Expand Down
3 changes: 2 additions & 1 deletion src/Wave.elm
Expand Up @@ -74,10 +74,11 @@ init rules weights dimensions =
|> Heap.thenBy (.coords >> .column)
)
, items =
Grid.fromDimensions (always initialCell)
Grid.initialize
{ rows = dimensions.height
, columns = dimensions.width
}
(always initialCell)
}


Expand Down

0 comments on commit d906071

Please sign in to comment.