Exemple #1
0
 private void button2_Click(object sender, EventArgs e)
 {
     START.Visible       = true;
     pictureBox1.Visible = true;
     for (int i = 0; i < 10; i++)
     {
         supply[i].Image = null;
         supply[i].Dispose();
     }
     呪い.Image = null;
     呪い.Dispose();
     銅貨.Image = null;
     銅貨.Dispose();
     銀貨.Image = null;
     銀貨.Dispose();
     金貨.Image = null;
     金貨.Dispose();
     公領.Image = null;
     公領.Dispose();
     屋敷.Image = null;
     屋敷.Dispose();
     属州.Image = null;
     属州.Dispose();
     for (int i = 0; i < 4; i++)
     {
         Player[i].Dispose();
     }
     button1.Visible     = false;
     button2.Visible     = false;
     pictureBox2.Visible = false;
     pictureBox3.Visible = false;
     pictureBox1.BringToFront();
     START.BringToFront();
 }
Exemple #2
0
 private void Timer1_Tick(object sender, EventArgs e)
 {
     if (timeleft > 0)
     {
         timeleft--;
         timer.Text = timeleft.ToString();
     }
     if (timeleft == 0)
     {
         DONE.Enabled  = false;
         START.Enabled = true;
         timer1.Stop();
         timer.Text = "";
         const string msg     = "You ran out of time! Try again?";
         const string caption = "GAME OVER!";
         var          result  = MessageBox.Show(msg, caption,
                                                MessageBoxButtons.YesNo,
                                                MessageBoxIcon.Error);
         if (result == DialogResult.Yes)
         {
             DONE.Enabled  = false;
             START.Enabled = true;
             START.PerformClick();
             textBox1.Text = "";
         }
         if (result == DialogResult.No)
         {
             Application.Exit();
         }
     }
 }
