private int?MoveUp(int currentNo, List <int> sequence) { int?nextNo = currentNo; do { nextNo = Keypad.UpOf(nextNo.Value); if (nextNo.HasValue && !sequence.Contains(nextNo.Value)) { break; } }while (nextNo.HasValue); return(nextNo); }
private int?MoveLeftUp(int currentNo, List <int> sequence) { int?nextNo = Keypad.LeftOf(currentNo); if (nextNo.HasValue) { nextNo = Keypad.UpOf(nextNo.Value); if (nextNo.HasValue && sequence.Contains(nextNo.Value)) { nextNo = null; } } return(nextNo); }
private int?MoveUpRight(int currentNo, List <int> sequence) { int?nextNo = Keypad.UpOf(currentNo); if (nextNo.HasValue) { nextNo = Keypad.UpOf(nextNo.Value); if (nextNo.HasValue) { nextNo = Keypad.RightOf(nextNo.Value); if (nextNo.HasValue && !sequence.Contains(nextNo.Value)) { return(nextNo); } } } return(null); }