public Node(int row, int col, Dir dir, Yard y) { this.row = row; this.col = col; this.dir = dir; this.y = y; }
public void paint(Yard y) { if (size == 0) { return; } if (count == 0) { this.y = y; Node n = new Node(20, 22, Dir.L, y); this.head = n; this.tail = n; head.next = tail; head.prev = head; tail.prev = head; tail.next = tail; for (int i = 0; i < Yard.size; i++) { AddToHead(); size++; } count++; } else { if (size == 0) { return; } move(); draw(); } }
public void draw(Yard y) { N.Text = "●"; N.AutoSize = false; N.Font = new Font("楷体", 13); N.BackColor = Color.Transparent; this.y = y; if (N.ForeColor == Color.Green) { N.ForeColor = Color.Red; } else { N.ForeColor = Color.Green; } N.Location = new Point(this.row * Yard.BLOCK_SIZE, this.col * Yard.BLOCK_SIZE); N.Size = new Size(Yard.BLOCK_SIZE, Yard.BLOCK_SIZE); this.y.Controls.Add(N); }