コード例 #1
0
ファイル: GameSettings.cs プロジェクト: Luigi-pl/2048_3d_game
        /// <summary>
        /// Method converts game settings to string.
        /// </summary>
        /// <returns>string</returns>
        public String ExportSettingsToString()
        {
            String result = "";

            result += TranslateData.TrasnlateNumberToChar(boardSize) + ".";
            result += TranslateData.TrasnlateNumberToChar(numberOfLayers) + ".";
            result += TranslateData.TrasnlateNumberToChar(numberOfFieldsToAdd) + ".";
            result += TranslateData.TrasnlateNumberToChar((int)Math.Log((int)targetValueOfTheField, 2)) + ".";

            if (ifTheGameIsOver == false)
            {
                result += TranslateData.TrasnlateNumberToChar(0) + ".";
            }
            else
            {
                result += TranslateData.TrasnlateNumberToChar(1) + ".";
            }
            return(result);
        }
コード例 #2
0
        /// <summary>
        /// Method converts field values and highest field value to string
        /// </summary>
        /// <returns></returns>
        public String ExportGameBoardModelToString()
        {
            String result = "";

            result += TranslateData.TrasnlateNumberToChar((int)Math.Log((int)highestValue, 2)) + ".";

            for (int z = 0; z < numberOfLayers; z++)
            {
                for (int x = 0; x < boardSize; x++)
                {
                    for (int y = 0; y < boardSize; y++)
                    {
                        result += TranslateData.TrasnlateNumberToChar((int)Math.Log((int)fields[z][x, y], 2));
                    }
                }
            }
            result += ".";
            return(result);
        }