Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace WindowsFormsApp4
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- label2.BackColor = Color.Red;
- label1.BackColor = Color.Yellow;
- label3.BackColor = Color.Orange;
- label4.BackColor = Color.Purple;
- label5.BackColor = Color.Blue;
- labelCarcas.BackColor = Color.Black;
- }
- int pot1 = 44;
- bool flag = true;
- int opredelitel = 1;
- Stack<Label> F_stack = new Stack<Label>();
- Stack<Label> S_stack = new Stack<Label>();
- Stack<Label> T_stack = new Stack<Label>();
- Stack<int> Int_Stack = new Stack<int>();
- Queue<Label> F_Queue = new Queue<Label>();
- Queue<Label> T_Queue = new Queue<Label>();
- int i = 2, j = 0;
- Label[] massiv;
- Label[] massiv_3;
- int[] massivj = new int[4] { -1, -2, -3, -4 };
- private void pictureBox1_Click(object sender, EventArgs e)
- {
- }
- private void timer1_Tick(object sender, EventArgs e)
- {
- move_1_2();
- //move_1_3();
- }
- public void button1_Click(object sender, EventArgs e)
- {
- timer1.Interval = 2;
- F_stack.Push(label1);
- F_stack.Push(label2);
- F_stack.Push(label3);
- //F_stack.Push(label4);
- //F_stack.Push(label5);
- //massiv_3 = new Label[5] { label111, label222, label333, label444, label555 };
- //S_stack.Push(label55);
- //S_stack.Push(label44);
- S_stack.Push(label11);
- S_stack.Push(label22);
- S_stack.Push(label33);//?? ????????
- F_Queue.Enqueue(label11);
- F_Queue.Enqueue(label22);
- F_Queue.Enqueue(label33);
- //massiv = S_stack.ToArray();
- T_stack.Push(label111);
- T_stack.Push(label222);
- T_stack.Push(label333);
- T_Queue.Enqueue(label111);
- T_Queue.Enqueue(label222);
- T_Queue.Enqueue(label333);
- timer1.Start();
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- }
- public void move_1_2()
- {
- if (opredelitel > 0)
- {
- if (S_stack.Count == 0 || F_stack.Count == 0 || T_stack.Count == 0)
- {
- timer1.Stop();
- }
- else
- {
- if (F_stack.Peek().Location.X == F_stack.Peek().Location.X && F_stack.Peek().Location.Y >= pot1 && flag)
- {
- F_stack.Peek().Top -= 4;
- }
- else if (F_stack.Peek().Location.Y == F_stack.Peek().Location.Y && F_stack.Peek().Location.X < S_stack.Peek().Location.X)
- {
- F_stack.Peek().Left += 4;
- flag = false;
- }
- else if (F_stack.Peek().Location.X == F_stack.Peek().Location.X && F_stack.Peek().Location.Y <= F_Queue.Peek().Location.Y)
- {
- F_stack.Peek().Top += 4;
- }
- else
- {
- F_stack.Pop();
- S_stack.Pop();
- F_Queue.Dequeue();
- i--;
- opredelitel *= -1;
- flag = true;
- }
- }
- }
- else
- {
- if (S_stack.Count == 0 || F_stack.Count == 0 || T_stack.Count == 0)
- {
- timer1.Stop();
- }
- else
- {
- if (F_stack.Peek().Location.X == F_stack.Peek().Location.X && F_stack.Peek().Location.Y >= pot1 && flag)
- {
- F_stack.Peek().Top -= 4;
- }
- else if (F_stack.Peek().Location.Y == F_stack.Peek().Location.Y && F_stack.Peek().Location.X < T_stack.Peek().Location.X)
- {
- F_stack.Peek().Left += 4;
- flag = false;
- }
- else if (F_stack.Peek().Location.X == F_stack.Peek().Location.X && F_stack.Peek().Location.Y <= T_Queue.Peek().Location.Y)
- {
- F_stack.Peek().Top += 4;
- }
- else
- {
- F_stack.Pop();
- T_stack.Pop();
- T_Queue.Dequeue();
- i--;
- flag = true;
- opredelitel *= -1;
- }
- }
- }
- }//end move_1_2
- /*public void move_1_3()
- {
- if (F_stack.Count == 0 && T_stack.Count == 0)
- {
- timer1.Stop();
- }
- else
- {
- if (F_stack.Peek().Location.X == F_stack.Peek().Location.X && F_stack.Peek().Location.Y >= pot1 && flag)
- {
- F_stack.Peek().Top -= 4;
- }
- else if (F_stack.Peek().Location.Y == F_stack.Peek().Location.Y && F_stack.Peek().Location.X < T_stack.Peek().Location.X)
- {
- F_stack.Peek().Left += 4;
- flag = false;
- }
- else if (F_stack.Peek().Location.X == F_stack.Peek().Location.X && F_stack.Peek().Location.Y <= T_Queue.Peek().Location.Y)
- {
- F_stack.Peek().Top += 4;
- }
- else
- {
- //Int_Stack.Push(1);
- F_stack.Pop();
- T_stack.Pop();
- T_Queue.Dequeue();
- i--;
- flag = true;
- }
- }
- }*///end_move_1_3
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement