Interesting Challenges!

  • I would love for some challenges to be posted down below! Any Scripting, Lua, or Programming challenges would be great!

    If you have multiple, maybe list them from easiest to hardest.

    Thanks! I'm looking forwards to neat suggestions for challenges!

  • This post is deleted!

  • This post is deleted!

  • This post is deleted!
  • Global Moderator

    Here's two challenges:

    Can you write a script that will take a string and make sure that there is a proper number and order of parenthesis and brackets?



    • ()
    • (())
    • ()()


    • (
    • )
    • (()
    • ())(

    A little harder, can you write a script that will take a string and ensure there's a proper number of end statements?


    • if true then end
    • if false then end
    • function blue() print("blue") end


    • if true then
    • if false then
    • if x >= 5 then if y < 3 then print("true") end

    I wish I could format code properly here.

  • Here's my challenge:

    Try & create a script so that when a player joins, a pre-set map will spawn; however, you can't clone the entire model & put it in the workspace: you have to create a pre-existing Model object, then copy the parts into the model, but the parts fade into existence, one at a time.

  • @OldPalHappy Make a parser. I'm currently making one for my programming language, "ZenLua" or Zen. It's a fully fledged compiler and parser.

    But let's take a look at parsing:

    If you want to understand what the line of code
    x = 10+49 does, you need to parse it

    So try something like this:

    Find a prefix, an operator, then a suffix, which together form a magmatical equation. Now full parsers are much more complicated, but if you can figure out how to make a simple parser, kudos to you, as it's not that simple of a task.

    I've always loved this stuff.

    PS I'm on mobile so sorry for any errors

    EDIT: Feel free to contact me if you want any information / help (and no means to advertise but if any of you would like to hear when ZenLua is done, and see its code, follow me @craftsmashbuild on twitter!)

    Currently my parser works by taking a statement like
    {NUMBER(LENMAX=10),OPERATOR.ANY,NUMBER(LENMAX=10)}, and will return true if the match succeeds, and return a table with the answers, so using that key and the text 13+401 will return the table {true,{13,"+",401}}

    Then all I need to do is go
    (this is pseudo code)

    if (parsedcode[1] == true) then
        return parsedcode[1] + parsedcode[2]; 

    now this example was brief and Its assuming that the operator is +, but hopefully its obvious how useful parsers are. Just imagine this but much more complicated, thats how you make a programming language :)

    peg.js is an excellent example of how parsers work

    Good luck!

Log in to reply

Looks like your connection to Scripting Helpers was lost, please wait while we try to reconnect.