Esempio n. 1
0
 public Cluster(Cluster c)
 {
     members     = new Shoots();
     prevMembers = new Shoots();
     centroid    = new DBAShoot();
     foreach (Shoot s in c.members)
     {
         members.Add(s);
     }
     centroid.DBAacc = new Vec3[c.centroid.DBAacc.Length];
     for (int i = 0; i < c.centroid.DBAacc.Length; ++i)
     {
         centroid.DBAacc[i] = c.centroid.DBAacc[i].Clone();
     }
 }
Esempio n. 2
0
        private void DataInput_Click(object sender, EventArgs e)
        {
            //時系列データをcsvファイルから取り込む
            OpenFileDialog o = new OpenFileDialog();

            o.Multiselect = true;
            o.Filter      = "CSV|*.csv";
            if (o.ShowDialog() == DialogResult.OK)
            {
                files = o.FileNames;
                MessageBox.Show("Select" + files.Length + "files");
            }
            else
            {
                MessageBox.Show("Open file Error");
            }
            for (int s = 0; s < files.Length; s++)
            {
                string file       = files[s];
                Shoot  inputshoot = Shoot.Load(file);
                inputshoots.Add(inputshoot);
            }
        }
Esempio n. 3
0
 public virtual void AddShoot(Shoot shoot)
 {
     Shoots.Add(shoot);
 }
Esempio n. 4
0
        private void timer2_Tick(object sender, EventArgs e)
        {
            // create New Shoot in game every  sec

            // Create Game Shoot
            Random     rnd = new Random();
            int        pos1, pos2, pos3;
            List <int> L = new List <int>();

            L.Add(prev1);
            L.Add(prev2);
            L.Add(prev3);
            L.Sort();
            while (true)
            {
                pos1 = rnd.Next(0, 8);
                pos2 = rnd.Next(0, 8);
                pos3 = rnd.Next(0, 8);
                List <int> L1 = new List <int>();
                L1.Add(pos1);
                L1.Add(pos2);
                L1.Add(pos3);
                if (pos1 != pos2 && pos2 != pos3 && pos1 != pos3)
                {
                    bool ok = true;
                    for (int i = 0; i < 3; i++)
                    {
                        for (int j = 0; j < 3; j++)
                        {
                            if (L[i] == L1[j])
                            {
                                ok = false;
                            }
                        }
                    }
                    if (ok)
                    {
                        break;
                    }
                }
            }
            prev1 = pos1;
            prev2 = pos2;
            prev3 = pos3;
            PictureBox picture = new PictureBox
            {
                Name      = "pictureBox",
                Size      = shootgame.Size,
                BackColor = shootgame.BackColor,
                Location  = new Point(posofshoots[pos1], 58),
                //  BackColor = System.Drawing.Color.Lime,
                Image    = shootgame.Image,
                SizeMode = shootgame.SizeMode,
            };

            this.Controls.Add(picture);
            Shoots.Add(picture);
            int r1 = rnd.Next(1, 4);    // 1 for horz , 2 for left ,3 for right

            // lvl 2 of game
            if (lvl2 == true)
            {
                moveLeft.Add(r1);
            }
            else
            {
                moveLeft.Add(1);
            }
            if (lvl2)
            {
                PictureBox picture1 = new PictureBox
                {
                    Name      = "pictureBox",
                    Size      = shootgame2.Size,
                    BackColor = shootgame2.BackColor,
                    Location  = new Point(posofshoots[pos2], 58),
                    //  BackColor = System.Drawing.Color.Lime,
                    Image    = shootgame2.Image,
                    SizeMode = shootgame2.SizeMode,
                };
                this.Controls.Add(picture1);
                Shoots.Add(picture1);

                r1 = rnd.Next(1, 4);    // 1 for horz , 2 for left ,3 for right
                // lvl 2 of game
                if (lvl2 == true)
                {
                    moveLeft.Add(r1);
                }
                else
                {
                    moveLeft.Add(1);
                }
                PictureBox picture2 = new PictureBox
                {
                    Name      = "pictureBox",
                    Size      = shootgame3.Size,
                    BackColor = shootgame3.BackColor,
                    Location  = new Point(posofshoots[pos3], 58),
                    //  BackColor = System.Drawing.Color.Lime,
                    Image    = shootgame3.Image,
                    SizeMode = shootgame3.SizeMode,
                };
                this.Controls.Add(picture2);
                Shoots.Add(picture2);
                r1 = rnd.Next(1, 4);    // 1 for horz , 2 for left ,3 for right
                // lvl 2 of game
                if (lvl2 == true)
                {
                    moveLeft.Add(r1);
                }
                else
                {
                    moveLeft.Add(1);
                }
            }
            // determine objects that not in form and delete it
            if (Shoots.Count > 0)
            {
                timer2.Enabled = false;
                for (int i = 0; i < Shoots.Count; i++)
                {
                    if (Shoots[i].Top > 640) // not in form
                    {
                        Shoots[i].Dispose();
                        Shoots.RemoveAt(i);
                        i = -1;
                        if (Health.Value > 0)
                        {
                            Health.Value -= 25;
                        }
                    }
                }
                timer2.Enabled = true;
            }
            if (PlayerShoots.Count > 20)
            {
                timer2.Enabled = false;
                for (int i = 0; i < PlayerShoots.Count; i++)
                {
                    if (PlayerShoots[i].Top < 23)
                    {
                        PlayerShoots[i].Dispose();
                        PlayerShoots.RemoveAt(i);
                        i = -1; // to start loop from first after remove
                        // MessageBox.Show(i.ToString());
                    }
                }
                timer2.Enabled = true;
            }
        }