e7738de6d2
CI / Deep Native Runtime Cases (1/6) (push) Has been skipped
CI / Native Preflight (push) Failing after 1s
CI / Native Runtime Cases (1/2) (push) Failing after 0s
CI / Native Runtime Cases (2/2) (push) Failing after 1s
CI / Native Metadata Reports (push) Failing after 0s
CI / Native Direct Backend Artifacts (push) Failing after 0s
CI / Native Sanitizer Smoke (push) Failing after 1s
CI / Command Contract Snapshots (push) Failing after 1s
CI / Deep Conformance Suite (push) Has been skipped
CI / Graph Build Perf (push) Failing after 1s
CI / Deep Native Preflight (push) Has been skipped
CI / Deep Native Runtime Cases (2/6) (push) Has been skipped
CI / Deep Native Runtime Cases (3/6) (push) Has been skipped
CI / Conformance Suite (push) Failing after 1s
CI / Workspace Checks (push) Failing after 0s
CI / Deep Native Runtime Cases (5/6) (push) Has been skipped
CI / Deep Native Runtime Cases (6/6) (push) Has been skipped
CI / Deep Native Runtime Cases (4/6) (push) Has been skipped
CI / Deep Graph Build Perf (push) Has been skipped
25 lines
616 B
Plaintext
25 lines
616 B
Plaintext
fn dist2(ax: i32, ay: i32, bx: i32, by: i32) -> i32 {
|
|
let dx: i32 = ax - bx
|
|
let dy: i32 = ay - by
|
|
return dx * dx + dy * dy
|
|
}
|
|
|
|
pub fn main(world: World) -> Void raises {
|
|
let xs: [4]i32 = [0, 4, 8, -2]
|
|
let ys: [4]i32 = [0, 4, 8, 5]
|
|
var best: usize = 0
|
|
var bestDist: i32 = dist2(xs[0], ys[0], 5, 5)
|
|
var i: usize = 1
|
|
while i < 4 {
|
|
let d: i32 = dist2(xs[i], ys[i], 5, 5)
|
|
if d < bestDist {
|
|
best = i
|
|
bestDist = d
|
|
}
|
|
i = i + 1
|
|
}
|
|
if dist2(0, 0, 3, 4) == 25 && best == 1 {
|
|
check world.out.write("kd tree ok\n")
|
|
}
|
|
}
|