Discuss Scratch
- Discussion Forums
- » Advanced Topics
- » Obscure - The brand-new, Turing-Complete, easy to use programming language
- i_eat_coffee
-
Scratcher
1000+ posts
Obscure - The brand-new, Turing-Complete, easy to use programming language
How do you make floats?there is no interpreter error, no idea
Also this code still isn't working….array 5.04 4.99 5.97 5.32 4.62 5.34 6.12 as Dem
random 0 10 as PV
if PV > {Dem:1}
subtract PV {Dem:1} as Trump_win
out Trump won Arizona by {Trump_win}
end
if PV < {Dem:1}
subtract {Dem:1} PV as Harris_win
out Harris won Arizona by {Harris_win}
end
also
i added reverse
array 1 2 3 as x
out {x:1} {x:2} {x:3}
reverse array x as x
out {x:1} {x:2} {x:3}
set z to Hello There
reverse text z as z
out {z}
- i_eat_coffee
-
Scratcher
1000+ posts
Obscure - The brand-new, Turing-Complete, easy to use programming language
How do you make floats?
Also this code still isn't working….array 5.04 4.99 5.97 5.32 4.62 5.34 6.12 as Dem
random 0 10 as PV
if PV > {Dem:1}
subtract PV {Dem:1} as Trump_win
out Trump won Arizona by {Trump_win}
end
if PV < {Dem:1}
subtract {Dem:1} PV as Harris_win
out Harris won Arizona by {Harris_win}
end
So the problem is that you didn't put curly brackets in between PV, so it was literally comparing the string “PV” to 5.04
try this:
array 5.04 4.99 5.97 5.32 4.62 5.34 6.12 as Dem
random 0 10 as PV
if {PV} > {Dem:1}
subtract {PV} {Dem:1} as Trump_win
out Trump won Arizona by {Trump_win}
end
if {PV} < {Dem:1}
subtract {Dem:1} {PV} as Harris_win
out Harris won Arizona by {Harris_win}
end
- ThisIsTemp1
-
Scratcher
1000+ posts
Obscure - The brand-new, Turing-Complete, easy to use programming language
-snip-Oh thank you!
- ThisIsTemp1
-
Scratcher
1000+ posts
Obscure - The brand-new, Turing-Complete, easy to use programming language
Why can't the random number generator support negatives?
Error: Invalid random statement: random -1 1 as BV
- i_eat_coffee
-
Scratcher
1000+ posts
Obscure - The brand-new, Turing-Complete, easy to use programming language
Why can't the random number generator support negatives?regex doesn't know that numbers can be negative so it thinks ur trying to put random characters in itError: Invalid random statement: random -1 1 as BV
ill fix it in one minute
- i_eat_coffee
-
Scratcher
1000+ posts
Obscure - The brand-new, Turing-Complete, easy to use programming language
done^^Why can't the random number generator support negatives?regex doesn't know that numbers can be negative so it thinks ur trying to put random characters in itError: Invalid random statement: random -1 1 as BV
ill fix it in one minute
- i_eat_coffee
-
Scratcher
1000+ posts
Obscure - The brand-new, Turing-Complete, easy to use programming language
added some cool icons to buttons
- ThisIsTemp1
-
Scratcher
1000+ posts
Obscure - The brand-new, Turing-Complete, easy to use programming language
Here is my entry for the contest 
Entry for the contest. Basically this is a sim of a Harris-Trump matchup, using polling and demographics in the 7 swing states. The numbers at the end are the total electoral votes provided all non-battleground states do not swing, with Harris at the left and Trump at the right. The only problem are floating point errors.

