Beispiel #1
0
        public static void Main(string[] args)
        {
            EncryptWord encryptor = new EncryptWord();

            encryptor.generateShift();
            encryptor.setWord("cat");
            encryptor.encryptWord();
            Console.WriteLine("Encrypted word is: " + encryptor.word);
            Console.WriteLine("Shift number is: " + encryptor.shift);
        }
Beispiel #2
0
 /// <summary>
 /// Initializes a new instance of the
 ///  <see cref="T:lohs_p1.CaesarShiftGame"/> class.
 /// Where all statistics are set to the default value of 0
 /// and there will be an EncryptWord object that contains a
 /// default word. The default word will be encrypted with
 /// a randomly generated shift number that will be encapsulated
 /// by the EncryptWord object.
 ///
 /// Precondition: None
 /// Postcondition: The game will be an an 'ACTIVE' state where
 /// the user can play the game with the default word or they can
 /// choose to enter a new word to play with.
 /// </summary>
 public CaesarShiftGame()
 {
     this.encryptor              = new EncryptWord();
     this.guessCount             = DEFAULT_COUNTER_VALUE;
     this.highGuessCount         = DEFAULT_COUNTER_VALUE;
     this.lowGuessCount          = DEFAULT_COUNTER_VALUE;
     this.guessValueSum          = DEFAULT_COUNTER_VALUE;
     this.gameStatus             = ACTIVE;
     this.VALID_GUESS_LOWERBOUND = encryptor.VALID_GUESS_LOWERBOUND;
     this.VALID_GUESS_UPPERBOUND = encryptor.VALID_GUESS_UPPERBOUND;
     this.VALID_ASCII_LETTER_LOWERBOUND
         = encryptor.VALID_ASCII_LETTER_LOWERBOUND + 1;
     this.VALID_ASCII_LETTER_UPPERBOUND
         = encryptor.VALID_ASCII_LETTER_UPPERBOUND;
 }