/// <summary> /// The order of the yielded indexes is: bottom-left, top-left, top-right. /// /// 0 1 2 3 /// 1 \ \ \ /// 2\ \ \ /// 3 \ \ \ /// </summary> /// <returns></returns> public IEnumerable <Tuple <int, int> > GetDiagonalOneIndexes() { foreach (int row in RowIndexes.Reverse()) { yield return(new Tuple <int, int>(row, 0)); } // Skip the col == 0, because it has been used when yield row indexes. foreach (int col in ColIndexes.Skip(1)) { yield return(new Tuple <int, int>(0, col)); } }
internal void CheckCommandsForIndexes() { bool isTransposed = false; foreach (Command command in Commands) { if ((command as TransposeCommand) != null) { isTransposed = !isTransposed; } var indexedCommand = command as IUseIndexes; if (indexedCommand != null) { foreach (Index usedIndex in indexedCommand.UsedIndexes) { if (isTransposed) { if (!RowIndexes.Any(i => i == usedIndex || i.IsAll)) { usedIndex.IsHidden = true; RowIndexes.Add(usedIndex); } } else { if (!ColumnIndexes.Any(i => i == usedIndex || i.IsAll)) { usedIndex.IsHidden = true; ColumnIndexes.Add(usedIndex); } } } } var errorBarCommand = command as ErrorBarCommand; if (errorBarCommand != null) { ColumnIndexes.Add(errorBarCommand.MinusIndex); if (errorBarCommand.PlusIndex != null) { ColumnIndexes.Add(errorBarCommand.PlusIndex); } } var yCommand = command as YCommand; if (yCommand != null) { if (isTransposed) { if (!RowIndexes.Any(i => i == yCommand.Index || i.IsAll)) { RowIndexes.Add(yCommand.Index); } } else { if (!ColumnIndexes.Any(i => i == yCommand.Index || i.IsAll)) { ColumnIndexes.Add(yCommand.Index); } } } } }
public BoardCellLocation(ColumnIndexes column, RowIndexes row) { Column = column; Row = row; }