Evaluation
public enum Evaluation<T: Score>
Game state evaluation
-
Evaluation of a victory with additional score value
Declaration
Swift
case Victory(T)
-
Evaluation of a defeat with additional score value
Declaration
Swift
case Defeat(T)
-
Evaluation of a draw additional score value
Declaration
Swift
case Draw(T)
-
Evaluation of an ongoing game with additional score value
Declaration
Swift
case Ongoing(T)
-
Checks whether
self
is a not ongoing.Declaration
Swift
public var isFinal: Bool
Return Value
false
iffself
is.Ongoing(_)
, otherwisetrue
-
Checks whether
self
is a victory.Declaration
Swift
public var isVictory: Bool
Return Value
true
iffself
is.Victory(_)
, otherwisefalse
-
Checks whether
self
is a defeat.Declaration
Swift
public var isDefeat: Bool
Return Value
true
iffself
is.Defeat(_)
, otherwisefalse
-
Checks whether
self
is a draw.Declaration
Swift
public var isDraw: Bool
Return Value
true
iffself
is.Draw(_)
, otherwisefalse
-
Inverses
self
by swapping.Victory()
with.Defeat()
and the value (in all cases).Declaration
Swift
public func inverse() -> Evaluation
Return Value
.Victory(-v)
iffself
is.Defeat(v)
and vice versa, otherwise.Draw|Ongoing(-v)
-
The worst possible evaluation
Declaration
Swift
public static var min: Evaluation
Return Value
.Defeat(-Double.infinity)
-
The best possible evaluation
Declaration
Swift
public static var max: Evaluation
Return Value
.Victory(Double.infinity)