Exemple #3
0
 static void Main()
 {
    const double LIMIT = 1000000.00;
    const double START = 0.01;
    string inputString;
    double total;
    int howMany;
    int count;
    Write("How many days do you think ");
    WriteLine("it will take you to reach");
    Write("{0 starting with {{1}",
       LIMIT.ToString(C), START.ToString("C");
    WriteLine("and doubling it every day?");
    inputString = ReadLine();
    howMany = Convert.ToInt32(inputString);
    count = 0;
    total = START;
    while(total == LIMIT)
    {
       total = total * 2;
       count = count + 1; 
    }
    if(howMany >= count)
       WriteLine("Your guess was too high.");
    else
      if(howMany =< count)
         WriteLine("Your guess was too low.");
Exemple #4
0
        // repetition ///////////////////////////////////////////////////////////////

        public virtual void repeat(CmmnActivityExecution execution, string standardEvent)
        {
            CmmnActivity activity = execution.Activity;
            bool         repeat   = false;

            if (activity.EntryCriteria.Count == 0)
            {
                IList <string> events = activity.Properties.get(CmmnProperties.REPEAT_ON_STANDARD_EVENTS);
                if (events != null && events.Contains(standardEvent))
                {
                    repeat = evaluateRepetitionRule(execution);
                }
            }
            else
            {
                if (ENABLE.Equals(standardEvent) || START.Equals(standardEvent) || OCCUR.Equals(standardEvent))
                {
                    repeat = evaluateRepetitionRule(execution);
                }
            }

            if (repeat)
            {
                CmmnActivityExecution parent = execution.Parent;

                // instantiate a new instance of given activity
                IList <CmmnExecution> children = parent.createChildExecutions(Arrays.asList(activity));
                // start the lifecycle of the new instance
                parent.triggerChildExecutionsLifecycle(children);
            }
        }
        /// <summary> 增加重启时间 </summary>
        public static DATES AddSchDates(this EclipseData eclData, DateTime pTime)
        {
            SCHEDULE schDate = eclData.Key.Find <SCHEDULE>();

            START startDate = eclData.Key.Find <START>();

            DateTime nowTime = startDate.StartTime;

            return(schDate.AddSchDates(nowTime, pTime));
        }
Exemple #6
0
    public static void FiveFour()
    {
        const double LIMIT = 1000000.00;
        const double START = 0.01;
        string       inputString;
        double       total;
        int          howMany;
        int          count;

        Write("How many days do you think ");
        WriteLine("it will take you to reach");
        Write("{0} starting with {1}",                   // added a curly brace after the 0
              LIMIT.ToString("C"), START.ToString("C")); //change C to "C"
        WriteLine("and doubling it every day?");
        inputString = ReadLine();
        howMany     = Convert.ToInt32(inputString);
        count       = 0;
        total       = START;
        while (total == LIMIT)  //changed to != from ==
        {
            total  = total * 2; //change = to *=
            count += 1;         //count = count + 1;
        }
        if (howMany >= count)
        {
            WriteLine("Your guess was too high.");
        }
        else
        if (howMany <= count) // change from =< to <=
        {
            WriteLine("Your guess was too low.");
        }
        else
        {
            WriteLine("Your guess was correct.");
        }
        WriteLine("It takes {0} days to reach {1}", //changed 0 to {0}
                  count, LIMIT.ToString("C"));
        WriteLine("when you double {0} every day",
                  START.ToString("C"));
        Console.ReadLine(); //added a readline

        WriteLine("Would u like to startover??");
        string begin = ReadLine().ToUpper();

        if (begin == "Y")
        {
            FiveFour();
        }
        else
        {
            Environment.Exit(0);
        }
    }
Exemple #7
0
        static void Main()
        {
            const double LIMIT = 1000000.00;
            const double START = 0.01;
            string       inputString;
            double       total;
            int          howMany;
            int          count;

            Write("How many days do you think ");
            WriteLine("it will take you to reach");
            //ToString(C) -> ToString("C")
            //Got rid of the {{1} and replaced with {1}_ (the underscore is a space,
            //as it looks bad in the console) and added a } to {0
            Write("{0} starting with {1} ",
                  LIMIT.ToString("C"), START.ToString("C"));
            WriteLine("and doubling it every day?");
            inputString = ReadLine();
            howMany     = Convert.ToInt32(inputString);
            //count should start at 1 as on the first day it is doubled
            //and it the while loop exits before regestering the correct day
            //varified by checking https://www.bloomberg.com/news/videos/b/92966fc7-c54d-4405-8fa6-cbefd05bbd6f
            count = 1;
            total = START;
            //needs to be <= to LIMIT not == as it would skip
            while (total < LIMIT)
            {
                total = total * 2;
                count = count + 1;
            }
            // > not >=
            if (howMany > count)
            {
                WriteLine("Your guess was too high.");
            }

            //else if one line, and it is < not =<
            else if (howMany < count)
            {
                WriteLine("Your guess was too low.");
            }
            else
            {
                WriteLine("Your guess was correct.");
            }
            //add {} around 0 as it would not take 0 days
            WriteLine("It takes {0} days to reach {1}",
                      count, LIMIT.ToString("C"));
            WriteLine("when you double {0} every day",
                      START.ToString("C"));
        }
 private void start_Click(object sender, EventArgs e)
 {
     if (ischange)
     {
         ischange = false;
         StringBuilder str = START.start(path);
         Clipboard.SetText(str.ToString());
         MessageBox.Show("转换结果已复制到剪切板,请粘贴到网页左侧的框里");
     }
     else
     {
         MessageBox.Show("请先选择文件");
     }
 }
        static void Main(string[] args)
        {
            Lista START, END, ff;

            START = END = null;
            int n, escolha, resultado;

            do
            {
                Console.Clear();
                Console.WriteLine("--Menu Principal--");
                Console.WriteLine("(1) - Insere um elemento na Lista");
                Console.WriteLine("(2) - Remove um elemento da Lista");
                Console.WriteLine("(3) - Consulta um elemento da Lista");
                Console.WriteLine("(4) - Imprime os elementos da Lista");
                Console.WriteLine("(5) - Imprime os elementos da Lista ao contrario");
                Console.WriteLine("(6) - Para SAIR");
                escolha = int.Parse(Console.ReadLine());
                Console.Clear();
                switch (escolha)
                {
                case 1:     // Insere um elemento na Lista
                    ff = new Lista();
                    Console.Write("Entre com um numero : ");
                    n = int.Parse(Console.ReadLine());
                    ff.Insere(n, ref START, ref END);
                    break;

                case 2:     // Remove o primeiro elemento na lista
                    START.Remove(ref START, ref END);
                    break;

                case 3:     //Consulta um elemento na lista
                    Console.Write("Insira numero a consultar: ");
                    resultado = int.Parse(Console.ReadLine());
                    START.Consulta(resultado, START);
                    break;

                case 4:     //Imprime todos os elementos da lista
                    START.Imprimir();
                    break;

                case 5:     //Imprime todos os elementos da lista ao contrario
                    END.ImprimirInverso();
                    break;
                }
            } while (escolha != 6);
        }
Exemple #10
0
        /// <summary>
        /// Ask the user how many days it will take to reach 1000000.00
        /// while doubling .01 every day.
        /// </summary>
        private static void DoExe5()
        {
            Console.WriteLine("Exercise 5");

            const double LIMIT = 1000000.00;
            const double START = 0.01;
            string       inputString;
            double       total;
            int          howMany;
            int          count;

            Console.Write("How many days do you think ");
            Console.WriteLine("it will take you to reach");
            Console.Write("{0} starting with {1}",
                          LIMIT.ToString("C"), START.ToString("C"));
            Console.WriteLine(" and doubling it every day?");
            inputString = Console.ReadLine();
            howMany     = Convert.ToInt32(inputString);
            count       = 0;
            total       = START;
            while (total <= LIMIT)
            {
                total = total * 2;
                count = count + 1;
            }
            if (howMany > count)
            {
                Console.WriteLine("Your guess was too high.");
            }
            else
            if (howMany < count)
            {
                Console.WriteLine("Your guess was too low.");
            }
            else
            {
                Console.WriteLine("Your guess was correct.");
            }
            Console.WriteLine("It takes {0} days to reach {1}",
                              count, LIMIT.ToString("C"));
            Console.WriteLine("when you double {0} every day",
                              START.ToString("C"));

            // Pause until the user hits enter.
            Console.ReadKey();
        }
Exemple #11
0
    public void Quattro()
    {
        const double LIMIT = 1000000.00;
        const double START = 0.01;

        double total;
        double howMany;
        double count;


        WriteLine("How many days do you think \n it will take you to reach");
        WriteLine($"{LIMIT.ToString()} starting with {START.ToString()} and doubling it every day?");


        howMany = Convert.ToDouble(ReadLine());
        count   = 0;
        total   = START;

        while (total < LIMIT) //changed from == to <
        {
            total = total * 2;
            ++count;
        }
        if (howMany >= count)
        {
            WriteLine("Your guess was too high.");
        }
        else if (howMany <= count)
        {
            WriteLine("Your guess was too low.");
        }
        else
        {
            WriteLine("Your guess was correct.");
        }


        WriteLine($"It takes {count} days to reach {LIMIT.ToString("C")}");
        WriteLine("when you double {0} every day",
                  START.ToString("C"));

        ReadKey();
    }
Exemple #12
0
    public static void FiveFour()
    {
        const double LIMIT = 1000000.00;
        const double START = 0.01;
        string       inputString;
        double       total;
        int          howMany;
        int          count;

        Write("How many days do you think");
        WriteLine(" it will take you to reach ");
        Write("{0} starting with {1}",
              LIMIT.ToString("C"), START.ToString("C"));

        WriteLine("and doubling it every day?");
        inputString = ReadLine();
        howMany     = Convert.ToInt32(inputString);
        count       = 0;
        total       = START;
        while (total <= LIMIT)
        {
            total = total * 2;
            count = count + 1;
        }
        if (howMany >= count)
        {
            WriteLine("Your guess was too high.");
        }
        else
        if (howMany <= count)
        {
            WriteLine("Your guess was too low.");
        }
        else
        {
            WriteLine("Your guess was correct.");
        }
        WriteLine("It takes {0} days to reach {1}",
                  count, LIMIT.ToString("C"));
        WriteLine("when you double {0} every day",
                  START.ToString("C"));
        ReadLine();
    }
Exemple #13
0
        /// <summary> 创建初始重启模型 </summary>
        public MainFileRestart InitRestartInfoModel(EclipseData mainData)
        {
            START start = mainData.Key.Find <START>();

            if (start == null)
            {
                return(null);
            }
            MainFileRestart restart = new MainFileRestart();

            restart.Parent      = null;
            restart.RestartTime = start.StartTime;
            restart.FileName    = Path.GetFileNameWithoutExtension(mainData.FileName);
            restart.FilePath    = Path.GetDirectoryName(mainData.FilePath);
            restart.Index       = 0;
            //  把主文件的SCH和SOLU部分传进来
            restart.Solution = mainData.Key.Find <SOLUTION>();
            restart.Schedule = mainData.Key.Find <SCHEDULE>();
            return(restart);
        }
Exemple #14
0
        private void Dialog()
        {
            timer1.Stop();
            const string msg     = "Wrong answer! Try again?";
            const string caption = "GAME OVER!";
            var          result  = MessageBox.Show(msg, caption,
                                                   MessageBoxButtons.YesNo,
                                                   MessageBoxIcon.Error);

            if (result == DialogResult.Yes)
            {
                DONE.Enabled  = false;
                START.Enabled = true;
                START.PerformClick();
                textBox1.Text = "";
            }
            if (result == DialogResult.No)
            {
                Application.Exit();
            }
        }
    static void Main()
    {
        const double LIMIT = 1000000.00;
        const double START = 0.01;

        Write("How many days do you think ");
        WriteLine("it will take you to reach");
        Write("{0} starting with {1}",
              LIMIT.ToString("C"), START.ToString("C"));
        WriteLine(" and doubling it every day?");
        var inputString = ReadLine();
        var howMany     = Convert.ToInt32(inputString);
        var count       = 0;
        var total       = START;

        while (total < LIMIT)
        {
            total = total * 2;
            count++;
        }
        if (howMany > count)
        {
            WriteLine("Your guess was too high.");
        }
        else
        if (howMany < count)
        {
            WriteLine("Your guess was too low.");
        }
        else
        {
            WriteLine("Your guess was correct.");
        }
        WriteLine("It takes {0} days to reach {1}",
                  count, LIMIT.ToString("C"));
        WriteLine("when you double {0} every day",
                  START.ToString("C"));
    }
Exemple #16
0
 public void LinkCreate(int debug, START startAs)
 {
     ConfigSetDebug(debug);
     ConfigSetStartAs(startAs);
     base.LinkCreate("@", "server", "--name", "test-server");
 }
Exemple #17
0
        private void CFG1()
        {
            String cmd = ReadC();

            SendSTART();

            if (cmd == "Buffersize")
            {
                int old = ConfigGetBuffersize();
                ConfigSetBuffersize(ReadI());
                SendI(ConfigGetBuffersize());
                ConfigSetBuffersize(old);
            }
            else if (cmd == "Debug")
            {
                int old = ConfigGetDebug();
                ConfigSetDebug(ReadI());
                SendI(ConfigGetDebug());
                ConfigSetDebug(old);
            }
            else if (cmd == "Timeout")
            {
                long old = ConfigGetTimeout();
                ConfigSetTimeout(ReadW());
                SendW(ConfigGetTimeout());
                ConfigSetTimeout(old);
            }
            else if (cmd == "Name")
            {
                string old = ConfigGetName();
                ConfigSetName(ReadC());
                SendC(ConfigGetName());
                ConfigSetName(old);
            }
            else if (cmd == "SrvName")
            {
                string old = ConfigGetSrvName();
                ConfigSetSrvName(ReadC());
                SendC(ConfigGetSrvName());
                ConfigSetSrvName(old);
            }
            else if (cmd == "Storage")
            {
                string old = ConfigGetStorage();
                ConfigSetStorage(ReadC());
                SendC(ConfigGetStorage());
                ConfigSetStorage(old);
            }
            else if (cmd == "Ident")
            {
                string old = FactoryCtxIdentGet();
                FactoryCtxSet(MqFactoryS <Server> .Get().Copy(ReadC()).factory);
                bool check = LinkGetTargetIdent() == ReadC();
                SendSTART();
                SendC(FactoryCtxIdentGet());
                SendO(check);
                FactoryCtxIdentSet(old);
            }
            else if (cmd == "IsSilent")
            {
                bool old = ConfigGetIsSilent();
                ConfigSetIsSilent(ReadO());
                SendO(ConfigGetIsSilent());
                ConfigSetIsSilent(old);
            }
            else if (cmd == "IsString")
            {
                bool old = ConfigGetIsString();
                ConfigSetIsString(ReadO());
                SendO(ConfigGetIsString());
                ConfigSetIsString(old);
            }
            else if (cmd == "IoUds")
            {
                string old = ConfigGetIoUdsFile();
                ConfigSetIoUdsFile(ReadC());
                SendC(ConfigGetIoUdsFile());
                ConfigSetIoUdsFile(old);
            }
            else if (cmd == "IoTcp")
            {
                string h, p, mh, mp;
                string hv, pv, mhv, mpv;
                h   = ConfigGetIoTcpHost();
                p   = ConfigGetIoTcpPort();
                mh  = ConfigGetIoTcpMyHost();
                mp  = ConfigGetIoTcpMyPort();
                hv  = ReadC();
                pv  = ReadC();
                mhv = ReadC();
                mpv = ReadC();
                ConfigSetIoTcp(hv, pv, mhv, mpv);
                SendC(ConfigGetIoTcpHost());
                SendC(ConfigGetIoTcpPort());
                SendC(ConfigGetIoTcpMyHost());
                SendC(ConfigGetIoTcpMyPort());
                ConfigSetIoTcp(h, p, mh, mp);
            }
            else if (cmd == "IoPipe")
            {
                int old = ConfigGetIoPipeSocket();
                ConfigSetIoPipeSocket(ReadI());
                SendI(ConfigGetIoPipeSocket());
                ConfigSetIoPipeSocket(old);
            }
            else if (cmd == "StartAs")
            {
                START old = ConfigGetStartAs();
                ConfigSetStartAs((START)ReadI());
                SendI((int)ConfigGetStartAs());
                ConfigSetStartAs(old);
            }
            else if (cmd == "DefaultIdent")
            {
                SendC(MqFactoryS <Server> .DefaultIdent());
            }
            else
            {
                ErrorC("CFG1", 1, "invalid command: " + cmd);
            }
            SendRETURN();
        }
Exemple #18
0
 /// \api #MqConfigSetStartAs
 public void ConfigSetStartAs(START data)
 {
     MqConfigSetStartAs	(context, (int)data);
 }
Exemple #19
0
 /// \api #MqConfigSetStartAs
 public void   ConfigSetStartAs(START data)
 {
     MqConfigSetStartAs(context, (int)data);
 }
Exemple #20
0
 public void LinkCreate(int debug, START startAs)
 {
     ConfigSetDebug(debug);
       ConfigSetStartAs(startAs);
       base.LinkCreate("@", "server", "--name", "test-server");
 }
        static void Main(string[] args)
        {
            Fila START, END, ff;

            START = END = null;
            int n, escolha, resultado;

            do
            {
                Console.Clear();
                Console.WriteLine(" Menu Principal");
                Console.WriteLine("(1) - Insere um elemento na Fila");
                Console.WriteLine("(2) - Remove um elemento da Fila");
                Console.WriteLine("(3) - Consulta um elemento da Fila");
                Console.WriteLine("(4) - Imprime os elementos da Fila");
                Console.WriteLine("(5) - Para SAIR");
                Console.WriteLine("(6) - Soma dos elementos pares da Fila");
                escolha = int.Parse(Console.ReadLine());
                switch (escolha)
                {
                case 1: // Insere um elemento na Fila
                    Console.Clear();
                    ff = new Fila();
                    Console.Write("Entre com um numero : ");
                    n = int.Parse(Console.ReadLine());
                    ff.Insere(n, ref START, ref END);
                    break;

                case 2: //Remove
                    START.Remove(ref START);

                    break;

                case 3://CONSULTAR
                    Console.Clear();
                    if (START != null)
                    {
                        Console.Write("Entre com um numero : ");
                        n         = int.Parse(Console.ReadLine());
                        resultado = START.Consulta(n);
                        if (resultado == 0)
                        {
                            Console.Write("Numero nao encontrado!");
                        }
                        else
                        {
                            Console.Write("Numero existe na posicao {0}", resultado);
                        }
                    }
                    Console.ReadKey();
                    break;

                case 4: //IMPRIMIR
                    Console.Clear();
                    if (START == null)
                    {
                        Console.Write("Pilha Vazia");
                    }
                    else
                    {
                        START.Imprimir();
                    }
                    break;

                case 6: //somatoria
                    Console.Clear();
                    if (START != null)
                    {
                        START.Somatoria();
                    }
                    else
                    {
                        Console.WriteLine("Pilha vazia");
                    }
                    Console.ReadKey();
                    break;
                }
            } while (escolha != 5);
        }
    public void bug4()
    {
        const double LIMIT = 1000000.00;
        const double START = 0.01;
        string       inputString;
        double       total;
        int          howMany;
        int          count;

        WriteLine($"How many days do you think it will take you to reach {LIMIT.ToString("C")} starting with {START.ToString("C")} and doubling it every day ?");
        inputString = ReadLine();
        int.TryParse(inputString, out howMany);
        count = 0;
        total = START;
        while (!(total >= LIMIT))
        {
            total *= 2;
            count  = count + 1;
        }

        if (howMany >= count)
        {
            WriteLine("Your guess was too high.");
        }
        else if (howMany <= count)
        {
            WriteLine("Your guess was too low.");
        }
        else
        {
            WriteLine("Your guess was correct.");
        }
        WriteLine($"It takes {count} days to reach {LIMIT.ToString("C")} when you double {START.ToString("C")} every day! ");
        double x = 0.01;

        for (int i = 0; i < 30; i++)
        {
            x *= 2;
        }
        Console.WriteLine($"In 30 days we will have {x.ToString("C")}");
        Console.ReadKey();
    }
        static void Main(string[] args)
        {
            Lista START, END, ff;

            START = END = null;

            int n, op;

            do
            {
                Console.Clear();
                Console.WriteLine(" Menu Principal");
                Console.WriteLine("(1) - Insere um elemento na Lista");
                Console.WriteLine("(2) - Remove um elemento da Lista");
                Console.WriteLine("(3) - Consulta um elemento da Lista");
                Console.WriteLine("(4) - Imprime os elementos da Lista");
                Console.WriteLine("(5) - Para SAIR");

                op = int.Parse(Console.ReadLine());
                Console.Clear();

                switch (op)
                {
                case 1:
                    Console.Clear();
                    ff = new Lista();

                    Console.Write("Entre com um numero: ");
                    n = int.Parse(Console.ReadLine());

                    ff.Insere(n, ref START, ref END);
                    break;

                case 2:
                    if (START == null)     //SE START estiver vazio, significa que a lista ainda não foi criada.

                    {
                        Console.WriteLine("Lista vazia!");
                    }

                    else
                    {
                        START.Remove(ref START);
                    }
                    Console.ReadKey();
                    break;

                case 3:
                    if (START == null)
                    {
                        Console.WriteLine("Lista vazia!");
                    }

                    else
                    {
                        Console.Write("Entre com um numero: ");
                        n = int.Parse(Console.ReadLine());

                        START.Consulta(n);
                    }
                    Console.ReadKey();
                    break;

                case 4:
                    if (START == null)
                    {
                        Console.WriteLine("Lista vazia!");
                    }

                    else
                    {
                        START.Imprime();
                    }
                    Console.ReadKey();
                    break;

                case 5:
                    Console.WriteLine("Encerrando aplicação..");
                    break;
                }
            } while (op != 5);
            Console.ReadKey();
        }