Last active
November 30, 2016 00:09
-
-
Save stepheng/21eb373d546ad9251a6b71ffd9c8a11f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let tileString = "0100100000" + | |
"0111100110" + | |
"0111101010" + | |
"0001001000" + | |
"0011000100" + | |
"0011100010" + | |
"0011110010" + | |
"0011110010" + | |
"0001110010" + | |
"0011111100" | |
tiles = [[Tile]]() | |
for row in 1...height { | |
var rowArray = [Tile]() | |
for col in 0..<width { | |
let indexVal = ((height - row) * width) + col | |
let index = tileString.index(tileString.startIndex, offsetBy: indexVal) | |
let character = tileString[index] | |
let value = Int(String(character))! | |
let tile = Tile(pos: (col, row), hidden: true, colorIndex: value) | |
rowArray.append(tile) | |
} | |
tiles.append(rowArray) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment