public Terrain(String name, bool[,] map, Position start, Position goal) { this.name = name; this.width = map.GetLength(1); this.height = map.GetLength(0); this.map = map; this.start = start; this.goal = goal; this.startBlock = new Block(this.start, this.start); this.block = this.startBlock; }
private void eraseBlockSub(Block block, Graphics g, float unit) { this.drawField(g, block.B1.X, block.B1.Y, unit); if (!block.isStanding()) { this.drawField(g, block.B2.X, block.B2.Y, unit); } }
public void reStart() { this.block = this.startBlock; }
private bool check(Block block) { return block.isStanding() && block.B1.check(this.goal); }
public bool isLegalBlock( Block block ) { bool legal = false; if (block.B1.X >= 0 && block.B1.Y >= 0 && block.B2.X >= 0 && block.B2.Y >= 0) { if (block.B1.X < this.height && block.B1.Y < this.width && block.B2.X < this.height && block.B2.Y < this.width) { legal = map[block.B1.X, block.B1.Y] && map[block.B2.X, block.B2.Y]; } } return legal; }