• 大小: 124KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-06-06
  • 语言: 其他
  • 标签: 小游戏  

资源简介

任意出4个1到10的数字,加减乘除得到24 的算法。小游戏娱乐

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Calc24
{
    public class Card
    {
        public int[] mNumbers = new int[] { };
        private List mSortNumbers = new List();
        private List mOps = new List();

        public Card(int number1  int number2  int number3 int number4)
        {
            mNumbers = new int[] { number1 number2 number3 number4 };
            
            this.permutation(mNumbers 0 mNumbers.Length mSortNumbers);

            this.GetOps();
        }

        public void Calculate()
        {
            foreach (var sortNumber in mSortNumbers)
            {
                foreach (var ops in mOps)
                {
                    try
                    {
                        var result = this.Calculate(
                        sortNumber[0] ops[0]
                        sortNumber[1] ops[1]
                        sortNumber[2] ops[2]
                        sortNumber[3] 1);

                        if (result == 24)
                        {
                            Console.WriteLine(“解:(({0}{1}{2}){3}{4}){5}{6}=24 。“
                                sortNumber[0]
                                GetOpDesc(ops[0])
                                sortNumber[1]
                                GetOpDesc(ops[1])
                                sortNumber[2]
                                GetOpDesc(ops[2])
                                sortNumber[3]
                                );

                            return;
                        }
                    }
                    catch 
                    {
                        
                    }

                    try
                    {
                        var result = this.Calculate(
                        sortNumber[0] ops[0]
                        sortNumber[1] ops[1]
                        sortNumber[2] ops[2]
                        sortNumber[3] 2);

                        if (result == 24)
                        {
                            Console.WriteLine(“解:(({0}{1}{2}){3}({4}{5}{6}))=24 。“
                                sortNumber[0]
                                GetOpDesc(ops[0])
                                sortNumber[1]
                                GetOpDesc(ops[1])
                                sortNumber[2]
                                GetOpDesc(ops[2])
                                sortNumber[3]
                                );

                            return;
                        }
                    }
                    catch
                    {

                    }

                    try
                    {
                        var result = this.Calculate(
                        sortNumber[0] ops[0]
                        sort

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

    ..A..H.     31744  2018-07-13 09:16  Calc24\.vs\Calc24\v15\.suo

     文件          0  2018-07-06 15:30  Calc24\.vs\Calc24\v15\Server\sqlite3\db.lock

     文件     450560  2018-07-13 09:16  Calc24\.vs\Calc24\v15\Server\sqlite3\storage.ide

     文件        189  2018-07-06 15:30  Calc24\Calc24\App.config

     文件       8704  2018-07-13 09:09  Calc24\Calc24\bin\Debug\Calc24.exe

     文件        189  2018-07-06 15:30  Calc24\Calc24\bin\Debug\Calc24.exe.config

     文件      17920  2018-07-13 09:09  Calc24\Calc24\bin\Debug\Calc24.pdb

     文件       2356  2018-07-06 15:33  Calc24\Calc24\Calc24.csproj

     文件       7852  2018-07-09 15:40  Calc24\Calc24\Card.cs

     文件         42  2018-07-06 15:31  Calc24\Calc24\obj\Debug\Calc24.csproj.CoreCompileInputs.cache

     文件        410  2018-07-06 18:05  Calc24\Calc24\obj\Debug\Calc24.csproj.FileListAbsolute.txt

     文件       1922  2018-07-06 15:33  Calc24\Calc24\obj\Debug\Calc24.csprojResolveAssemblyReference.cache

     文件       8704  2018-07-13 09:09  Calc24\Calc24\obj\Debug\Calc24.exe

     文件      17920  2018-07-13 09:09  Calc24\Calc24\obj\Debug\Calc24.pdb

     文件       6707  2018-07-06 15:31  Calc24\Calc24\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache

     文件          0  2018-07-06 15:30  Calc24\Calc24\obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs

     文件          0  2018-07-06 15:30  Calc24\Calc24\obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs

     文件          0  2018-07-06 15:30  Calc24\Calc24\obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs

     文件       1629  2018-07-12 11:34  Calc24\Calc24\Program.cs

     文件       1310  2018-07-06 15:30  Calc24\Calc24\Properties\AssemblyInfo.cs

     文件       1117  2018-07-06 15:30  Calc24\Calc24.sln

     目录          0  2018-07-13 09:16  Calc24\.vs\Calc24\v15\Server\sqlite3

     目录          0  2018-07-06 15:30  Calc24\.vs\Calc24\v15\Server

     目录          0  2018-07-06 15:30  Calc24\Calc24\obj\Debug\TempPE

     目录          0  2018-07-06 15:30  Calc24\.vs\Calc24\v15

     目录          0  2018-07-06 15:33  Calc24\Calc24\bin\Debug

     目录          0  2018-07-06 15:33  Calc24\Calc24\obj\Debug

     目录          0  2018-07-06 15:30  Calc24\.vs\Calc24

     目录          0  2018-07-06 15:30  Calc24\Calc24\bin

     目录          0  2018-07-06 15:30  Calc24\Calc24\obj

............此处省略7个文件信息

评论

共有 条评论