Initial set of scripts

This commit is contained in:
2015-08-08 21:04:55 -07:00
parent 362f74cd7e
commit 4f119844fd
21 changed files with 577 additions and 0 deletions

7
Julia Scripts/100doors.jl Executable file
View File

@@ -0,0 +1,7 @@
doors = falses(100)
for a = 1:100, b in a:a:100
doors[b] = !doors[b]
end
for a = 1:100
println("Door $a is " * (doors[a] ? "open" : "close"))
end

9
Julia Scripts/hello.jl Executable file
View File

@@ -0,0 +1,9 @@
#!/usr/bin/julia
function gayness()
println("Loser")
end
gayness()

42
Julia Scripts/high-low.jl Executable file
View File

@@ -0,0 +1,42 @@
#!/usr/bin/julia
die1=rand(1:100)
function input(prompt::String="")
print(prompt)
chomp(readline())
end
while true
choice = input("Guess a number 1-100: " )
if Base.isdigit(choice)
choice = parseint(choice)
else
println("$choice, is not a positive number")
continue
end
if choice < 101
if choice == die1
println("You win!")
return false
elseif choice > die1
println("Too high!")
elseif choice < die1
println("Too low!")
end
else
println(choice, " is greater than 100!")
end
end

31
Julia Scripts/putitoff.jl Executable file
View File

@@ -0,0 +1,31 @@
#!/usr/bin/julia
function input(prompt::String="")
print(prompt)
chomp(readline())
end
function main()
list = {}
while true
date = input("Type date: ");
addItem = input("Add an item: ")
together = "$addItem-$date"
push!(list,together)
println(list)
end
end
main()