本文整理匯總了C#中GameState.MyY方法的典型用法代碼示例。如果您正苦於以下問題:C# GameState.MyY方法的具體用法?C# GameState.MyY怎麽用?C# GameState.MyY使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類GameState
的用法示例。
在下文中一共展示了GameState.MyY方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: AlphaBeta
private static float AlphaBeta(GameState gs, int depth, float alpha, float beta, bool isMax)
{
if (depth == 0 || gs.IsEndGame()) {
float val = EvaluateMove(gs);
return isMax ? val : -val;
}
Point p = null;
if (isMax) {
p = new Point(gs.MyX(), gs.MyY());
} else {
p = new Point(gs.OpponentX(), gs.OpponentY());
}
GameState newState = null;
foreach (Point child in gs.PossibleMoves(p.X, p.Y, true)) {
if (isMax) {
newState = gs.ApplyMoveToMeAndCreate(child.GetDirectionFromPoint(p.X, p.Y));
} else {
newState = gs.ApplyMoveToOpponentAndCreate(child.GetDirectionFromPoint(p.X, p.Y));
}
alpha = Math.Max (alpha, -AlphaBeta(newState, depth-1, -beta, -alpha, !isMax));
if (beta <= alpha) {
break;
}
}
return alpha;
}
示例2: GameState
public GameState(GameState gs)
: this(gs.map, gs.Width(), gs.Height(), new Point(gs.MyX(), gs.MyY()), new Point(gs.OpponentX(), gs.OpponentY()))
{
this.map = (bool[,])gs.map.Clone();
}
示例3: Territory
public Territory(GameState gs)
{
this.gs = gs;
this.me = new Point(gs.MyX(), gs.MyY());
this.you = new Point(gs.OpponentX(), gs.OpponentY());
}