本文整理汇总了C#中HRSim.Playfield.getBoardValue方法的典型用法代码示例。如果您正苦于以下问题:C# Playfield.getBoardValue方法的具体用法?C# Playfield.getBoardValue怎么用?C# Playfield.getBoardValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HRSim.Playfield
的用法示例。
在下文中一共展示了Playfield.getBoardValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: addToMap
//Return true is already exist
// false if non-exist
public override bool addToMap(Playfield state)
{
float key = getHashkey(state);
//Helpfunctions.Instance.logg("end key = " + key);
if (TTable.ContainsKey(key))
{
foreach (Playfield existState in TTable[key])
{
if (existState.isHandEqual(state, true))
{
return true;
}
}
if (TTable[key][0].getBoardValue() < state.getBoardValue())
{
//Helpfunctions.Instance.logg("orig board " + TTable[key][0].getBoardValue());
//TTable[key][0].debugMinions();
//Helpfunctions.Instance.logg("new board " + state.getBoardValue());
//state.debugMinions();
TTable[key][0] = state;
}
return false;
}
else
{
TTable.Add(key, new List<Playfield>());
TTable[key].Add(state);
}
return false;
}
示例2: sample
public float sample(Node p)
{
Playfield startState = new Playfield(p.state);
Action move = null;
int turn = p.depth;
//Helpfunctions.Instance.logg("turn: " + turn);
int score = startState.getGameResult();
while (score == -1)
{
//List<Action> moves = Movegenerator.Instance.getMoveList(startState, false, false, true);
//if (move != null)
//{
//GameManager.Instance.moveCount++;
//if (GameManager.Instance.moveCount == 562)
//{
// int debug = 1;
//}
//var milliseconds = (DateTime.Now - DateTime.MinValue).TotalMilliseconds;
Movegenerator.Instance.getMoveListForPlayfield(startState, false);
//double time = (DateTime.Now - DateTime.MinValue).TotalMilliseconds - milliseconds;
//GameManager.Instance.myTimer += time;
//Helpfunctions.Instance.logg("my:" + time + " total:" + GameManager.Instance.myTimer);
//milliseconds = (DateTime.Now - DateTime.MinValue).TotalMilliseconds;
//List<Action> bruteForceMoves = Movegenerator.Instance.getMoveList(startState, false, true, true);
//time = (DateTime.Now - DateTime.MinValue).TotalMilliseconds - milliseconds;
//GameManager.Instance.sfTimer += time;
//Helpfunctions.Instance.logg("sf:" + time + " total:" + GameManager.Instance.sfTimer);
//if (bruteForceMoves.Count != startState.moveList.Count) {
// startState.printBoard();
// int debug = 1;
// Helpfunctions.Instance.logg("BF Move List:------------------------------------");
// foreach (Action action in bruteForceMoves)
// {
// action.print();
// }
// startState.printMoveList();
//}
//}
//Helpfunctions.Instance.logg("Count: " + startState.moveList.Count);
if (startState.moveList.Count == 0)
{
startState.endTurn(false, false);
//Helpfunctions.Instance.logg("Turn = " + startState.isOwnTurn);
if (!isEndReached)
{
//if (startState.isOwnTurn && this.playerSide == 1 || !startState.isOwnTurn && this.playerSide == 0)
//{
// turn++;
// //Helpfunctions.Instance.logg("Turn++");
//}
turn++;
move = null;
if (turn == rolloutDepth) //evaluate at deapth == 5
{
//startState.printBoard();
float value = startState.getBoardValue();
//Helpfunctions.Instance.logg("value = " + value);
if (value > bestValue)
{
bestBoard = new Playfield(startState);
bestValue = value;
}
return value;
}
}
}
else
{
move = startState.moveList[GameManager.getRNG().Next(startState.moveList.Count)];
startState.doAction(move);
}
score = startState.getGameResult();
}
isEndReached = true;
if (playerSide == score)
{
return 1;
}
return 0;
}