interplane.Get Omega
Read in your language

omega-rosetta

aien-dev/omega-rosetta

Brought by drakestapleton

branch main Branches Tags History

omega-rosetta / exercises / darts / .meta / example.om

19 lines · 506 bytes Raw Blame History
1note Exercism-style exercise "darts": https://exercism.org/tracks/python/exercises/darts
2note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
3note score is the points of a dart landing at (x, y): 10 inside or on the circle of radius 1 around
4note the centre, 5 within radius 5, 1 within radius 10, 0 outside.
5note Check it with: sh exercise.sh exercises/darts
6om2
7fn score x f64 y f64 to ulong
8d = add mul x x mul y y
9if le d 1.0
10ret 10
11end
12if le d 25.0
13ret 5
14end
15if le d 100.0
16ret 1
17end
18ret 0
19end