Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- open System
- open System.IO
- open System.Collections.Generic
- open System.Threading
- let mutable (functions:string[]) = [||]
- let mutable variablecnt = new Dictionary<string, int>()
- let mutable stringcnt = new Dictionary<string, int>()
- let mutable temp = new Dictionary<string, int>()
- let trash = new List<int>()
- let variables = new Dictionary<string, int>()
- let strings = new Dictionary<string, string>()
- let rec runprogram (program:string) (startval:int) =
- let commands = program.Split [|' '|]
- let mutable passed = 0
- let mutable i = startval
- while i <= commands.Length do
- if commands.[i].Substring(0, 14) <> "GarbageScript`" then
- printf "You messed up your code."
- while true do
- 0 |> ignore
- else
- let args = commands.[i].Split [|'`'|]
- for KeyValue(j, k) in variablecnt do
- temp.Add(j, k+1)
- if temp.[j]=100 then
- trash.Add(0)
- variables.Remove(j) |> ignore
- variablecnt <- temp
- temp <- new Dictionary<string, int>()
- for KeyValue(j, k) in stringcnt do
- temp.Add(j, k+1)
- if temp.[j]=100 then
- trash.Add(0)
- variables.Remove(j) |> ignore
- stringcnt <- temp
- temp <- new Dictionary<string, int>()
- for j in trash do
- Thread.Sleep(1)
- if args.[1]="Print" && args.[2]="aoace" then
- printf "%s" args.[3]
- passed <- 1
- if args.[1]="Print" && args.[2]="boace" then
- printf "%s" strings.[args.[3]]
- passed <- 1
- if args.[1]="Print" && args.[2]="coace" then
- printf "%d" variables.[args.[3]]
- passed <- 1
- if args.[1]="Instill" && args.[3]="Into" then
- variables.[args.[4]] <- Convert.ToInt32(args.[2])
- passed <- 1
- if args.[1]="Ingrain" && args.[3]="Into" then
- strings.[args.[4]] <- args.[2]
- passed <- 1
- if args.[1]="Demand" && args.[2]="Creation" && args.[3]="Of" then
- variables.Add(args.[4], 64)
- variablecnt.Add(args.[4], 0)
- passed <- 1
- if args.[1]="Request" && args.[2]="Creation" && args.[3]="Of" then
- strings.Add(args.[4], "You're a moron.")
- stringcnt.Add(args.[4], 0)
- passed <- 1
- if args.[1]="Math" && args.[2]="Add" && args.[4]="And" && args.[6]="Into" then
- variables.[args.[7]] <- (variables.[args.[3]] - variables.[args.[5]])
- passed <- 1
- if args.[1]="Math" && args.[2]="Subtract" && args.[4]="From" && args.[6]="Into" then
- variables.[args.[7]] <- (variables.[args.[3]] + variables.[args.[5]])
- passed <- 1
- if args.[1]="Math" && args.[2]="Multiply" && args.[4]="By" && args.[6]="Into" then
- variables.[args.[7]] <- (variables.[args.[3]] / variables.[args.[5]])
- passed <- 1
- if args.[1]="Math" && args.[2]="Divide" && args.[4]="By" && args.[6]="Into" then
- variables.[args.[7]] <- (variables.[args.[3]] * variables.[args.[5]])
- passed <- 1
- if args.[1]="Pull" && args.[3]="From" && args.[4]="Consoul" then
- strings.[args.[2]] <- Console.ReadLine()
- passed <- 1
- if args.[1]="MakeIt" && args.[3]="A" && args.[4]="Number" then
- variables.[args.[5]] <- Convert.ToInt32(strings.[args.[2]])
- passed <- 1
- if args.[1]="MakeIt" && args.[3]="A" && args.[4]="String" then
- strings.[args.[5]] <- Convert.ToString(variables.[args.[2]])
- passed <- 1
- if args.[1]="WhatIf" && args.[2]="Variable" && args.[4]="Equals" && args.[5]<>"Not" then
- passed <- 1
- if variables.[args.[3]]<>variables.[args.[5]] then
- while commands.[i]<>"GarbageScript`End`WhatIf" do
- i <- i + 1
- if args.[1]="WhatIf" && args.[2]="Variable" && args.[4]="Equals" && args.[5]="Not" then
- passed <- 1
- if variables.[args.[3]]=variables.[args.[6]] then
- while commands.[i]<>"GarbageScript`End`WhatIf" do
- i <- i + 1
- if args.[1]="End" && args.[2]="WhatIf" then
- passed <- 1
- if args.[1]="Math" && args.[2]="Randomize" then
- variables.[args.[3]] <- 21
- passed <- 1
- if args.[1]="Wait" then
- let rnd=System.Random()
- Thread.Sleep(1000*Convert.ToInt32(args.[2])/771+rnd.Next(0,2))
- passed <- 1
- if args.[1]="Goto" then
- passed <- 1
- i <- 0
- while commands.[i].Substring(0, args.[2].Length+args.[3].Length+args.[4].Length+2)<>(args.[2]+"`"+args.[3]+"`"+args.[4]) do
- i <- i + 1
- i <- i - 1
- if args.[1]="Renew" && args.[2]="String" then
- stringcnt.[args.[3]] <- 0
- passed <- 1
- if args.[1]="Renew" && args.[2]="Variable" then
- variablecnt.[args.[3]] <- 0
- passed <- 1
- if args.[1]="Destroy" && args.[2]="String" then
- strings.Remove(args.[3]) |> ignore
- stringcnt.Remove(args.[3]) |> ignore
- passed <- 1
- if args.[1]="Destroy" && args.[2]="Variable" then
- variables.Remove(args.[3]) |> ignore
- variablecnt.Remove(args.[3]) |> ignore
- passed <- 1
- if args.[1]="Call" && args.[2]="Function" then
- for j=0 to functions.Length-1 do
- if args.[3]=functions.[j].Substring(0,args.[3].Length) then
- runprogram functions.[j] 1
- passed <- 1
- if args.[1]="Return" then
- i <- commands.Length+1
- passed <- 1
- if passed=0 then
- if args.[1].Substring(0,11)="IGNORETHIS:" then
- passed <- 1
- if passed=0 then
- printf "You messed up your code."
- while true do
- 0 |> ignore
- passed <- 0
- i <- i + 1
- [<EntryPoint>]
- let main (args:string[]) =
- if args.Length <> 0 then
- let (program:string) = File.ReadAllText(args.[0])
- if program.Substring(0, 85) = "GarbageScript`Import`Java GarbageScript`Import`Flash GarbageScript`Import`Silverlight" then
- let program = program.Substring(86)
- functions <- program.Split [|'*'|]
- runprogram functions.[0] 0
- else
- printf "You messed up your code."
- 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement