Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/si/rosetta/exercises/queen-attack/.meta/example.om # omega-mv Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance. Brought by drakestapleton Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / si / rosetta / exercises / queen-attack / .meta / example.om` 33 lines ยท 814 bytes Raw Blame History 1 note Exercism-style exercise "queen-attack": https://exercism.org/tracks/python/exercises/queen-attack 2 note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 3 note Rows and columns run 0 .. 7. create checks one queen's position: 0 valid, 1 row negative, 4 note 2 row past the board, 3 column negative, 4 column past the board (row checked first). 5 note canattack is true when queens at (wr, wc) and (br, bc) share a row, column or diagonal. 6 note Check it with: sh exercise.sh exercises/queen-attack 7 om2 8 fn create row long col long to int 9 if lt row 0 10 ret 1 11 end 12 if gt row 7 13 ret 2 14 end 15 if lt col 0 16 ret 3 17 end 18 if gt col 7 19 ret 4 20 end 21 ret 0 22 end 23 fn canattack wr long wc long br long bc long to bool 24 dr = sub wr br 25 dc = sub wc bc 26 if lt dr 0 27 dr = neg dr 28 end 29 if lt dc 0 30 dc = neg dc 31 end 32 ret or or eq dr 0 eq dc 0 eq dr dc 33 end