Basic simulation and evaluation
MadKnight
17.6K views
Open Source Your Knowledge, Become a Contributor
Technology knowledge has to be shared and made accessible for free. Join the movement.
Overview
When making classes for basic objects you need to not forget to add some extra variables for the values that don't come with inputs like lap number for a pod.
Checkpoint class
class Checkpoint
{
public int id;
public Point position;
public Checkpoint prev, next;
public Checkpoint(int id) {
this.id = id;
position = new Point(Console.ReadLine());
}
}
Pod class
class Pod
{
Point position;
Vector velocity, direction;
float angle;
int lap;
Checkpoint target;
public Checkpoint() { }
public void Update() {
position = new Point(Console.ReadLine());
velocity = new Vector(Console.ReadLine());
angle = float.Parse(Console.ReadLine());
int ncpId = int.Parse(Console.ReadLine());
if (ncpId != target.id) {
target = target.next;
if (target.id == 1)
lap++;
}
}
}
Open Source Your Knowledge: become a Contributor and help others learn. Create New Content