Skip to content

Instantly share code, notes, and snippets.

View zachpendleton's full-sized avatar

Zach Pendleton zachpendleton

View GitHub Profile

Keybase proof

I hereby claim:

  • I am zachpendleton on github.
  • I am zachpendleton (https://keybase.io/zachpendleton) on keybase.
  • I have a public key ASD-WNN8v9RQyQvfET9SF8Bp3anZGOAxAs14k__VXrFycwo

To claim this, I am signing this object:

FROM mhart/alpine-node:4.4.7
COPY ./myBot.js /bot.js
CMD node /bot.js
FROM java:8-jre-alpine
COPY ./my-bot.jar /bot.jar
CMD java -jar /bot.jar
FROM ruby:2.3-alpine
COPY ./my_bot.rb /bot.rb
CMD ruby /bot.rb
process.stdin.setEncoding("UTF-8");
process.stdin.on("data", function(data) {
var gameState = JSON.parse(data);
if (gameState["winner"]) return;
var rowCount = gameState['board'].length;
var columnCount = gameState['board'][0].length;
process.stdout.write(Math.floor(Math.random() * columnCount).toString() + "\n");
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.*;
class ConnectFourBot {
private static final ObjectMapper mapper = new ObjectMapper();
public static void main(String[] args) {
new ConnectFourBot().play();
}
require "json"
$stdin.sync = true
$stdout.sync = true
loop do
game_state = JSON.parse(gets)
row_height = game_state["board"].length
column_width = game_state["board"][0].length
class Widget
class << self
protected
def define_attribute(name)
attr_accessor name
end
end
define_attribute :name
Node = Struct.new(:value, :left, :right)
class KDTree
attr_reader :root
# points - an array of arrays containing x,y coordinates (e.g. [[1,1], [5,1]])
def initialize(points)
@root = init_tree(points.clone)
end
module Foo
class Bar
def speak; "Hello, world!"; end
end
end
module Foo
class Baz
# this works
def speak; Bar.new.speak; end