Discuss Scratch

endyourenite
Scratcher
100+ posts

Obscure - The brand-new, Turing-Complete, easy to use programming language

davidtheplatform wrote:

My submission to the contest: A BrainF interpreter!
It supports all of BF, including input*, neverending/interacive programs, and performance counters.
It's really slow, running at about 1500 cycles/second.
Here's the code:
# BF interpreter
# (c) 2024 davidtheplatform


out Initializing...
date timestamp as init_time
delay 0.1

array         > >                   ⠀ ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~  €  ‚ ƒ „ … † ‡ ˆ ‰ Š ‹ Œ  Ž   ‘ ’ “ ” • – — ˜ ™ š › œ  ž Ÿ   ¡ ¢ £ ¤ ¥ ¦ § ¨ © ª « ¬ ­ ® ¯ ° ± ² ³ ´ µ ¶ · ¸ ¹ º » ¼ ½ ¾ ¿ À Á Â Ã Ä Å Æ Ç È É Ê Ë Ì Í Î Ï Ð Ñ Ò Ó Ô Õ Ö × Ø Ù Ú Û Ü Ý Þ ß à á â ã ä å æ ç è é ê ë ì í î ï ð ñ ò ó ô õ ö ÷ ø ù ú û ü ý þ as characters

set bracket_level to 0

