I'm 21 years old and am writing my own computer language. I took the time of day to write you some documentation.
P.S. THANK YOU to the people from 43 different countries that have downloaded my language. It is so much better than a paycheck or a salary. I wish I could personally thank each of you for considering the language. I hope to make it as useful as possible with what time I have and hope you enjoy using it. Whether you are writing attack scripts or simple every day task scripts. Just enjoy the language. I made it for you.
If you have any questions/comments/suggestions, send me an e-mail at scstauf@gmail.com. I don't mind if you write in your own language. I will use Google Translate.
Back to the programming.
Here is an example of the new random function:
method gen_rand
@random = env.empty_string
for i in (1..256)
@c = random(a..z)
@random += @c
endfor
remove @c
return @random
end
@rand_str = gen_rand
say "Random String: \{@rand_str}"
Here is an object-oriented guessing game:
##
guessing_game.us
run with: usl -n guessing_game.us
##
object AI
public
method init
@&__AI_num = env.empty_number
end
method set(num)
self.init
@&__AI_num = $0
end
method genRand
@random = random(1..5)
return @random
end
method makeChoice
self.set(self.genRand)
end
method getChoice
return @&__AI_num
end
end
method getChoice
@c = "chomp.Your choice: "
return @c
end
method reset
delay 2
? @clearScreen
end
method setup
@choice = env.empty_number
@os = env.os
if @os = "UNIXMacorLinux"
@clearScreen = "clear"
else
@clearScreen = "cls"
endif
ai = AI
game
end
method game
for infinity
say "Pick a number between 1 and 5...0 to exit\]"
say "The computer is making its choice...\]"
ai.makeChoice
try
@choice = getChoice
catch
say "\]Leaving!"
leave!
caught
switch @choice
case 0
say "\]Leaving!"
leave!
default
@aiChoice = ai.getChoice
if @choice = @aiChoice
say "\]You guessed correctly!"
reset
else
say "\]You guessed incorrectly!"
say "\]Your choice:\[\{@choice}"
say "AI choice:\[\{@aiChoice}\]"
reset
endif
end
endfor
end
say "A Simple Guessing Game\]"
setup
# EOF
I've updated the MediaWiki and you can find it under the "Hosted Apps" tab at the sourceforge link below.To download 3.7.7, you can visit any of the following links:
sourceforge
freecode
No comments:
Post a Comment