fy"> void CreateLogicCells ()
{= new List lt; LogicCell gt; (); (int i=1; i lt;=Settings.MatrixSize; i ++)
{(int j=1; j lt;=Settings.MatrixSize; j ++)
{. Add (new LogicCell
{= i,=j,=String.Empty
});
}
} middleRowIndex=Settings.MatrixSize/2 + 1;=new List lt; LogicCell gt; () ;. Where (cell= gt; cell.Y == middleRowIndex)
. ToList ()
. ForEach (cell= gt; {MainWordLogicCells.Add (cell) ;. IsMainWorldCell=true;
});
}
void SetFirstWord (String mainWord)
{(mainWord.Length!=Settings.MatrixSize)
{new Exception ( Start wold more then matrix size );
} mainWorldBuilder=new StringBuilder (mainWord); (int i=0; i lt; Settings.MatrixSize; i ++)
{[i] .Letter=mainWorldBuilder [i] .ToString (); (MainWordLogicCells);
}
}
void StartGame ()
{= Players.First (pl= gt; pl.Number == 1); ();
}
bool TrySelectCellForInsertingLetter (LogicCell logCell)
{(! String.IsNullOrEmpty (logCell.Letter))
{(GamePlayMessages.CellMustBeEmpty); false;
} (! IsOneOfNeigborsContainsLetter (logCell))
{(GamePlayMessages.NeighborMustContainLetter); false;
}
=logCell; (new List lt; LogicCell gt; {logCell}); (String.Empty); (GamePlayMessages.InsertLetter); true;
}
bool LetterIsValidForInserting (string letter)
{true;
}
public void SetLetterToCell (string letter)
{. Letter=letter;=false;=false; (new List lt; LogicCell gt; {selectedCell}); (letter); ();
}
bool IsLogicCellValidForWordSelection (LogicCell logCell)
{(SelectedCellsForWord!=null)
{(String.IsNullOrEmpty (logCell.Letter))
{= true; false;
} (SelectedCellsForWord.Contains (logCell) amp; amp; (SelectedCellsForWord.Last ()!=logCell))
{
{(logCell);=false; (GetCurentSelectedWord ());
} false;
} (SelectedCellsForWord.Contains (logCell) amp; amp; (SelectedCellsForWord.Last () == logCell))
{false;
} (SelectedCellsForWord.Count!=0)
{(! IsLogicCellsNeighbors (logCell, SelectedCellsForWord.Last ()))
{false;
}
}
} true;
}
bool IsLogicCellsNeighbors (LogicCell firstCell, LogicCell secondCell)
{((firstCell == null) || (secondCell == null))
{false;
} neighbors=GetNeighborsForCell (firstCell); neighbors.Contains (secondCell);
}
private List lt; LogicCell gt; GetNeighborsForCell (LogicCell logicCell)
{high=GetCellByLogicCor (logicCell.X, logicCell.Y + 1); low=GetCellByLogicCor (logicCell.X, logicCell.Y - 1); left=GetCellByLogicCor (logicCell.X - 1, logicCell.Y); right=GetCellByLogicCor (logicCell.X + 1, logicCell.Y); list=new List lt; LogicCell gt; (); (high!=null) list.Add (high); (low!=null) list.Add (low); (left!=null) list.Add (left); (right!=null) list.Add (right ); list;
}
bool IsOneOfNeigborsContainsLetter (LogicCell logicCell)
{flag=false; (logicCell) .ForEach (lc= gt;
{(lc!=null)
{(! String.IsNullOrEmpty (lc.Letter))
{= true;
}
}
}); flag;
}
private LogicCell GetCellByLogicCor (int x, int y)
{LogicCells.FirstOrDefault (lc= gt; (lc.X == x) amp; amp; (lc.Y == y));
}
void HandleDoubleCellInWordSelection (LogicCell cell)
{index=SelectedCellsForWord.IndexOf (cell); temp=SelectedCellsForWord.Take (index + 1) .ToList (); (int i=index + 1; i lt; SelectedCellsForWord.Count; i +...