-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGameBoardUtils.cs
32 lines (29 loc) · 1.06 KB
/
GameBoardUtils.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
namespace Renju.Core
{
using System.Linq;
using Infrastructure.Execution;
using Infrastructure.Model;
using AI;
public static class GameBoardUtils
{
public static IReadBoardState<IReadOnlyBoardPoint> With(this IReadBoardState<IReadOnlyBoardPoint> board, IReadOnlyBoardPoint point)
{
return new GameBoardDecoration(board, point);
}
public static IReadOnlyBoardPoint As(this IReadOnlyBoardPoint point, Side side, IReadBoardState<IReadOnlyBoardPoint> board)
{
return new VirtualBoardPoint(point, side, board.DroppedPoints.Count() + 1);
}
public static ExecutionTimer GetExecutionTimer(this IGameBoard<IReadOnlyBoardPoint> gameBoard, IGamePlayer player)
{
if (player is ResolverBasedAIGamePlayer)
{
return (player as ResolverBasedAIGamePlayer).Resolver.ExecutionTimer;
}
else
{
return new SideExecutionReporter(gameBoard, player.Side).ExecutionTimer;
}
}
}
}