function jump_open
set current_letter to {letter ip:program}
set jump_stop to 0
set bracket_level to 0
while {jump_stop} = 0
if {current_letter} = ]
add {bracket_level} 1 as bracket_level
end
if {current_letter} = [
add {bracket_level} -1 as bracket_level
end
add {ip} -1 as ip
set current_letter to {letter ip:program}
if {bracket_level} = 0
set jump_stop to 1
end
end
add {ip} 1 as ip
end

function jump_close
set current_letter to {letter ip:program}
set jump_stop to 0
set bracket_level to 0
while {jump_stop} = 0
if {current_letter} = [
add {bracket_level} 1 as bracket_level
end
if {current_letter} = ]
add {bracket_level} -1 as bracket_level
end
add {ip} 1 as ip
set current_letter to {letter ip:program}
if {bracket_level} = 0
set jump_stop to 1
end
end
add {ip} -1 as ip
end

function input_to_ascii
set c to 1
while {c} < 256
if {characters:c} = {input}
replace {dp} of memory as {c}
set c to 256
end
add {c} 1 as c
end
end

function print_memory
outl [
set count to 0
while {count} < {length:memory}
add {count} 1 as count
outl {memory:count},
end
out ]
end

# data pointer
set dp to 1
# instruction pointer
set ip to 1

# initialize memory
array 0 as memory
set counter to 0
while {counter} < 29999
push memory 0
add {counter} 1 as counter
end

date timestamp as init_end_time

# get program
ask Enter Program as program
# add a character to the end because of a bug
set program to {program}~

set cycles to 0
set program_ended to 0
date timestamp as start_time
while {program_ended} = 0
set instruction to {letter ip:program}
add {cycles} 1 as cycles
# out ({cycles}) {ip}: {instruction}

if {instruction} = +
set temp to {memory:dp}
add {temp} 1 as temp
replace {dp} of memory as {temp}
if {memory:dp} = 256
replace {dp} of memory as 0
end
end

if {instruction} = -
set temp to {memory:dp}
add {temp} -1 as temp
replace {dp} of memory as {temp}
if {memory:dp} = -1
replace {dp} of memory as 255
end
end

if {instruction} = <
add {dp} -1 as dp
end

if {instruction} = >
add {dp} 1 as dp
end

if {instruction} = [
if {memory:dp} = 0
call jump_close
end
end
if {instruction} = ]
if {memory:dp} != 0
call jump_open
end
end

if {instruction} = .
set char to {memory:dp}
set is_10 to 0
set is_13 to 0
if {char} != 10
set is_10 to 1
end
if {char} != 13
set is_13 to 1
end
multiply {is_10} {is_13} as not_10_13
if {not_10_13} = 0
out ⠀
end
if {not_10_13} = 1
outl {characters:char}
end

# add a delay so the text shows up
delay 0.01
end

if {instruction} = ,
ask Program wants input (a single char = that char, anything else = EOF, blank input will cause a crash) as input
call input_to_ascii
end

# add a small delay every once in a while to keep the page from crashing
modulus {cycles} 1000 as should_delay
if {should_delay} = 0
delay 0.01
end

# debugging
if {instruction} = #
out --- Debug ---
call print_memory
out dp: {dp}
out ip: {ip}
out -------------
end

add {ip} 1 as ip
if {ip} = {length:program}
set program_ended to 1
end
end

date timestamp as end_time
subtract {init_end_time} {init_time} as init_duration
subtract {end_time} {start_time} as run_duration
divide {cycles} {run_duration} as cycles_per_ms
multiply {cycles_per_ms} 1000 as cycles_per_s

out ⠀
out ⠀
out Program finished in {run_duration}ms; {cycles} cycles; {cycles_per_s} cycles per second; init time {init_duration}ms

If you don't know what BF is, its an esoteric language designed to be as simple as possible. “BF” is an abbreviation of a word not allowed on scratch. There are only 8 instructions:
> 	Increment the data pointer by one (to point to the next cell to the right).
< Decrement the data pointer by one (to point to the next cell to the left).
+ Increment the byte at the data pointer by one.
- Decrement the byte at the data pointer by one.
. Output the byte at the data pointer.
, Accept one byte of input, storing its value in the byte at the data pointer.
[ If the byte at the data pointer is zero, then instead of moving the instruction pointer forward to the next command, jump it forward to the command after the matching ] command.
] If the byte at the data pointer is nonzero, then instead of moving the instruction pointer forward to the next command, jump it back to the command after the matching [ command.

Here's some example programs:
Hello world
++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.
Powers of two
>++++++++++>>+<+[[+++++[>++++++++<-]>.<++++++[>--------<-]+<<]>.>[->[<++>-[<++>-[<++>-[<++>-[<-------->>[-]++<-[<++>-]]]]]]<[>+<-]+>>]<<]
Sierpinski triangle (slow - takes around 15 minutes to finish)
++++++++[>+>++++<<-]>++>>+<[-[>>+<<-]+>>]>+[-<<<[->[+[-]+>++>>>-<<]<[<]>>++++++[<<+++++>>-]+<<++.[-]<<]>.>+[>>]>+]
A quine (also slow - I don't know if it actually works)
->++>+++>+>+>+++>>>>>>>>>>>>>>>>>>>>+>+>++>+++>++>>+++>+>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>+>+>>+++>>+++>>>>>+++>+>>>>>>>>>++>+++>+++>+>>+++>>>+++>+>++>+++>>>+>+>
++>+++>+>+>>+++>>>>>>>+>+>>>+>+>++>+++>+++>+>>+++>>>+++>+>++>+++>++>>+>+>++>+++>
+>+>>+++>>>>>+++>+>>>>>++>+++>+++>+>>+++>>>+++>+>+++>+>>+++>>+++>>++[[>>+[>]++>+
+[<]<-]>+[>]<+<+++[<]<+]>+[>]++++>++[[<++++++++++++++++>-]<+++++++++.<]
Another quine (this one works)
>+++++>+++>+++>+++++>+++>+++>+++++>++++++>+>++>+++>++++>++++>+++>+++>+++++>+>+
>++++>+++++++>+>+++++>+>+>+++++>++++++>+++>+++>++>+>+>++++>++++++>++++>++++>+++
>+++++>+++>+++>++++>++>+>+>+>+>++>++>++>+>+>++>+>+>++++++>++++++>+>+>++++++
>++++++>+>+>+>+++++>++++++>+>+++++>+++>+++>++++>++>+>+>++>+>+>++>++>+>+>++>++>+
>+>+>+>++>+>+>+>++++>++>++>+>+++++>++++++>+++>+++>+++>+++>+++>+++>++>+>+>+>+>++
>+>+>++++>+++>+++>+++>+++++>+>+++++>++++++>+>+>+>++>+++>+++>+++++++>+++>++++>+
>++>+>+++++++>++++++>+>+++++>++++++>+++>+++>++>++>++>++>++>++>+>++>++>++>++>++
>++>++>++>++>+>++++>++>++>++>++>++>++>++>+++++>++++++>++++>+++>+++++>++++++>++++
>+++>+++>++++>+>+>+>+>+++++>+++>+++++>++++++>+++>+++>+++>++>+>+>+>++++>++++
[[>>>+<<<-]<]>>>>[<<[-]<[-]+++++++[>+++++++++>++++++<<-]>-.>+>[<.<<+>>>-]>]
<<<[>>+>>>>+<<<<<<-]>++[>>>+>>>>++>>++>>+>>+[<<]>-]>>>-->>-->>+>>+++>>>>+[<<]
<[[-[>>+<<-]>>]>.[>>]<<[[<+>-]<<]<<]
Fibonacci sequence
>++++++++++>+>+[[+++++[>++++++++<-]>.<++++++[>--------<-]+<<<]>.>>[[-]<[>+<-]>>[<<+>+>-]<[>+<-[>+<-[>+<-[>+<-[>+<-[>+<-[>+<-[>+<-[>+<-[>[-]>+>+<<<-[>+<-]]]]]]]]]]]+>>>]<<<]


*input is kind of weird right now, I plan on making it better soon
This is pretty cool.
endyourenite
Scratcher
100+ posts

Obscure - The brand-new, Turing-Complete, easy to use programming language

Can you add an ‘or’ condition? I was once try to create an or if statement but it didn't work.
ThisIsTemp1
Scratcher
1000+ posts

Obscure - The brand-new, Turing-Complete, easy to use programming language

Can you add a stop this script or stop this program. Like the exit function on python

Last edited by ThisIsTemp1 (Sept. 8, 2024 20:42:49)

BigNate469
Scratcher
1000+ posts

Obscure - The brand-new, Turing-Complete, easy to use programming language

When I try to run Sample Project 2:
Error: Invalid variable assignment: set bottles as 99

Similar error code when trying to run Sample Project 1:
Error: Invalid variable assignment: set nth as first

I think this is because they both use the old “set name as value” syntax for variable declaration. In both cases just changing “as” to “to” fixed the problem.

Last edited by BigNate469 (Sept. 8, 2024 20:48:57)

i_eat_coffee
Scratcher
1000+ posts

Obscure - The brand-new, Turing-Complete, easy to use programming language

BigNate469 wrote:

When I try to run Sample Project 2:
Error: Invalid variable assignment: set bottles as 99

Similar error code when trying to run Sample Project 1:
Error: Invalid variable assignment: set nth as first

I think this is because they both use the old “set name as value” syntax for variable declaration. In both cases just changing “as” to “to” fixed the problem.
the sample projects have been updated, it just seems like they were saved in your browser before i updated the variable syntax
50_scratch_tabs
Scratcher
500+ posts

Obscure - The brand-new, Turing-Complete, easy to use programming language

davidtheplatform wrote:

(#239)
My submission to the contest: A BrainF interpreter!
DARN IT DARN IT DARN IT you beat me to it. I was going to make BF in Obscure, not for the contest, but I wanted to be the first. I had this glitch where it said I was missing 3 ends, even though I and ChatGPT checked multiple times. Did you run into this? What was your solution?
davidtheplatform
Scratcher
500+ posts

Obscure - The brand-new, Turing-Complete, easy to use programming language

50_scratch_tabs wrote:

davidtheplatform wrote:

(#239)
My submission to the contest: A BrainF interpreter!
DARN IT DARN IT DARN IT you beat me to it. I was going to make BF in Obscure, not for the contest, but I wanted to be the first. I had this glitch where it said I was missing 3 ends, even though I and ChatGPT checked multiple times. Did you run into this? What was your solution?
Can you put the offending code here? ChatGPT probably can't help because of how new obscure is, and how little code exists for it.
50_scratch_tabs
Scratcher
500+ posts

Obscure - The brand-new, Turing-Complete, easy to use programming language

davidtheplatform wrote:

(#250)
Can you put the offending code here?
Really sorry, it's on my computer, I am on my phone now. I will put it here ASAP.

Also I'm pretty sure that ChatGPT at least understood that ifs and whiles need matching ends.

Last edited by 50_scratch_tabs (Sept. 8, 2024 21:31:59)

i_eat_coffee
Scratcher
1000+ posts

Obscure - The brand-new, Turing-Complete, easy to use programming language

I shall make a GPT that understands Obscure code
mybearworld
Scratcher
1000+ posts

Obscure - The brand-new, Turing-Complete, easy to use programming language

i_eat_coffee wrote:

(#252)
I shall make a GPT that understands Obscure code
Or improve the docs and feed that to ChatGPT
endyourenite
Scratcher
100+ posts

Obscure - The brand-new, Turing-Complete, easy to use programming language

i_eat_coffee wrote:

elip100 wrote:

I wrote this code for the contest. It is completely valid but it stops for no reason after the first question due to a bug. Please fix!

clear
out TRIVIA CHALLENGE












set comment to DO NOT SCROLL BENEATH THIS LINE OR ANSWERS WILL BE REVEALED!!!























delay 0.1
ask Press enter to play! (make sure you can see output) as output

set score to 0

clear
set q to What is the capital of France?
set a to Paris
set b to London
set c to Rome
set d to Berlin
set answer to a
out {q}
out a) {a}
out b) {b}
out c) {c}
out d) {d}
delay 0.1
ask answer? (a/b/c/d) as input
delay 0.1
if {input} = {answer}
add {score} 1 as score
out Correct! Score: {score}
end
if {input} != {answer}
out Incorrect! Score: {score}
delay 2
clear
set q to Who wrote the play Romeo and Juliet?
set a to William Shakespeare
set b to Charles Dickens
set c to Mark Twain
set d to Jane Austen
set answer to a
out {q}
out a) {a}
out b) {b}
out c) {c}
out d) {d}
delay 0.1
ask answer? (a/b/c/d) as input
delay 0.1
if {input} = {answer}
add {score} 1 as score
out Correct! Score: {score}
end
if {input} != {answer}
out Incorrect! Score: {score}
delay 2
clear
set q to What is the largest planet in our solar system?
set a to Earth
set b to Mars
set c to Jupiter
set d to Saturn
set answer to c
out {q}
out a) {a}
out b) {b}
out c) {c}
out d) {d}
delay 0.1
ask answer? (a/b/c/d) as input
delay 0.1
if {input} = {answer}
add {score} 1 as score
out Correct! Score: {score}
end
if {input} != {answer}
out Incorrect! Score: {score}
delay 2
clear
set q to Which element has the chemical symbol 'O'?
set a to Gold
set b to Oxygen
set c to Silver
set d to Hydrogen
set answer to b
out {q}
out a) {a}
out b) {b}
out c) {c}
out d) {d}
delay 0.1
ask answer? (a/b/c/d) as input
delay 0.1
if {input} = {answer}
add {score} 1 as score
out Correct! Score: {score}
end
if {input} != {answer}
out Incorrect! Score: {score}
delay 2
clear
set q to What is the smallest prime number?
set a to 1
set b to 2
set c to 3
set d to 5
set answer to b
out {q}
out a) {a}
out b) {b}
out c) {c}
out d) {d}
delay 0.1
ask answer? (a/b/c/d) as input
delay 0.1
if {input} = {answer}
add {score} 1 as score
out Correct! Score: {score}
end
if {input} != {answer}
out Incorrect! Score: {score}
delay 2
clear
set q to Who painted the Mona Lisa?
set a to Vincent van Gogh
set b to Pablo Picasso
set c to Leonardo da Vinci
set d to Claude Monet
set answer to c
out {q}
out a) {a}
out b) {b}
out c) {c}
out d) {d}
delay 0.1
ask answer? (a/b/c/d) as input
delay 0.1
if {input} = {answer}
add {score} 1 as score
out Correct! Score: {score}
end
if {input} != {answer}
out Incorrect! Score: {score}
delay 2
clear
set q to What is the capital city of Japan?
set a to Beijing
set b to Seoul
set c to Tokyo
set d to Bangkok
set answer to c
out {q}
out a) {a}
out b) {b}
out c) {c}
out d) {d}
delay 0.1
ask answer? (a/b/c/d) as input
delay 0.1
if {input} = {answer}
add {score} 1 as score
out Correct! Score: {score}
end
if {input} != {answer}
out Incorrect! Score: {score}
delay 2
clear
set q to What is the chemical formula for water?
set a to CO2
set b to H2O
set c to NaCl
set d to O2
set answer to b
out {q}
out a) {a}
out b) {b}
out c) {c}
out d) {d}
delay 0.1
ask answer? (a/b/c/d) as input
delay 0.1
if {input} = {answer}
add {score} 1 as score
out Correct! Score: {score}
end
if {input} != {answer}
out Incorrect! Score: {score}
delay 2
clear
set q to Which planet is known as the Red Planet?
set a to Venus
set b to Mars
set c to Mercury
set d to Neptune
set answer to b
out {q}
out a) {a}
out b) {b}
out c) {c}
out d) {d}
delay 0.1
ask answer? (a/b/c/d) as input
delay 0.1
if {input} = {answer}
add {score} 1 as score
out Correct! Score: {score}
end
if {input} != {answer}
out Incorrect! Score: {score}
delay 2
clear
set q to What is the largest ocean on Earth?
set a to Atlantic Ocean
set b to Indian Ocean
set c to Arctic Ocean
set d to Pacific Ocean
set answer to d
out {q}
out a) {a}
out b) {b}
out c) {c}
out d) {d}
delay 0.1
ask answer? (a/b/c/d) as input
delay 0.1
if {input} = {answer}
add {score} 1 as score
out Correct! Score: {score}
end
if {input} != {answer}
out Incorrect! Score: {score}
delay 2
clear
out COMPLETE!
out You finished with a score of {score}/10


