public Robot(int mrow, int mcol) { Randomnummer row = new Randomnummer(1, mrow); //Random row genereren 4 rijen Randomnummer col = new Randomnummer(1, mcol); //random Col generen this.Row = row.Randomnr(); this.Col = col.Randomnr(); this.MRow = mrow; this.MCol = mcol; }
public double GetRow(string Movements) { foreach (char i in Movements) { this.pCol = Col; //Voor Controle this.pRow = Row; //Voor controle Randomnummer N = new Randomnummer(1, 4); //binnen de loop om iedere keer een nieuwe 'move int move = N.Randomnr(); if (move == 1) { this.Row = this.Row - 1; } if (move == 2) { this.Row = this.Row + 1; } if (this.Row == 0) { this.Row = 1; } if (this.Row == this.MRow + 1) { this.Row = this.MRow; } if (move == 3) { this.Col = this.Col - 1; } if (move == 4) { this.Col = this.Col + 1; } if (this.Col == 0) { this.Col = 1; } if (this.Col == this.MCol + 1) { this.Col = this.MCol; } } return(this.Row); //moet een waarde terug gegeven worden }