本文整理汇总了C#中GameState.getStoneCoords方法的典型用法代码示例。如果您正苦于以下问题:C# GameState.getStoneCoords方法的具体用法?C# GameState.getStoneCoords怎么用?C# GameState.getStoneCoords使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GameState
的用法示例。
在下文中一共展示了GameState.getStoneCoords方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: evaluate
public static int evaluate(GameState gameState)
{
int score=0;
List<Coordinate> coordinateList = gameState.getStoneCoords();
int
player = gameState.getTurn(),
enemy = (player==1) ? 2 : 1 ,
pStones=0,
eStones=0,
pBlocked=0,
eBlocked=0,
pWin=0,
pDistance=0,
eDistance=0,
cellValue=0;
foreach ( Coordinate coordinate in coordinateList )
{
cellValue = gameState.getCell(coordinate);
if (cellValue == player)
{
pStones += 1;
pBlocked += gameState.isBlocked(coordinate) ? 1 : 0;
pDistance += (17 - gameState.deviation(4,16,coordinate.getLine(),coordinate.getColumn()));
}
else if (cellValue == enemy)
{
eStones += 1;
eBlocked += gameState.isBlocked(coordinate) ? 1 : 0;
eDistance += (17 - gameState.deviation(4,0,coordinate.getLine(),coordinate.getColumn()));
}
}
if ( gameState.isEndofGameByGoal() || eStones==eBlocked ) // win
{
gameState.setEndGame(true);
gameState.setWinner(player);
pWin = 1;
}
if (mode == 1 || (mode == 2 && player == 1) || (mode == 2 && player == 2))
{
score = (gameState.getWinner()>0) ?
(
(pWin * player_winValue)
) :
(
(pStones * player_stoneValue) +
(eStones * enemy_stoneValue) +
(pBlocked * player_blockedValue) +
(eBlocked * enemy_blockedValue) +
(pDistance * player_distanceToGoalValue) +
(eDistance * enemy_distanceToGoalValue)
);
}
else
{
score = (gameState.getWinner()>0) ?
(
(pWin * player_winValue2)
) :
(
(pStones * player_stoneValue2) +
(eStones * enemy_stoneValue2) +
(pBlocked * player_blockedValue2) +
(eBlocked * enemy_blockedValue2) +
(pDistance * player_distanceToGoalValue2) +
(eDistance * enemy_distanceToGoalValue2)
);
}
//Debug.Log ("Player >>"+ player+" "+score +" :: " + pWin + " "+ pStones + " "+ eStones + " "+ pBlocked + " "+ eBlocked + " "+ pDistance + " " + eDistance );
return score;
}