Skip to content

Instantly share code, notes, and snippets.

# Description: Tic Tac Toe game implementation written in Ruby.
# The minmax algorithm is used to provide the AI.
class State
def initialize
@board = [[0,0,0],[0,0,0],[0,0,0]]
end
def is_empty(row, column)
if (@board[row][column] == 0)
@cagedmantis
cagedmantis / gist:853698
Created March 3, 2011 21:56
Simple Calculator implementation employing a branch table
public interface Calculator {
int calculate(int valueA, int valueB);
}
public class Subtract implements Calculator {
public int calculate(int valueA, int valueB) {
return valueA - valueB;
}
#!/usr/bin/env python
# -*- mode: python; tab-width: 4 -*-
# -*- coding: utf-8 -*-
#
import random
for x in range(100):
giants = []
while len(giants) < 10:
/**
* @author Carlos Amedee <carlos.amedee@gmail.com>
*
* @brief
*
*
*/
#include <iostream>
#include <algorithm>
struct foo
{
int moo;
char c[];
};
struct bar
{
int moo;
### Keybase proof
I hereby claim:
* I am cagedmantis on github.
* I am exobit (https://keybase.io/exobit) on keybase.
* I have a public key whose fingerprint is 2F97 7A2E 0D3F 0DB1 4D9F E016 DCB3 BA31 9774 34B6
To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am cagedmantis on github.
  • I am exobit (https://keybase.io/exobit) on keybase.
  • I have a public key whose fingerprint is 2F97 7A2E 0D3F 0DB1 4D9F E016 DCB3 BA31 9774 34B6

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am cagedmantis on github.
  • I am exobit (https://keybase.io/exobit) on keybase.
  • I have a public key whose fingerprint is ACD7 B92F 31D5 FC5F B518 7753 FBA6 692D D38D 8F23

To claim this, I am signing this object:

#include <iostream>
#include <vector>
#include <queue>
template<class T>
void merge(std::vector<T> &vec, int low, int mid, int high)
{
int index = low;
std::queue<T> left;
std::queue<T> right;
resource "null_resource" "init_serf" {
count = "${var.num_nodes}"
depends_on = [ "digitalocean_droplet.serf" ]
provisioner "remote-exec" {
connection {
user = "root"
}