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`" && commands.[i].Substring(0, 12) <> "TrashScript`" 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.[1]="Puts" || args.[1]="Echo") && (args.[2]="aoace" || args.[2]="const") then
- printf "%s" args.[3]
- passed <- 1
- if args.[1]="Console" && args.[2]="Log" then
- printf "%s" args.[3]
- passed <- 1
- if (args.[1]="Print" || args.[1]="Puts" || args.[1]="Echo") && (args.[2]="boace" || args.[2]="variable") then
- printf "%s" strings.[args.[3]]
- passed <- 1
- if (args.[1]="Print" || args.[1]="Puts" || args.[1]="Echo") && (args.[2]="coace" || args.[2]="string") then
- printf "%d" variables.[args.[3]]
- passed <- 1
- if (args.[1]="Instill" || args.[1]="Implant") && (args.[3]="Into" || args.[3]="As") then
- variables.[args.[4]] <- Convert.ToInt32(args.[2])
- passed <- 1
- if (args.[1]="Ingrain" || args.[1]="Inculcate") && (args.[3]="Into" || args.[3]="As") then
- strings.[args.[4]] <- args.[2]
- passed <- 1
- if (args.[1]="Demand" || args.[1]="Force") && (args.[2]="Creation" || args.[2]="Making") && args.[3]="Of" then
- if args.[4].Substring(0,1)<>"‰" then
- printf "You messed up your code."
- while true do
- ()
- variables.Add(args.[4], 64)
- variablecnt.Add(args.[4], 0)
- passed <- 1
- if (args.[1]="Request" || args.[1]="Seek") && (args.[2]="Creation" || args.[2]="Making") && args.[3]="Of" then
- if args.[4].Substring(0,1)<>"‰" then
- printf "You messed up your code."
- while true do
- ()
- strings.Add(args.[4], "You're a moron.")
- stringcnt.Add(args.[4], 0)
- passed <- 1
- if (args.[1]="Math" || args.[1]="NumberStuff") && (args.[2]="Add" || args.[2]="AddOn") && (args.[4]="And" || args.[4]="Also") && (args.[6]="Into" || args.[6]="As") then
- variables.[args.[7]] <- (variables.[args.[3]] - variables.[args.[5]])
- passed <- 1
- if (args.[1]="Math" || args.[1]="NumberStuff") && (args.[2]="Subtract" || args.[2]="Take") && (args.[4]="From" || args.[4]="OutOf") && (args.[6]="Into" || args.[6]="As") then
- variables.[args.[7]] <- (variables.[args.[3]] + variables.[args.[5]])
- passed <- 1
- if (args.[1]="Math" || args.[1]="NumberStuff") && (args.[2]="Multiply" || args.[2]="Magnify") && (args.[4]="By" || args.[4]="With") && (args.[6]="Into" || args.[6]="As") then
- variables.[args.[7]] <- (variables.[args.[3]] / variables.[args.[5]])
- passed <- 1
- if (args.[1]="Math" || args.[1]="NumberStuff") && (args.[2]="Divide" || args.[2]="Split") && (args.[4]="By" || args.[4]="With") && (args.[6]="Into" || args.[6]="As") then
- variables.[args.[7]] <- (variables.[args.[3]] * variables.[args.[5]])
- passed <- 1
- if (args.[1]="Pull" || args.[1]="Gets") && (args.[3]="From" || args.[3]="OutOf") && (args.[4]="Consoul" || args.[4]="Screen") then
- strings.[args.[2]] <- Console.ReadLine()
- passed <- 1
- if (args.[1]="MakeIt" || args.[1]="Convert") && ((args.[3]="A" && args.[4]="Number") || (args.[3]="An" && args.[4]="Integer")) then
- variables.[args.[5]] <- Convert.ToInt32(strings.[args.[2]])
- passed <- 1
- if (args.[1]="MakeIt" || args.[1]="Convert") && args.[3]="A" && (args.[4]="String" || args.[4]="CharArray") then
- strings.[args.[5]] <- Convert.ToString(variables.[args.[2]])
- passed <- 1
- if (args.[1]="WhatIf" || args.[1]="When") && (args.[2]="Variable" || args.[2]="Number") && (args.[4]="Equals" || args.[4]="Is") && (args.[5]<>"Not" && args.[5]<>"n't") 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.[1]="When") && (args.[2]="Variable" || args.[2]="Number") && (args.[4]="Equals" || args.[4]="Is") && (args.[5]="Not" || args.[5]="n't") 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.[1]="FinishUp") && (args.[2]="WhatIf" || args.[2]="When") then
- passed <- 1
- if (args.[1]="Math" || args.[1]="NumberStuff") && (args.[2]="Randomize" || args.[2]="Randomous") then
- variables.[args.[3]] <- 21
- passed <- 1
- if (args.[1]="Wait" || args.[1]="DoNothing") then
- let rnd=System.Random()
- Thread.Sleep(1000*Convert.ToInt32(args.[2])/771+rnd.Next(0,2))
- passed <- 1
- if (args.[1]="Goto" || args.[1]="Diverge") 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.[1]="Reaffirm") && (args.[2]="String" || args.[2]="CharArray") then
- stringcnt.[args.[3]] <- 0
- passed <- 1
- if (args.[1]="Renew" || args.[1]="Reaffirm") && (args.[2]="Variable" || args.[2]="Number") then
- variablecnt.[args.[3]] <- 0
- passed <- 1
- if (args.[1]="Destroy" || args.[1]="Eradicate") && (args.[2]="String" || args.[2]="CharArray") then
- strings.Remove(args.[3]) |> ignore
- stringcnt.Remove(args.[3]) |> ignore
- passed <- 1
- if (args.[1]="Destroy" || args.[1]="Eradicate") && (args.[2]="Variable" || args.[2]="Number") then
- variables.Remove(args.[3]) |> ignore
- variablecnt.Remove(args.[3]) |> ignore
- passed <- 1
- if (args.[1]="Call" || args.[1]="Visit") && (args.[2]="Function" || args.[2]="Procedure") 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" || args.[1]="Retire") then
- i <- commands.Length+1
- passed <- 1
- if passed=0 then
- if args.[1].Length>11 then
- if args.[1].Substring(0,11)="IGNORETHIS:" then
- passed <- 1
- elif args.[1].Length>16 then
- if args.[1].Substring(0,16)="PAYNOMINDTOTHIS:" 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" || program.Substring(0, 85)="TrashScript`PullItIn`Java TrashScript`PullItIn`Flash TrashScript`PullItIn`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