Notes
Notes - notes.io |
#definitions
difficulty = 10
endGame = false
timeLimit = 10.0
points = 0
#end of definitions
p "START"
while endGame == false
a = getRandom(difficulty/5)
(0...a.length-1).each do |b|
if a[b] > -1 and b != 0
print "+"
print a[b]
print " "
else
print a[b]
print " "
end
end
puts
start = Time.now
number = gets.chomp.to_i
finish = Time.now
answerTime = finish-start
puts answerTime.round
if number == a[-1] and answerTime <= timeLimit
points += ((difficulty/5)-1)*(timeLimit-answerTime)
difficulty += 1
puts "+++"
print "points "
puts points
print " timeLimit "
puts timeLimit
timeLimit -= 0.3
elsif number == a[-1] and answerTime > timeLimit
puts "LOST ON TIME!"
print "points "
print points.round
print " timeLimit "
puts timeLimit
endGame = true
elsif number != a[-1] and answerTime <= timeLimit
if difficulty > 12
difficulty -= 3
puts "---"
if points <= 10
points -= 10
end
else
puts "LOST!"
print "points "
print " timeLimit "
puts timeLimit
print points.round
print " timeLimit "
print timeLimit
endGame = true
end
end
end
end
def getRandom(n)
sum = 0
a = []
(0...n).each do |b|
a << rand(-9..9)
sum+=a[b]
end
(0...a.length).each do |b|
if sum > 9 and a[b] > 0
a[b] -= 2*a[b]
sum += 2*a[b]
elsif sum < -9 and a[b] < 0
a[b] -= 2*a[b]
sum += 2*a[b]
end
end
(0...a.length).each do |b|
if sum < 0
a[b] -= 2*a[b]
end
end
sum = 0
(0...a.length).each do |b|
sum+=a[b]
end
a << sum
return a
end
game
|
Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 12 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team