private void AnalyseScoreForHints() { ResetCheckOutHints(); if (_configurationData.ShowCheckoutHints && SelectedGame.ShowCheckOutHints && GetCurrentPlayer().DartsToThrow > 0) { var gameParameters = GetGameParameters(); CheckoutHints = _currentGameService.GetCheckOutHints(gameParameters); if (CheckoutHints.Any()) { HintList = CheckoutHints.Select(hint => new HintList { HintDarts = hint.Item2.Split(' ').Select ((dart, index) => new Hint { HintText = dart, HintImage = GetImage(index) }).ToList() }).ToList(); // If user can still checkout remove hints that are more than current number of darts if (GetCurrentPlayer().DartsToThrow < 3 && HintList.Any(hint => hint.HintDarts.Count <= GetCurrentPlayer().DartsToThrow)) { HintList = HintList.Where(hint => hint.HintDarts.Count <= GetCurrentPlayer().DartsToThrow).ToList(); } } } }
/// <summary> /// 지역 탐색 /// </summary> /// <param name="y"></param> /// <param name="x"></param> private void ScanArea(int y, int x) { if (y < 0 || y >= row || x < 0 || x >= col) { return; } if (Copy[y][x].UseFlag) { return; } else { if (Map[y][x].IsCheck == false) { Map[y][x].IsCheck = true; if (Copy[y][x].MineCountHint != null && Copy[y][x].MineCountHint > 0) { HintList.Add(new CellInfo(y, x, Copy[y][x].MineCountHint, true, false)); } if (Copy[y][x].MineCountHint == 0) { ScanArea(y - 1, x - 1); ScanArea(y - 1, x); ScanArea(y - 1, x + 1); ScanArea(y, x - 1); ScanArea(y, x + 1); ScanArea(y + 1, x - 1); ScanArea(y + 1, x); ScanArea(y + 1, x + 1); } } } }
/// <summary> /// 플래그 셀 검색 /// </summary> /// <returns></returns> private bool CheckHintList() { bool rtnValue = true; for (int i = 0; i < HintList.Count; i++) { List <CellInfo> aroundList = GetAroundCell(HintList[i].Y, HintList[i].X, out int cmdValue); // 주변셀가져오기. if (cmdValue != 40) { if (cmdValue == 30) { int removeIdx = FindAtList(HintList, HintList[i].Y, HintList[i].X); if (removeIdx > 0) { HintList.RemoveAt(removeIdx); i--; } } else { AddCellByCmd(aroundList, cmdValue); } } } return(rtnValue); }
public bool CanChooseNumber(SimpleNumber thisNumber) //done. { if (thisNumber.Used == true) { throw new BasicBlankException("It should not have considered this number because it was already used."); } return(SaveRoot !.HintList.Any(items => items == thisNumber.Value)); }
public virtual bool LoadHintList(params long[] hintNums) // Note: Hint numbers are 1-based { var result = true; try { var line = ""; var hintDatFile = Globals.Path.Combine(AdventureFolderPath, "HINTDIR.DAT"); using (var file = new System.IO.StreamReader(hintDatFile)) { line = file.ReadLine(); if (!long.TryParse(line.Trim(), out _nh)) { throw new Exception("Error: TryParse function call failed for _nh"); } for (var i = 0; i < _nh; i++) { var hint = new EDXHint(); line = file.ReadLine(); hint.Question = line.Trim(); line = file.ReadLine(); var tokens = line.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); if (!long.TryParse(tokens[0], out hint._hptr)) { throw new Exception(string.Format("Error: TryParse function call failed for record number {0} _hptr", i)); } if (tokens.Length > 1) { if (!long.TryParse(tokens[1], out hint._nh)) { throw new Exception(string.Format("Error: TryParse function call failed for record number {0} _nh", i)); } } else { line = file.ReadLine(); if (!long.TryParse(line.Trim(), out hint._nh)) { throw new Exception(string.Format("Error: TryParse function call failed for record number {0} _nh", i)); } } if (hintNums == null || hintNums.Length <= 0 || hintNums.Contains(i + 1)) { HintList.Add(hint); } } } } catch (Exception ex) { ErrorMessage = ex.Message; result = false; } return(result); }
private void AddHintList(int y, int x, int?hintValue, bool useFlag) { HintList.Add(new CellInfo(y, x, hintValue, true, useFlag)); Map[y][x].IsCheck = true; }