/* StoreDataへ格納(並列) */ private int storeFieldsForParallel(AGI_CalcFields agicF, int parentId, int stoneId, int kinds, int placeIdx, AGI_CalcFields beforeAgiF, int evalKind) { int retId = -1; /* 各種登録 */ /* ID取得 */ StoreData regist = new StoreData(true, agicF, commonMap); /* store登録 */ /* stoneの登録(親のstoneを受け継ぐ) */ if (storeDataDic.ContainsKey(parentId) == true) { for (int i = 0; i < storeDataDic[parentId].GetStoneInfoSize(); i++) { regist.SetStoneInfo(storeDataDic[parentId].GetStoneInfoId(i), storeDataDic[parentId].GetStoneInfoPlace(i), storeDataDic[parentId].GetStoneInfoKind(i)); } int passStoneSize = stoneId - regist.GetFinallyStoneId(); regist.SetStoneInfo(stoneId, placeIdx, kinds); regist.score = calcScore(agicF); switch (evalKind) { case EVAL_A: /* サイズが大きいほど有利 */ regist.evalue = calcEvalInitial(agicF, beforeAgiF, smallOrderList[stoneId]); break; case EVAL_B: regist.evalue = calcEvalDepth(agicF, beforeAgiF, smallOrderList[stoneId]); break; case EVAL_C: regist.evalue = calcEvalSizeKai(agicF, beforeAgiF, regist.score, passStoneSize, smallOrderList[stoneId]); break; default: regist.evalue = calcEvalSizeKai(agicF, beforeAgiF, regist.score, passStoneSize, smallOrderList[stoneId]); break; } for (int i = 0; i < storeDataDic[parentId].GetEvalueListSize(); i++) { regist.SetEvalueList(storeDataDic[parentId].GetEvalueInfo(i)); } regist.SetEvalueList(regist.evalue); regist.lastAttackStone = stoneId; Object thisLock = new Object(); lock (thisLock) { if (saveStoreDataDic.ContainsKey(regist.ID) != true) { try { saveStoreDataDic.Add(regist.ID, regist); } catch (System.ArgumentException) { saveStoreDataDic[regist.ID] = regist; } } else { saveStoreDataDic[regist.ID] = regist; } } retId = regist.ID; } return retId; }
/* StoreDataへ格納(並列) */ private int storeFieldsForParallelLast(StoreData sdt, int lastAttack) { int retId = -1; /* 各種登録 */ /* ID取得 */ StoreData regist = new StoreData(true, sdt.GetAgiCalcFields(), commonMap); /* store登録 */ /* stoneの登録(親のstoneを受け継ぐ) */ for (int i = 0; i < sdt.GetStoneInfoSize(); i++) { regist.SetStoneInfo(sdt.GetStoneInfoId(i), sdt.GetStoneInfoPlace(i), sdt.GetStoneInfoKind(i)); } regist.score = sdt.score; for (int i = 0; i < sdt.GetEvalueListSize(); i++) { regist.SetEvalueList(sdt.GetEvalueInfo(i)); } regist.lastAttackStone = lastAttack; Object thisLock = new Object(); lock (thisLock) { if (saveStoreDataDic.ContainsKey(regist.ID) != true) { saveStoreDataDic[regist.ID] = regist; } } retId = regist.ID; return retId; }
/* StoreDataへ格納 */ private int storeFields(AGI_CalcFields agicF, int parentId, int stoneId, int kinds, int placeIdx, AGI_CalcFields beforeAgiF, int evalKind) { int retId = -1; /* 各種登録 */ /* ID取得 */ StoreData regist = new StoreData(true, agicF, commonMap); /* stoneの登録(親のstoneを受け継ぐ) */ for (int i = 0; i < storeDataDic[parentId].GetStoneInfoSize(); i++) { regist.SetStoneInfo(storeDataDic[parentId].GetStoneInfoId(i), storeDataDic[parentId].GetStoneInfoPlace(i), storeDataDic[parentId].GetStoneInfoKind(i)); } int passSize = regist.GetFinallyStoneId() - stoneId; regist.SetStoneInfo(stoneId, placeIdx, kinds); regist.score = calcScore(agicF); if (evalKind == EVAL_A) { /* サイズが大きいほど有利 */ regist.evalue = calcEvalInitial(agicF, beforeAgiF, smallOrderList[stoneId]); } else if (evalKind == EVAL_B) { regist.evalue = calcEvalDepth(agicF, beforeAgiF, smallOrderList[stoneId]); } else { regist.evalue = calcEvalSizeKai(agicF, beforeAgiF, regist.score, passSize, smallOrderList[stoneId]); } regist.closed = agicF.closed; storeDataDic.Add(regist.ID, regist); regist.lastAttackStone = stoneId; retId = regist.ID; return retId; }