Tuesday, October 18, 2011

USL 3.7.7

This release changes the old random function, fixes the return bug, and adds empty_string & empty_number as USL-specific environment variables. The old random function was very awkward but the new random function conforms to the recently introduced ranges of USL. I have also written a usl-doc for all of those people saying things like: "Is there ANY documentation on this AT ALL?!?!"

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

       remove @c
       return @random

@rand_str = gen_rand

say "Random String: \{@rand_str}"
Here is an object-oriented guessing game:

run with: usl -n guessing_game.us

object AI
              method init
                     @&__AI_num = env.empty_number

              method set(num)
                     @&__AI_num = $0

              method genRand
                     @random = random(1..5)

                     return @random

              method makeChoice

              method getChoice
                     return @&__AI_num

method getChoice
       @c = "chomp.Your choice: "

       return @c

method reset
       delay 2

       ? @clearScreen

method setup
       @choice = env.empty_number
       @os = env.os

       if @os = "UNIXMacorLinux"
              @clearScreen = "clear"
              @clearScreen = "cls"

       ai = AI


method game
       for infinity
              say "Pick a number between 1 and 5...0 to exit\]"
              say "The computer is making its choice...\]"

                     @choice = getChoice
                     say "\]Leaving!"

              switch @choice
                     case 0
                            say "\]Leaving!"
                            @aiChoice = ai.getChoice

                            if @choice = @aiChoice
                                   say "\]You guessed correctly!"

                                   say "\]You guessed incorrectly!"
                                   say "\]Your choice:\[\{@choice}"
                                   say "AI choice:\[\{@aiChoice}\]"


say "A Simple Guessing Game\]"


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:

No comments:

Post a Comment