omega-rosetta
aien-dev/omega-rosetta
Brought by drakestapleton
omega-rosetta / drafts / rosettacode / mandelbrot-set.wiki
| 1 | =={{header|Omegese}}== |
| 2 | {{works with|omc|sha256 2c824805, aien-dev/omega-mv e5b32567, Linux AArch64}} |
| 3 | Omega has no imports, so the small output helpers (<code>emit</code> and friends) are part of the program. |
| 4 | <syntaxhighlight lang="text"> |
| 5 | om2 |
| 6 | text nl "\n" |
| 7 | text pal " .:-=+*%" |
| 8 | note emit writes every byte of a to stdout; a short write is retried, an error exits 1 |
| 9 | fn emit a view uchar * to void |
| 10 | o = ulong 0 |
| 11 | while lt o len a bound 4096 |
| 12 | k = write 1 a o sub len a o |
| 13 | if le k 0 |
| 14 | exit 1 |
| 15 | end |
| 16 | o = add o ulong k |
| 17 | end |
| 18 | end |
| 19 | fn emitc c uchar to void |
| 20 | b = new uchar 1 0 |
| 21 | put b 0 c |
| 22 | emit b |
| 23 | end |
| 24 | note IEEE f64: one rounding per operator and no fused multiply-add (OMEGESE 9.9), so an |
| 25 | note independent reference in any IEEE-754 binary64 language reproduces every character |
| 26 | fn main to int |
| 27 | for r ulong 24 |
| 28 | ci = sub 1.15 mul f64 r 0.1 |
| 29 | for c ulong 72 |
| 30 | cr = sub mul f64 c 0.0375 2.2 |
| 31 | zr = f64 0.0 |
| 32 | zi = f64 0.0 |
| 33 | it = ulong 0 |
| 34 | while lt it 50 bound 50 |
| 35 | zr2 = mul zr zr |
| 36 | zi2 = mul zi zi |
| 37 | if gt add zr2 zi2 4.0 |
| 38 | break |
| 39 | end |
| 40 | zi = add mul mul 2.0 zr zi ci |
| 41 | zr = add sub zr2 zi2 cr |
| 42 | it = add it 1 |
| 43 | end |
| 44 | if eq it 50 |
| 45 | emitc 35 |
| 46 | else |
| 47 | emitc get pal rem it 8 |
| 48 | end |
| 49 | end |
| 50 | emit nl |
| 51 | end |
| 52 | ret 0 |
| 53 | end |
| 54 | </syntaxhighlight> |
| 55 | {{out}} |
| 56 | <pre> |
| 57 | ................::::::::::-----------------------=====++====------:::::: |
| 58 | ..............:::::::----------------------=======++***:***+=====-----:: |
| 59 | ............::::::---------------------=========++++%% -%: **+======---- |
| 60 | ...........::::---------------------=========++++*%-.*+## -:%*+++=====-- |
| 61 | ..........:::--------------------=========++****%% :*#####%% %%**++++=== |
| 62 | .........::-------------------======++++*%...+-:#. *#=######++%+ % *= |
| 63 | ........:-----------------===+++++++++*** .*#####################*## :*+ |
| 64 | .......:-------------===+****+++++****% +=##########################= %* |
| 65 | .......------=======+++*%%:.. . :. .-##############################=% |
| 66 | ......:--========+++++*%%.= ##.####-+-= #############################.-% |
| 67 | ......-=======+++++*%+..:+############=##############################% * |
| 68 | ......+++**% %%*% -:*-##%##########################################:%*+ |
| 69 | ......+++**% %%*% -:*-##%##########################################:%*+ |
| 70 | ......-=======+++++*%+..:+############=##############################% * |
| 71 | ......:--========+++++*%%.= ##.####-+-= #############################.-% |
| 72 | .......------=======+++*%%:.. . :. .-##############################=% |
| 73 | .......:-------------===+****+++++****% +=##########################= %* |
| 74 | ........:-----------------===+++++++++*** .*#####################*## :*+ |
| 75 | .........::-------------------======++++*%...+-:#. *#=######++%+ % *= |
| 76 | ..........:::--------------------=========++****%% :*#####%% %%**++++=== |
| 77 | ...........::::---------------------=========++++*%-.*+## -:%*+++=====-- |
| 78 | ............::::::---------------------=========++++%% -%: **+======---- |
| 79 | ..............:::::::----------------------=======++***:***+=====-----:: |
| 80 | ................::::::::::-----------------------=====++====------:::::: |
| 81 | </pre> |