public Location Find(int turn, char c, Location dst, string disam) { Location lo = new Location(); bool isWhite = (turn == 0); foreach (GameObject chessObj in activeChessmans) { Chessman chess = chessObj.GetComponent <Chessman>(); if ((chess.isWhite == isWhite) && (chess.Annotation().Equals(c.ToString()))) { if (chess.CanGo(dst.x, dst.y)) { if (disam.Length == 1) //Disambiguating moves { if (disam[0] >= '1' && disam[0] <= '9') //rank have to the same { if (chess.CurrentY == (disam[0] - '1')) { return(new Location(chess.CurrentX, chess.CurrentY)); } } else if (disam[0] >= 'a' && disam[0] <= 'z') //file have to the same { if (chess.CurrentX == (disam[0] - 'a')) { return(new Location(chess.CurrentX, chess.CurrentY)); } } else { Debug.Log("Unexpected result! " + disam); } } else { return(new Location(chess.CurrentX, chess.CurrentY)); } } } } return(lo); }