array 5.04 4.99 5.97 5.32 4.62 5.34 6.12 as Dem
random 0 10 as PV
random -1 1 as BV
random -1 1 as HV
random -2 2 as FV
random -2 2 as WCV
random -3 3 as YV
random -3 3 as CV
set Trump_EV to 219
set Harris_EV to 226
add {PV} {HV} as Arizona
if {Arizona} > {Dem:1}
subtract {Arizona} {Dem:1} as Trump_win
out Trump won Arizona by {Trump_win}
add {Trump_EV} 11 as Trump_EV
end
if {Arizona} < {Dem:1}
subtract {Dem:1} {Arizona} as Harris_win
out Harris won Arizona by {Harris_win}
add {Harris_EV} 11 as Harris_EV
end
add {PV} {BV} as Georgia
if {Georgia} > {Dem:2}
subtract {Georgia} {Dem:2} as Trump_win
out Trump won Georgia by {Trump_win}
add {Trump_EV} 16 as Trump_EV
end
if {Georgia} < {Dem:2}
subtract {Dem:2} {Georgia} as Harris_win
out Harris won Georgia by {Harris_win}
add {Harris_EV} 16 as Harris_EV
end
add {PV} {WCV} as Michigan
if {Michigan} > {Dem:3}
subtract {Michigan} {Dem:3} as Trump_win
out Trump won Michigan by {Trump_win}
add {Trump_EV} 15 as Trump_EV
end
if {Michigan} < {Dem:3}
subtract {Dem:3} {Michigan} as Harris_win
out Harris won Michigan by {Harris_win}
add {Harris_EV} 15 as Harris_EV
end
add {PV} {YV} as Nevada
if {Nevada} > {Dem:4}
subtract {Nevada} {Dem:4} as Trump_win
out Trump won Nevada by {Trump_win}
add {Trump_EV} 6 as Trump_EV
end
if {Nevada} < {Dem:4}
subtract {Dem:4} {Nevada} as Harris_win
out Harris won Nevada by {Harris_win}
add {Harris_EV} 6 as Harris_EV
end
add {PV} {FV} as North_Carolina
if {North_Carolina} > {Dem:5}
subtract {North_Carolina} {Dem:5} as Trump_win
out Trump won North Carolina by {Trump_win}
add {Trump_EV} 16 as Trump_EV
end
if {North_Carolina} < {Dem:5}
subtract {Dem:5} {North_Carolina} as Harris_win
out Harris won North Carolina by {Harris_win}
add {Harris_EV} 16 as Harris_EV
end
add {PV} {WCV} as Pennsylvania
if {Pennsylvania} > {Dem:6}
subtract {Pennsylvania} {Dem:6} as Trump_win
out Trump won Pennsylvania by {Trump_win}
add {Trump_EV} 19 as Trump_EV
end
if {Pennsylvania} < {Dem:6}
subtract {Dem:6} {Pennsylvania} as Harris_win
out Harris won Pennsylvania by {Harris_win}
add {Harris_EV} 19 as Harris_EV
end
set Wisconsin to {PV}
if {Wisconsin} > {Dem:7}
subtract {Wisconsin} {Dem:7} as Trump_win
out Trump won Wisconsin by {Trump_win}
add {Trump_EV} 10 as Trump_EV
end
if {Wisconsin} < {Dem:7}
subtract {Dem:7} {Wisconsin} as Harris_win
out Harris won Wisconsin by {Harris_win}
add {Harris_EV} 10 as Harris_EV
end
out {Harris_EV}-{Trump_EV}
Entry for the contest. Basically this is a sim of a Harris-Trump matchup, using polling and demographics in the 7 swing states. The numbers at the end are the total electoral votes provided all non-battleground states do not swing, with Harris at the left and Trump at the right. The only problem are floating point errors.
Last edited by ThisIsTemp1 (Sept. 3, 2024 17:27:55)
- catsarecool39
-
Scratcher
34 posts
Obscure - The brand-new, Turing-Complete, easy to use programming language
you made this? HOW?
- i_eat_coffee
-
Scratcher
1000+ posts
Obscure - The brand-new, Turing-Complete, easy to use programming language
you made this? HOW?using html and javascript
- catsarecool39
-
Scratcher
34 posts
Obscure - The brand-new, Turing-Complete, easy to use programming language
is there a way to create a forever loop that does not crash your pc?
- ominouswolf
-
Scratcher
65 posts
Obscure - The brand-new, Turing-Complete, easy to use programming language
Can you add the For loop into Obscure? It can be really usefull.
for each [ v] in ()(I attempted to make the For loop in scratch using scratch blocks. Turns out i dont know what Im doing =/)
end
Last edited by ominouswolf (Sept. 3, 2024 18:15:45)
- i_eat_coffee
-
Scratcher
1000+ posts
Obscure - The brand-new, Turing-Complete, easy to use programming language
Can you add the For loop into Obscure? It can be really usefull.for each [ v] in ()(I attempted to make the For loop in scratch using scratch blocks. Turns out i dont know what Im doing =/)
end
for each [ v] in () {
} :: controlthis lmao?anyway, yeah, maybe tomorrow ill add it
is there a way to create a forever loop that does not crash your pc?“while” loops need a condition that will be false at some point. if you do 0 = 0 then it will 100% crash because you just want it to look forever instantly
on another note, i added delay:
delay 1
on another note,
the docs need to be rewritten lol theyre too messy
- mybearworld
-
Scratcher
1000+ posts
Obscure - The brand-new, Turing-Complete, easy to use programming language
How do I get the length of an array? I get an error in the JS console when I do this:
array 1 2 3 4 5 as foo
out {length:foo}
- i_eat_coffee
-
Scratcher
1000+ posts
Obscure - The brand-new, Turing-Complete, easy to use programming language
How do I get the length of an array? I get an error in the JS console when I do this:updated it, try againarray 1 2 3 4 5 as foo
out {length:foo}
- ominouswolf
-
Scratcher
65 posts
Obscure - The brand-new, Turing-Complete, easy to use programming language
I found a bug, however apparently its unsuitable language… so that sucks
. To recreate it, try getting an element from a array using another variable.
. To recreate it, try getting an element from a array using another variable.- i_eat_coffee
-
Scratcher
1000+ posts
Obscure - The brand-new, Turing-Complete, easy to use programming language
I found a bug, however apparently its unsuitable language… so that sucksi dont understand…. To recreate it, try getting an element from a array using another variable.
hm
could u post a screenshot of your code & the error?
- Scratchtheguy1
-
Scratcher
500+ posts
Obscure - The brand-new, Turing-Complete, easy to use programming language
You are smart!
when green flag clicked
say [Wow!] for (2) secs
Last edited by Scratchtheguy1 (Sept. 3, 2024 18:53:05)
- mybearworld
-
Scratcher
1000+ posts
Obscure - The brand-new, Turing-Complete, easy to use programming language
(#137)I think they mean that you can't do something like this?
i dont understand…
hm
could u post a screenshot of your code & the error?
array 1 as foo
set i to 1
out {foo:{i}}
- blubby4
-
Scratcher
100+ posts
Obscure - The brand-new, Turing-Complete, easy to use programming language
Aw, man. Everything happened while I was asleep! Now my interpreter is more behind than it was before! I'll try to post it soon though.