private bool FindMatch(int[,] matrix, int matrixMax) { for (int rotate = 0; rotate < 4; rotate++) { for (int i = 0; i < piecesToScore.Count(); i++) { int matrixIndex = 0; while (matrixIndex < matrixMax) { var test = new CoOrdinate() { x = piecesToScore[i].x + matrix[matrixIndex, 0], y = piecesToScore[i].y + matrix[matrixIndex, 1] }; if (!piecesToScore.Contains(test)) { break; } matrixIndex++; } if (matrixIndex == matrixMax) { return(true); } } // rotate all values by 90° foreach (var piece in piecesToScore) { piece.Rotate90(); } } return(false); }
public Score(List <Piece> pieces) { if (pieces == null) { return; } piecesToScore = new List <CoOrdinate>(); foreach (Piece piece in pieces) { var pieceCoOrd = new CoOrdinate(piece.NPosition); piecesToScore.Add(pieceCoOrd); } Type = (ePieceType)pieces[0].NPieceType; }