Пример #1
0
 public static Array GetValues(Type enumType)
 {
     //
     // Summary:
     //     Returns an instance of the specified enumeration type set to the specified
     //     8-bit unsigned integer value.
     //
     // Parameters:
     //   enumType:
     //     The enumeration for which to create a value.
     //
     //   value:
     //     The value to set.
     //
     // Returns:
     //     An instance of the enumeration set to value.
     //
     // Exceptions:
     //   System.ArgumentNullException:
     //     enumType is null.
     //
     //   System.ArgumentException:
     //     enumType is not an System.Enum.
     CodeContract.Ensures(CodeContract.Result <Array>() != null);
     return(default(Array));
 }
        public LocalBuilder DeclareLocal(Type !localType)
        {
            CodeContract.Requires(localType != null);

            CodeContract.Ensures(CodeContract.Result <LocalBuilder>() != null);
            return(default(LocalBuilder));
        }
Пример #3
0
        //Checks to see if there is a winner yet.
        public int checkEndGame()
        {
            CodeContract.Ensures(CodeContract.Result <int>() <= 3);
            CodeContract.Ensures(0 <= CodeContract.Result <int>());

            //Checks to see if the user won
            if (checkWinner(yourMark).Equals(1))
            {
                //1 = user win
                return(1);
            }
            //Checks to see if the computer won
            else if (checkWinner(compMark).Equals(1))
            {
                //2 = comp win
                return(2);
            }
            //Check for draw
            else if (!board[0, 0].Equals(1)
                     & !board[0, 1].Equals(2)
                     & !board[0, 2].Equals(3)
                     & !board[1, 0].Equals(4)
                     & !board[1, 1].Equals(5)
                     & !board[1, 2].Equals(6)
                     & !board[2, 0].Equals(7)
                     & !board[2, 1].Equals(8)
                     & !board[2, 2].Equals(9)
                     )
            {
                //3 = draw
                return(3);
            }
            //0 = no win
            return(0);
        }
Пример #4
0
        public static object CreateInstance(Type !type, bool nonPublic)
        {
            CodeContract.Requires(type != null);

            CodeContract.Ensures(CodeContract.Result <object>() != null);
            return(default(object));
        }
Пример #5
0
 public static object ToObject(Type !enumType, byte value)
 {
     //
     // Summary:
     //     Returns an instance of the specified enumeration type set to the specified
     //     32-bit signed integer value.
     //
     // Parameters:
     //   enumType:
     //     The enumeration for which to create a value.
     //
     //   value:
     //     The value to set.
     //
     // Returns:
     //     An instance of the enumeration set to value.
     //
     // Exceptions:
     //   System.ArgumentNullException:
     //     enumType is null.
     //
     //   System.ArgumentException:
     //     enumType is not an System.Enum.
     CodeContract.Ensures(CodeContract.Result <object>() != null);
     return(default(object));
 }
        public Object[] GetCustomAttributes(Type !attributeType, bool inherit)
        {
            CodeContract.Requires(attributeType != null);

            CodeContract.Ensures(CodeContract.Result <Object[]>() != null);
            return(default(Object[]));
        }
Пример #7
0
        public object Clone()
        {
            CodeContract.Ensures(result.GetType().Equals(this.GetType()));

            CodeContract.Ensures(CodeContract.Result <object>() != null);
            return(default(object));
        }
Пример #8
0
 public static object ToObject(Type !enumType, long value)
 {
     //
     // Summary:
     //     Returns an instance of the specified enumeration set to the specified value.
     //
     // Parameters:
     //   enumType:
     //     An enumeration.
     //
     //   value:
     //     The value.
     //
     // Returns:
     //     An enumeration object whose value is value.
     //
     // Exceptions:
     //   System.ArgumentNullException:
     //     enumType is null.
     //
     //   System.ArgumentException:
     //     enumType is not an System.Enum.-or- value is not type System.SByte, System.Int16,
     //     System.Int32, System.Int64, System.Byte, System.UInt16, System.UInt32, or
     //     System.UInt64.
     CodeContract.Ensures(CodeContract.Result <object>() != null);
     return(default(object));
 }
        public static System.Collections.IEnumerator GetEnumerator([Escapes(true, false)] IsolatedStorageScope scope)
        {
            CodeContract.Ensures(result.IsNew);

            CodeContract.Ensures(CodeContract.Result <System.Collections.IEnumerator>() != null);
            return(default(System.Collections.IEnumerator));
        }
        public Byte[] ComputeHash(Byte[] buffer)
        {
            CodeContract.Requires(buffer != null);

            CodeContract.Ensures(CodeContract.Result <Byte[]>() != null);
            return(default(Byte[]));
        }
