public Form1() { InitializeComponent(); Console.WriteLine("Yoohooo " + System.Threading.Thread.CurrentThread.ManagedThreadId); this.holderPanel.ColumnCount = NUM_Y; this.holderPanel.RowCount = NUM_X; this.holderPanel.ColumnStyles.Clear(); this.holderPanel.RowStyles.Clear(); this.holderPanel.Controls.Clear(); for (int i = 0; i < NUM_X; i++) { holderPanel.RowStyles.Add(new RowStyle(SizeType.AutoSize)); for (int j = 0; j < NUM_Y; j++) { holderPanel.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize)); boxes[i, j] = new PictureBox(); boxes[i, j].Image = Black; holderPanel.Controls.Add(boxes[i,j], i, j); } } myAnt = new Ant(new Point(3, 3), this); boxes[3, 3].Image = Ant; }
/// <summary> /// アリの行動 /// </summary> private void ControlAnt() { if (this._ants.Count == 0) { AddAntAuto(); return; } Ant ant = (Ant)this._ants[0]; if (ant.IsAlive == false) { DeleteAnt(0); } if (this._antMoveCount > this._antAddSpan && this._ants.Count < this._maxAntCount) { //アリ追加 AddAntAuto(); this._antMoveCount = 0; } }
public void NewAntIsOnCustomPosition() { var somePosition = new Position(0, 1); var ant = new Ant(somePosition); Assert.Equal(somePosition, ant.GetPosition()); }