Removed useless index
This commit is contained in:
@@ -121,7 +121,6 @@ public class Board: CustomStringConvertible, EventDelegate {
|
|||||||
let index = Int8(i)
|
let index = Int8(i)
|
||||||
let square = Square(
|
let square = Square(
|
||||||
position: .init(rank: rank, file: (index % 8) + 1),
|
position: .init(rank: rank, file: (index % 8) + 1),
|
||||||
index: i,
|
|
||||||
color: index % 2 != rank % 2 ? .Black : .White)
|
color: index % 2 != rank % 2 ? .Black : .White)
|
||||||
squares.append(square)
|
squares.append(square)
|
||||||
if (index + 1) % 8 == 0 {
|
if (index + 1) % 8 == 0 {
|
||||||
|
|||||||
@@ -33,6 +33,19 @@ public struct Square: Equatable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public var value: Int8 {
|
||||||
|
return switch self {
|
||||||
|
case .a: 1
|
||||||
|
case .b: 2
|
||||||
|
case .c: 3
|
||||||
|
case .d: 4
|
||||||
|
case .e: 5
|
||||||
|
case .f: 6
|
||||||
|
case .g: 7
|
||||||
|
case .h: 8
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public var description: String {
|
public var description: String {
|
||||||
self.rawValue.uppercased()
|
self.rawValue.uppercased()
|
||||||
}
|
}
|
||||||
@@ -60,7 +73,6 @@ public struct Square: Equatable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public let position: Position
|
public let position: Position
|
||||||
public let index: Int
|
|
||||||
public internal(set) var piece: Piece? = nil
|
public internal(set) var piece: Piece? = nil
|
||||||
public let color: Color
|
public let color: Color
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user