This file contains 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
def pairs(participants) | |
pairs = participants.shuffle.each_slice(2).to_a | |
if pairs.last.size == 1 | |
loner = pairs.pop | |
pairs.last << loner.first | |
end | |
pairs | |
end |
This file contains 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
(dotimes [n (read-string (read-line))] | |
(let [x (read-string (read-line))] | |
(println | |
(format "%.4f" | |
(float (reduce (fn [m, i] (+ m (/ (reduce * (repeat i x)) | |
(reduce * (range 1 (inc i)))))) | |
(int 1) | |
(range 1 10))))))) |
This file contains 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
module Segment | |
module Tracking | |
@queue = :low | |
def self.perform(action, data) | |
data.symbolize_keys! | |
Analytics.send action, data | |
end | |
def identify(user = @user) |
This file contains 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
# Work in progress | |
STDOUT.sync = true | |
def log(text, obj) | |
STDERR.puts "#{text}: #{obj.to_s}" | |
end | |
def time | |
(Time.now - $start) * 1000 |
This file contains 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
# =============== # | |
# Unity generated # | |
# =============== # | |
[Ll]ibrary/ | |
[Tt]emp/ | |
[Oo]bj/ | |
UnityGenerated/ | |
# ================ # | |
# Editor Generated # |
This file contains 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
# This early version gets me through level 5 | |
# It's just a start... I'll add more later | |
class Player | |
def play_turn(w) | |
@warrior = w | |
perform_next_move | |
update_status | |
end | |
This file contains 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
class Lexun < RTanque::Bot::Brain | |
NAME = 'Lexun' | |
include RTanque::Bot::BrainHelper | |
Wall = Struct.new :name, :axis, :position, :opposite | |
def tick! | |
@tick = @tick.to_i.succ | |
setup if @tick == 1 |