Last active
May 13, 2019 22:11
-
-
Save edwardkenfox/cd59e4fe11c2aeb4c814111670c87668 to your computer and use it in GitHub Desktop.
Google I/O お土産抽選
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| winners = [] | |
| entries = { | |
| "tshirt-1" => ["yumiko", "kurokawa", "ykawamura", "sato", "naoki", "nakahira", "takehiroxy", "hyeji", "nakahama", "tenshotanaka", "kengoiwt", "joker1007", "yuji"], | |
| "tshirt-2" => ["yumiko", "kurokawa", "ykawamura", "sato", "naoki", "nakahira", "takehiroxy", "hyeji", "nakahama", "tenshotanaka", "kengoiwt", "joker1007", "yuji"], | |
| "bag" => ["yumiko", "kurokawa", "hiratama", "naoki", "AtsushiHanyu", "nakahira", "taison", "mizuho", "satsukiy"], | |
| "sunglasses" => ["yumiko", "tsubasa_sasaki", "kurokawa", "naoki", "hyeji"], | |
| "water bottle" => ["yumiko", "Kasumi Inoue", "ykawamura", "hiratama", "naoki", "hyeji", "kengoiwt", "senohirona"], | |
| } | |
| entries.each do |k, v| | |
| while winner = v.delete_at(rand(v.length)) | |
| break if !winners.include?(winner) | |
| end | |
| winners.push(winner) | |
| puts "Congrats! @#{winner} won the #{k}." | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| winners = [] | |
| entries = { | |
| "tshirt-1" => ["Toumei", "satsukiy", "kurokawa", "yumiko", "Hiroto", "Ishitoko", "yuki kikuchi"], | |
| "tshirt-2" => ["katsyoshi", "yuji", "sho", "Hiroto", "RyomaShindo", "haruki", "ohno", "toriumin"], | |
| "handkerchief" => ["yumiko", "nakahama"], | |
| "bag" => ["azeyanagi", "yayoi", "hiromitsu_ooka", "yuki inori"] | |
| } | |
| entries.each do |goodie, candidates| | |
| while winner = candidates.delete_at(rand(candidates.length)) | |
| break if !winners.include?(winner) | |
| end | |
| winners.push(winner) | |
| puts "Congrats! @#{winner} won '#{goodie}'!!" | |
| end |
edwardkenfox
commented
May 14, 2018
Author
Author
Congrats! @kurokawa won 'tshirt-1'!!
Congrats! @Hiroto won 'tshirt-2'!!
Congrats! @nakahama won 'handkerchief'!!
Congrats! @azeyanagi won 'bag'!!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment