Skip to content

Commit bf2ce56

Browse files
Refactor
1 parent 73389d0 commit bf2ce56

File tree

1 file changed

+4
-24
lines changed

1 file changed

+4
-24
lines changed

tictactoe Shared/GameScene.swift

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -26,30 +26,10 @@ class GameScene: SKScene {
2626
/// Enumeration for players, representing X and O with unique properties.
2727
enum Player: Int {
2828
case x = 1, o
29-
30-
var symbol: String {
31-
@inline(__always) get {
32-
["", ""][rawValue - 1]
33-
}
34-
}
35-
36-
var isTextBased: Bool {
37-
@inline(__always) get {
38-
self == .x
39-
}
40-
}
41-
42-
var fontColor: GameColor {
43-
@inline(__always) get {
44-
[GameColor.red, GameColor.blue][rawValue - 1]
45-
}
46-
}
47-
48-
var next: Player {
49-
@inline(__always) get {
50-
self == .x ? .o : .x
51-
}
52-
}
29+
var symbol: String { ["", ""][rawValue - 1] }
30+
var isTextBased: Bool { self == .x }
31+
var fontColor: GameColor { [GameColor.red, GameColor.blue][rawValue - 1] }
32+
var next: Player { self == .x ? .o : .x }
5333
}
5434

5535
/// Enumeration for the game state, indicating whether the game is ongoing, won, or a draw.

0 commit comments

Comments
 (0)