You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
531 B
18 lines
531 B
public typealias MoveCallback = ([Move.Action], Board) -> Move.Action
|
|
|
|
public class HumanPlayer : Player {
|
|
private let callback: MoveCallback
|
|
|
|
public override var type: PlayerType { .Human }
|
|
|
|
public init(name: String, piece_type: PieceType, callback: @escaping MoveCallback) {
|
|
self.callback = callback
|
|
|
|
super.init(name: name, piece_type: piece_type)
|
|
}
|
|
|
|
public override func chooseMove(allowed_moves moves: [Move.Action], board: Board) -> Move.Action {
|
|
callback(moves, board)
|
|
}
|
|
}
|