You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
749 B
32 lines
749 B
//
|
|
// File.swift
|
|
//
|
|
//
|
|
// Created by Louis DUFOUR on 15/01/2024.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
public struct Cell {
|
|
public let cellType: CellType
|
|
public var initialOwner: Owner
|
|
public var piece: Piece?
|
|
|
|
public init(ofType cellType: CellType, ownedBy initialOwner: Owner = .noOne, withPiece piece: Piece? = nil) {
|
|
self.cellType = cellType
|
|
self.initialOwner = initialOwner
|
|
self.piece = piece
|
|
}
|
|
|
|
public var description: String {
|
|
var pieceDescription = "nil"
|
|
if let piece = piece {
|
|
pieceDescription = piece.description
|
|
}
|
|
return "Cell(type: (cellType), owner: (initialOwner), piece: (pieceDescription))"
|
|
}
|
|
}
|
|
|
|
|
|
|