|
|
|
@ -61,10 +61,10 @@ public struct Board {
|
|
|
|
|
// insertion coordinate computation is intentionally separated from actual insertion because the user may want to
|
|
|
|
|
// display a where the piece would end-up before doing the actual insertion
|
|
|
|
|
|
|
|
|
|
public func getInsertionCoordinates(direction: Direction, offset: Int) -> Coords {
|
|
|
|
|
public func getInsertionCoordinates(from: Direction, offset: Int) -> Coords {
|
|
|
|
|
precondition(offset >= 0, "Offset out of bounds")
|
|
|
|
|
|
|
|
|
|
switch direction {
|
|
|
|
|
switch from {
|
|
|
|
|
case .Top:
|
|
|
|
|
precondition(offset < self.columns, "Offset (column) out of bounds")
|
|
|
|
|
return Coords(offset, 0)
|
|
|
|
|