local function p(p)for J,v in pairs(checkpoints)do if v.CollisionBody==p then return v end end return nil end local function J(p,J)for v,A in pairs(checkpoints)do if A:PlayerLapPassed(p,J)~=J then return false end end return true end local function v(p)racers[p]=Racer.new()end local function A()for p,J in pairs(racers)do if not J:HasFinishedLap(numLaps)then return false end end return true end

local function getCheckpointFromPart(part)
	for _, checkpoint in pairs(checkpoints) do
		if checkpoint.CollisionBody == part then
			return checkpoint
		end
	end
	return nil
end -- getCheckpointFromPart()

local function hasPlayerFinishedLap(player, lap)
	for _, checkpoint in pairs(checkpoints) do
		if checkpoint:PlayerLapPassed(player, lap) ~= lap then
			return false
		end
	end
	return true
end -- hasPlayerFinishedLap()

local function addRacer(player)
	racers[player] = Racer.new()
end -- addRacer()

local function checkAllFinished()
	for _, racer in pairs(racers) do
		if not racer:HasFinishedLap(numLaps) then
			return false
		end
	end
	return true
end -- checkAllFinished()