Пример #11
0
        public static object ChangeType(object value, TypeCode typeCode, IFormatProvider provider)
        {
            CodeContract.Requires((int)typeCode != 0);

            CodeContract.Ensures(CodeContract.Result <object>() != null);
            return(default(object));
        }
        public IEnumerator GetEnumerator()
        {
            CodeContract.Ensures(result.IsNew);

            CodeContract.Ensures(CodeContract.Result <IEnumerator>() != null);
            return(default(IEnumerator));
        }
Пример #13
0
        public string GetString(string name, System.Globalization.CultureInfo culture)
        {
            CodeContract.Requires(name != null);

            CodeContract.Ensures(CodeContract.Result <string>() != null);
            return(default(string));
        }
        public System.Collections.IDictionaryEnumerator GetEnumerator()
        {
            CodeContract.Ensures(result.IsNew);

            CodeContract.Ensures(CodeContract.Result <System.Collections.IDictionaryEnumerator>() != null);
            return(default(System.Collections.IDictionaryEnumerator));
        }
Пример #15
0
        public static object GetObject(Type !type, string url, object state)
        {
            CodeContract.Requires(type != null);

            CodeContract.Ensures(CodeContract.Result <object>() != null);
            return(default(object));
        }
Пример #16
0
        public static StreamWriter CreateText(string !path)
        {
            CodeContract.Requires(path != null);

            CodeContract.Ensures(CodeContract.Result <StreamWriter>() != null);
            return(default(StreamWriter));
        }
Пример #17
0
        public static object CreateInstance(Type !type, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, Object[] args, System.Globalization.CultureInfo culture, Object[] activationAttributes)
        {
            CodeContract.Requires(type != null);
            CodeContract.Requires(activationAttributes.Length <= 1);

            CodeContract.Ensures(CodeContract.Result <object>() != null);
            return(default(object));
        }
Пример #18
0
        public static string Combine(string path1, string path2)
        {
            CodeContract.Requires(path1 != null);
            CodeContract.Requires(path2 != null);

            CodeContract.Ensures(CodeContract.Result <string>() != null);
            return(default(string));
        }
Пример #19
0
        //Places the move on the board, and then writes it in the Console
        public int placeMove(int turn, int squareNumber)
        {
            CodeContract.Requires(0 <= turn);
            CodeContract.Requires(turn <= 1);
            CodeContract.Requires(0 <= squareNumber);
            CodeContract.Requires(squareNumber <= 9);
            CodeContract.Ensures(CodeContract.Result <int>() != 2);
            //CodeContract.Ensures(CodeContract.Result<int>() <= 2);

            //if it was the user's turn, plug his move into the array
            if (turn == 0 || turn == 2)
            {
                if (squareNumber.Equals(1) & board[0, 0].Equals(1))
                {
                    board[0, 0] = yourMark;
                }
                else if (squareNumber.Equals(2) & board[0, 1].Equals(2))
                {
                    board[0, 1] = yourMark;
                }
                else if (squareNumber.Equals(3) & board[0, 2].Equals(3))
                {
                    board[0, 2] = yourMark;
                }
                else if (squareNumber.Equals(4) & board[1, 0].Equals(4))
                {
                    board[1, 0] = yourMark;
                }
                else if (squareNumber.Equals(5) & board[1, 1].Equals(5))
                {
                    board[1, 1] = yourMark;
                }
                else if (squareNumber.Equals(6) & board[1, 2].Equals(6))
                {
                    board[1, 2] = yourMark;
                }
                else if (squareNumber.Equals(7) & board[2, 0].Equals(7))
                {
                    board[2, 0] = yourMark;
                }
                else if (squareNumber.Equals(8) & board[2, 1].Equals(8))
                {
                    board[2, 1] = yourMark;
                }
                else if (squareNumber.Equals(9) & board[2, 2].Equals(9))
                {
                    board[2, 2] = yourMark;
                }
                //If he inputed a space where there is already another mark there
                else
                {
                    //2 = incorrect space
                    return(2);
                }
            }
            return(turn);
        }