It's not a bug, you simply forgot to put “end” after every if statement…


I fixed it for you:

clear
out TRIVIA CHALLENGE












set comment to DO NOT SCROLL BENEATH THIS LINE OR ANSWERS WILL BE REVEALED!!!























delay 0.1
ask Press enter to play! (make sure you can see output) as output

set score to 0

clear
set q to What is the capital of France?
set a to Paris
set b to London
set c to Rome
set d to Berlin
set answer to a
out {q}
out a) {a}
out b) {b}
out c) {c}
out d) {d}
delay 0.1
ask answer? (a/b/c/d) as input
delay 0.1
if {input} = {answer}
add {score} 1 as score
out Correct! Score: {score}
end
if {input} != {answer}
out Incorrect! Score: {score}
end
delay 2
clear
set q to Who wrote the play Romeo and Juliet?
set a to William Shakespeare
set b to Charles Dickens
set c to Mark Twain
set d to Jane Austen
set answer to a
out {q}
out a) {a}
out b) {b}
out c) {c}
out d) {d}
delay 0.1
ask answer? (a/b/c/d) as input
delay 0.1
if {input} = {answer}
add {score} 1 as score
out Correct! Score: {score}
end
if {input} != {answer}
out Incorrect! Score: {score}
end
delay 2
clear
set q to What is the largest planet in our solar system?
set a to Earth
set b to Mars
set c to Jupiter
set d to Saturn
set answer to c
out {q}
out a) {a}
out b) {b}
out c) {c}
out d) {d}
delay 0.1
ask answer? (a/b/c/d) as input
delay 0.1
if {input} = {answer}
add {score} 1 as score
out Correct! Score: {score}
end
if {input} != {answer}
out Incorrect! Score: {score}
end
delay 2
clear
set q to Which element has the chemical symbol 'O'?
set a to Gold
set b to Oxygen
set c to Silver
set d to Hydrogen
set answer to b
out {q}
out a) {a}
out b) {b}
out c) {c}
out d) {d}
delay 0.1
ask answer? (a/b/c/d) as input
delay 0.1
if {input} = {answer}
add {score} 1 as score
out Correct! Score: {score}
end
if {input} != {answer}
out Incorrect! Score: {score}
end
delay 2
clear
set q to What is the smallest prime number?
set a to 1
set b to 2
set c to 3
set d to 5
set answer to b
out {q}
out a) {a}
out b) {b}
out c) {c}
out d) {d}
delay 0.1
ask answer? (a/b/c/d) as input
delay 0.1
if {input} = {answer}
add {score} 1 as score
out Correct! Score: {score}
end
if {input} != {answer}
out Incorrect! Score: {score}
end
delay 2
clear
set q to Who painted the Mona Lisa?
set a to Vincent van Gogh
set b to Pablo Picasso
set c to Leonardo da Vinci
set d to Claude Monet
set answer to c
out {q}
out a) {a}
out b) {b}
out c) {c}
out d) {d}
delay 0.1
ask answer? (a/b/c/d) as input
delay 0.1
if {input} = {answer}
add {score} 1 as score
out Correct! Score: {score}
end
if {input} != {answer}
out Incorrect! Score: {score}
end
delay 2
clear
set q to What is the capital city of Japan?
set a to Beijing
set b to Seoul
set c to Tokyo
set d to Bangkok
set answer to c
out {q}
out a) {a}
out b) {b}
out c) {c}
out d) {d}
delay 0.1
ask answer? (a/b/c/d) as input
delay 0.1
if {input} = {answer}
add {score} 1 as score
out Correct! Score: {score}
end
if {input} != {answer}
out Incorrect! Score: {score}
end
delay 2
clear
set q to What is the chemical formula for water?
set a to CO2
set b to H2O
set c to NaCl
set d to O2
set answer to b
out {q}
out a) {a}
out b) {b}
out c) {c}
out d) {d}
delay 0.1
ask answer? (a/b/c/d) as input
delay 0.1
if {input} = {answer}
add {score} 1 as score
out Correct! Score: {score}
end
if {input} != {answer}
out Incorrect! Score: {score}
end
delay 2
clear
set q to Which planet is known as the Red Planet?
set a to Venus
set b to Mars
set c to Mercury
set d to Neptune
set answer to b
out {q}
out a) {a}
out b) {b}
out c) {c}
out d) {d}
delay 0.1
ask answer? (a/b/c/d) as input
delay 0.1
if {input} = {answer}
add {score} 1 as score
out Correct! Score: {score}
end
if {input} != {answer}
out Incorrect! Score: {score}
end
delay 2
clear
set q to What is the largest ocean on Earth?
set a to Atlantic Ocean
set b to Indian Ocean
set c to Arctic Ocean
set d to Pacific Ocean
set answer to d
out {q}
out a) {a}
out b) {b}
out c) {c}
out d) {d}
delay 0.1
ask answer? (a/b/c/d) as input
delay 0.1
if {input} = {answer}
add {score} 1 as score
out Correct! Score: {score}
end
if {input} != {answer}
out Incorrect! Score: {score}
end
delay 2
clear
out COMPLETE!
out You finished with a score of {score}/10
Remixed: (C2A)
clear
out ===
out ===
out ===
out TRIVIA CHALLENGE












