-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
54a2023
commit 8c9bd55
Showing
3 changed files
with
39 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,34 @@ | ||
val size: Int = 200; | ||
val maxVal: Float = 4.0; | ||
val maxIter: Int = 50; | ||
val plane: Float = 4.0; | ||
foreign fn termpos(x: Int, y: Int); | ||
foreign fn print(str: String); | ||
|
||
for x in 0 .. size { | ||
for y in 0 .. size { | ||
var cReal: Float = (x * plane / size) - 2; | ||
var cImg: Float = (y * plane / size) - 2; | ||
var zReal: Float = 0; | ||
var zImg: Float = 0; | ||
var count: Float = 0; | ||
while (zReal * zReal + zImg * zImg) <= maxVal && count < 4{ | ||
var temp: Float = (zReal * zReal) - (zImg * zImg) + cReal; | ||
zImg = 2 * zReal * zImg + cImg; | ||
zReal = temp; | ||
count += 1; | ||
} | ||
if count == maxIter { | ||
termpos(x, y); | ||
print("*"); | ||
fn main() Int{ | ||
var size: Float = 200.0; | ||
var maxVal: Float = 4.0; | ||
var maxIter: Int = 50; | ||
var plane: Float = 4.0; | ||
# lmao | ||
var x: Int = 0; | ||
while x < size { | ||
var y: Int = 0; | ||
while y < size { | ||
var cReal: Float = (x * plane / size) - 2.0; | ||
var cImg: Float = (y * plane / size) - 2.0; | ||
var zReal: Float = 0.0; | ||
var zImg: Float = 0.0; | ||
var count: Int = 0; | ||
while (zReal * zReal + zImg * zImg) <= maxVal && count < 4{ | ||
var temp: Float = (zReal * zReal) - (zImg * zImg) + cReal; | ||
zImg = 2.0 * zReal * zImg + cImg; | ||
zReal = temp; | ||
count = count + 1; | ||
} | ||
if count == maxIter { | ||
termpos(x, y); | ||
print("*"); | ||
} | ||
y = y + 1; | ||
} | ||
x = x + 1; | ||
} | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
au BufRead,BufNewFile *.sloth set filetype=sloth |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
:syntax keyword Statement while fn foreign fn var if else return as in | ||
:syntax keyword Type Int String Float Void Bool | ||
:syntax match Number '[1234567890]' | ||
:syntax match Operator '[+ \- \* \/ <= == >= &&]' | ||
:syntax region String start=+"+ skip=+\\+ end=+"+ | ||
:syntax match paren "(" | ||
:syntax match Function "\w\+\s*(" contains=paren | ||
:syntax match Comment "#.*" |