public int CompareTo(Mine other) { int result = this.Delay.CompareTo(other.Delay); if (result == 0) { result = this.Id.CompareTo(other.Id); } return result; }
private void Explode(Mine mine) { var damagedMinions = this.minionsByCoordinates.Range(mine.XCoordinate - mine.Player.Radius, true, mine.XCoordinate + mine.Player.Radius, true).Values.ToList(); foreach (var damagedMinion in damagedMinions) { damagedMinion.Health -= mine.Damage; if (damagedMinion.Health <= 0) { this.minionsByCoordinates.Remove(damagedMinion.XCoordinate, damagedMinion); var player = mine.Player; this.playersByScore.Remove(player); player.Score++; this.playersByScore.Add(player); } } }
public void SetMine(string playerName, int xCoordinate, int delay, int damage) { if (!this.playersByName.ContainsKey(playerName)) { throw new ArgumentException("No such player."); } if (xCoordinate < 0 || xCoordinate > 1000000) { throw new ArgumentException("Invalid coordinate"); } if (delay < 1 || delay > 10000) { throw new ArgumentException("Incorrect delay!"); } if (damage < 0 || damage > 100) { throw new ArgumentException("Incorrect damage!"); } var player = this.playersByName[playerName]; var mine = new Mine(this.mineCounter++,xCoordinate, delay, damage,player); this.minesByDelay.Add(mine); }
public int CompareTo(Mine other) { return(this.Id.CompareTo(other.Id)); }
public int CompareTo(Mine other) { throw new System.NotImplementedException(); }
public int CompareTo(Mine other) { throw new System.NotImplementedException(); }