Crossmate/Models/PlayerSelection.swift (933B)
1import Foundation
2
3
4
5
6
7struct PlayerSelection: Sendable, Equatable {
8 let row: Int
9 let col: Int
10 let direction: Puzzle.Direction
11}
12
13extension Puzzle.Direction {
14
15
16 var rawValue: Int {
17 switch self {
18 case .across: return 0
19 case .down: return 1
20 }
21 }
22
23 init?(rawValue: Int) {
24 switch rawValue {
25 case 0: self = .across
26 case 1: self = .down
27 default: return nil
28 }
29 }
30}
31
32extension PlayerSelection {
33 typealias Direction = Puzzle.Direction
34}