Piece, WIP Board

featuring XCode & MacOS unusability
Boards
Mathieu GROUSSEAU 1 month ago
parent 36284a0903
commit 0b27a3ff67

1
.gitignore vendored

@ -1,3 +1,4 @@
# MacOS
.DS_Store
# ---> Swift

@ -1,6 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:../CustomTypes">
</FileRef>
<FileRef
location = "group:CLI/CLI.xcodeproj">
</FileRef>

@ -0,0 +1,14 @@
public struct Board {
var grid: [[Piece?]]
public init(width: Int, height: Int) throws {
// guard width > 0, height > 0 else {
// // TODO: Swift std error?
// }
self.init(grid: Array(repeating: Array(repeating: nil, count: height), count: width))
}
public init(grid: [[Piece?]]) {
self.grid = grid
}
}

@ -1,6 +0,0 @@
public struct Model {
public private(set) var text = "Hello, World!"
public init() {
}
}

@ -0,0 +1,3 @@
public enum Piece {
case Player1, Player2
}
Loading…
Cancel
Save