@anonymous/

FussyDarkseagreenCricket

Ruby

No description

fork
loading
Files
  • main.rb

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.6326174258867197","path":"main.rb","file":{"path":"main.rb","content":{"asEncoding":{"base64":"IyEvdXNyL2xvY2FsL2Jpbi9ydWJ5Cgp0YWwgPSByYW5kKDEwMDAwKQphbnRhbF9naXNzbmluZ2FyID0gMApwdXRzICJHaXNzYSB2aWxrZXQgdGFsIGphZyB0w6Rua2VyIHDDpT8iCgpsb29wIGRvCiAgZ2lzc25pbmcgPSBnZXRzLnRvX2kKICBpZiB0YWwgPCBnaXNzbmluZyB0aGVuCiAgICBwdXRzICJOZWosIGRldCDDpHIgbWluZHJlLiBHaXNzYSBpZ2VuIC4uLiIKICBlbHNpZiB0YWwgPiBnaXNzbmluZyB0aGVuCiAgICBwdXRzICJOZWosIGRldCDDpHIgc3TDtnJyZS4gR2lzc2EgaWdlbiAuLi4iCiAgZW5kCiAgYW50YWxfZ2lzc25pbmdhciArPSAxCiAgYnJlYWsgaWYgdGFsID09IGdpc3NuaW5nCmVuZAoKcHV0cyAiUsOkdHQgbWVkIGJhcmEgI3thbnRhbF9naXNzbmluZ2FyfSBnaXNzbmluZ2FyIgo="},"asBuffer":null},"loaded":true}}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/local/bin/ruby

tal = rand(10000)
antal_gissningar = 0
puts "Gissa vilket tal jag tänker på?"

loop do
  gissning = gets.to_i
  if tal < gissning then
    puts "Nej, det är mindre. Gissa igen ..."
  elsif tal > gissning then
    puts "Nej, det är större. Gissa igen ..."
  end
  antal_gissningar += 1
  break if tal == gissning
end

puts "Rätt med bara #{antal_gissningar} gissningar"
ruby 2.5.5p157 (2019-03-15 revision 67260) [x86_64-linux]