set comment to DO NOT SCROLL BENEATH THIS LINE OR ANSWERS WILL BE REVEALED!!!























delay 0.1
ask Press enter to play! (make sure you can see output) as output

set score to 0

clear
out ===
out ===
out ===
set q to What is the capital of France?
set a to Paris
set b to London
set c to Rome
set d to Berlin
set answer to a
out {q}
out a) {a}
out b) {b}
out c) {c}
out d) {d}
delay 0.1
ask answer? (a/b/c/d) as input
delay 0.1
if {input} = {answer}
add {score} 1 as score
out Correct! Score: {score}
end
if {input} != {answer}
out Incorrect! Score: {score}
end
delay 2
clear
out ===
out ===
out ===
set q to Who wrote the play Romeo and Juliet?
set a to William Shakespeare
set b to Charles Dickens
set c to Mark Twain
set d to Jane Austen
set answer to a
out {q}
out a) {a}
out b) {b}
out c) {c}
out d) {d}
delay 0.1
ask answer? (a/b/c/d) as input
delay 0.1
if {input} = {answer}
add {score} 1 as score
out Correct! Score: {score}
end
if {input} != {answer}
out Incorrect! Score: {score}
end
delay 2
clear
out ===
out ===
out ===
set q to What is the largest planet in our solar system?
set a to Earth
set b to Mars
set c to Jupiter
set d to Saturn
set answer to c
out {q}
out a) {a}
out b) {b}
out c) {c}
out d) {d}
delay 0.1
ask answer? (a/b/c/d) as input
delay 0.1
if {input} = {answer}
add {score} 1 as score
out Correct! Score: {score}
end
if {input} != {answer}
out Incorrect! Score: {score}
end
delay 2
clear
out ===
out ===
out ===
set q to Which element has the chemical symbol 'O'?
set a to Gold
set b to Oxygen
set c to Silver
set d to Hydrogen
set answer to b
out {q}
out a) {a}
out b) {b}
out c) {c}
out d) {d}
delay 0.1
ask answer? (a/b/c/d) as input
delay 0.1
if {input} = {answer}
add {score} 1 as score
out Correct! Score: {score}
end
if {input} != {answer}
out Incorrect! Score: {score}
end
delay 2
clear
out ===
out ===
out ===
set q to What is the smallest prime number?
set a to 1
set b to 2
set c to 3
set d to 5
set answer to b
out {q}
out a) {a}
out b) {b}
out c) {c}
out d) {d}
delay 0.1
ask answer? (a/b/c/d) as input
delay 0.1
if {input} = {answer}
add {score} 1 as score
out Correct! Score: {score}
end
if {input} != {answer}
out Incorrect! Score: {score}
end
delay 2
clear
out ===
out ===
out ===
set q to Who painted the Mona Lisa?
set a to Vincent van Gogh
set b to Pablo Picasso
set c to Leonardo da Vinci
set d to Claude Monet
set answer to c
out {q}
out a) {a}
out b) {b}
out c) {c}
out d) {d}
delay 0.1
ask answer? (a/b/c/d) as input
delay 0.1
if {input} = {answer}
add {score} 1 as score
out Correct! Score: {score}
end
if {input} != {answer}
out Incorrect! Score: {score}
end
delay 2
clear
out ===
out ===
out ===
set q to What is the capital city of Japan?
set a to Beijing
set b to Seoul
set c to Tokyo
set d to Bangkok
set answer to c
out {q}
out a) {a}
out b) {b}
out c) {c}
out d) {d}
delay 0.1
ask answer? (a/b/c/d) as input
delay 0.1
if {input} = {answer}
add {score} 1 as score
out Correct! Score: {score}
end
if {input} != {answer}
out Incorrect! Score: {score}
end
delay 2
clear
out ===
out ===
out ===
set q to What is the chemical formula for water?
set a to CO2
set b to H2O
set c to NaCl
set d to O2
set answer to b
out {q}
out a) {a}
out b) {b}
out c) {c}
out d) {d}
delay 0.1
ask answer? (a/b/c/d) as input
delay 0.1
if {input} = {answer}
add {score} 1 as score
out Correct! Score: {score}
end
if {input} != {answer}
out Incorrect! Score: {score}
end
delay 2
clear
out ===
out ===
out ===
set q to Which planet is known as the Red Planet?
set a to Venus
set b to Mars
set c to Mercury
set d to Neptune
set answer to b
out {q}
out a) {a}
out b) {b}
out c) {c}
out d) {d}
delay 0.1
ask answer? (a/b/c/d) as input
delay 0.1
if {input} = {answer}
add {score} 1 as score
out Correct! Score: {score}
end
if {input} != {answer}
out Incorrect! Score: {score}
end
delay 2
clear
out ===
out ===
out ===
set q to What is the largest ocean on Earth?
set a to Atlantic Ocean
set b to Indian Ocean
set c to Arctic Ocean
set d to Pacific Ocean
set answer to d
out {q}
out a) {a}
out b) {b}
out c) {c}
out d) {d}
delay 0.1
ask answer? (a/b/c/d) as input
delay 0.1
if {input} = {answer}
add {score} 1 as score
out Correct! Score: {score}
end
if {input} != {answer}
out Incorrect! Score: {score}
end
delay 2
clear
out ===
out ===
out ===
out COMPLETE!
out You finished with a score of {score}/10
Made it so that you can see the questions better

