Ejemplo n.º 1
0
        public void logSolveAttempt(String puzzleId, String attemptedSolution, PuzzleResponse response)
        {
            // We log the normalized attempt so that it doesn't have extraneous characters.
            attemptedSolution = PuzzleOracle.normalizeSolution(attemptedSolution);

            String responseCode = "INVALID";

            switch (response.type)
            {
            case PuzzleResponse.ResponseType.AskLater:
                responseCode = "BLACKLISTED";
                break;

            case PuzzleResponse.ResponseType.Correct:
                responseCode = "CORRECT";
                break;

            case PuzzleResponse.ResponseType.Incorrect:
                responseCode = "INCORRECT";     // INCORRET means it matched a hint.
                break;

            case PuzzleResponse.ResponseType.NotFound:
                responseCode = "NOTFOUND";
                break;

            default:
                responseCode = "UNRECOGNIZED_CODE";
                break;
            }

            // Encrypt...
            String customizer = teamId + puzzleId; // Important - this is the customizer format used for encryption.

            responseCode      = CryptoHelper.simpleEncryptDecrypt(LOG_PASSWORD, customizer, LOG_ENCRYPT_CHARS, responseCode, true);
            attemptedSolution = CryptoHelper.simpleEncryptDecrypt(LOG_PASSWORD, customizer, LOG_ENCRYPT_CHARS, attemptedSolution, true);

            rawLog(puzzleId, responseCode, attemptedSolution);
        }