Пример #20
0
        //Have user choose who goes first
        public int chooseFirstPlayer()
        {
            CodeContract.Ensures(CodeContract.Result <int>() <= 1);
            CodeContract.Ensures(0 <= CodeContract.Result <int>());
            Console.WriteLine("Do you want to go first? Type 0 to start, type 1 for the computer to start");
            string number    = Console.ReadLine();
            int    whosFirst = int.Parse(number.Equals("") ? "3" : number);

            while (whosFirst < 0 || 1 < whosFirst)
            {
                Console.WriteLine("Incorrect number. Type 0 for you to start, type 1 for the computer to start");
                number    = Console.ReadLine();
                whosFirst = int.Parse(number.Equals("") ? "3" : number);
            }

            return(whosFirst);
        }
Пример #21
0
 public IEnumerator<T> GetEnumerator() {
   CodeContract.Ensures(result.IsNew);
 //
 // Summary:
 //     Searches for the specified object and returns the zero-based index of the
 //     first occurrence within the entire System.Collections.ObjectModel.ReadOnlyCollection<T>.
 //
 // Parameters:
 //   value:
 //     The object to locate in the System.Collections.Generic.List<T>. The value
 //     can be null for reference types.
 //
 // Returns:
 //     The zero-based index of the first occurrence of item within the entire System.Collections.ObjectModel.ReadOnlyCollection<T>,
 //     if found; otherwise, -1.
   CodeContract.Ensures(CodeContract.Result<IEnumerator<T>>() != null);
   return default(IEnumerator<T>);
 }
Пример #22
0
 public static Type GetUnderlyingType(Type enumType)
 {
     //
     // Summary:
     //     Retrieves an array of the values of the constants in a specified enumeration.
     //
     // Parameters:
     //   enumType:
     //     An enumeration type.
     //
     // Returns:
     //     An System.Array of the values of the constants in enumType. The elements
     //     of the array are sorted by the values of the enumeration constants.
     //
     // Exceptions:
     //   System.ArgumentNullException:
     //     enumType is null.
     //
     //   System.ArgumentException:
     //     enumType is not an System.Enum.
     CodeContract.Ensures(CodeContract.Result <Type>() != null);
     return(default(Type));
 }
Пример #23
0
        //Checks to see if there is a winner yet
        public int checkWinner(int mark)
        {
            CodeContract.Ensures(CodeContract.Result <int>() <= 1);
            CodeContract.Ensures(0 <= CodeContract.Result <int>());


            if (//horizontal ways to win
                board[0, 0].Equals(mark) & board[0, 1].Equals(mark) & board[0, 2].Equals(mark) ||
                board[1, 0].Equals(mark) & board[1, 1].Equals(mark) & board[1, 2].Equals(mark) ||
                board[2, 0].Equals(mark) & board[2, 1].Equals(mark) & board[2, 2].Equals(mark)
                //vertical ways to win
                || board[0, 0].Equals(mark) & board[1, 0].Equals(mark) & board[2, 0].Equals(mark) ||
                board[0, 1].Equals(mark) & board[1, 1].Equals(mark) & board[2, 1].Equals(mark) ||
                board[0, 2].Equals(mark) & board[1, 2].Equals(mark) & board[2, 2].Equals(mark)
                //diagonal ways to win
                || board[0, 0].Equals(mark) & board[1, 1].Equals(mark) & board[2, 2].Equals(mark) ||
                board[0, 2].Equals(mark) & board[1, 1].Equals(mark) & board[2, 0].Equals(mark)
                )
            {
                return(1);
            }

            return(0);
        }
Пример #24
0
 public string ToString()
 {
     CodeContract.Ensures(CodeContract.Result <string>() != null);
     return(default(string));
 }
Пример #25
0
 public static string ChangeExtension(string path, string extension)
 {
     CodeContract.Ensures(CodeContract.Result <string>() != null);
     return(default(string));
 }
Пример #26
0
 public static string GetDirectoryName(string path)
 {
     CodeContract.Ensures(CodeContract.Result <string>() != null);
     return(default(string));
 }
Пример #27
0
 public static string GetFullPath(string path)
 {
     CodeContract.Ensures(CodeContract.Result <string>() != null);
     return(default(string));
 }
Пример #28
0
 public static string GetFileNameWithoutExtension(string path)
 {
     CodeContract.Ensures(CodeContract.Result <string>() != null);
     return(default(string));
 }
Пример #29
0
 public static string GetTempFileName()
 {
     CodeContract.Ensures(CodeContract.Result <string>() != null);
     return(default(string));
 }
Пример #30
0
 public string ToString(IFormatProvider provider)
 {
     CodeContract.Ensures(CodeContract.Result <string>() != null);
     return(default(string));
 }