Last edited by endyourenite (Sept. 9, 2024 19:04:15)

ajskateboarder
Scratcher
1000+ posts

Obscure - The brand-new, Turing-Complete, easy to use programming language

Uhh what's with the inconsistency here:
set a to 5
date year as currentYear
array a b c d as alphabet
blubby4
Scratcher
100+ posts

Obscure - The brand-new, Turing-Complete, easy to use programming language

ajskateboarder wrote:

Uhh what's with the inconsistency here:
set a to 5
date year as currentYear
array a b c d as alphabet
It was originally supposed to be
set <value> as <variable>
but it behaved like
set <variable> as <value>
so it was changed to
set <variable> to <value>
mybearworld
Scratcher
1000+ posts

Obscure - The brand-new, Turing-Complete, easy to use programming language

blubby4 wrote:

(#256)
It was originally supposed to be [code]set <value> as <variable>[/code] but it behaved like [code]set <variable> as <value>[/code] so it was changed to [code]set <variable> to <value>[/code]
Was there something wrong with fixing it to be just this?
set <value> as <variable>

Last edited by mybearworld (Sept. 10, 2024 04:32:54)

breakfast_for_dinner
Scratcher
1000+ posts

Obscure - The brand-new, Turing-Complete, easy to use programming language

as a judge who is judging these entries along with coffee, i just wanna say that this is NOT gonna be easy….
i_eat_coffee
Scratcher
1000+ posts

Obscure - The brand-new, Turing-Complete, easy to use programming language

breakfast_for_dinner wrote:

as a judge who is judging these entries along with coffee, i just wanna say that this is NOT gonna be easy….
tbh they are quite some interesting projects, never thought we'd achieve so many great stuff in such an obscure programming language
DifferentDance8
Scratcher
1000+ posts

Obscure - The brand-new, Turing-Complete, easy to use programming language

Currently working on porting Obscure to Python!

EDIT: I have decided to give up on porting it to Python, and instead decided to use Node.JS

Last edited by DifferentDance8 (Sept. 10, 2024 08:10:26)

i_eat_coffee
Scratcher
1000+ posts

Obscure - The brand-new, Turing-Complete, easy to use programming language

DifferentDance8 wrote:

Currently working on porting Obscure to Python!

EDIT: I have decided to give up on porting it to Python, and instead decided to use Node.JS
Obscure was originally written in Node.js lol, then it turned into a static website
endyourenite
Scratcher
100+ posts

Obscure - The brand-new, Turing-Complete, easy to use programming language

The_Creator_of-Me wrote:

hi
you should rather create a topic in the new scratchers forum instead of posting hi, that way, this topic does not derail.
endyourenite
Scratcher
100+ posts

Obscure - The brand-new, Turing-Complete, easy to use programming language

Wait who are the judges?

Powered by DjangoBB