Skip to content

Instantly share code, notes, and snippets.

/**
* @author Carlos Amedee <carlos.amedee@gmail.com>
*
* @brief
*
*
*/
#include <iostream>
#include <algorithm>
#!/usr/bin/env python
# -*- mode: python; tab-width: 4 -*-
# -*- coding: utf-8 -*-
#
import random
for x in range(100):
giants = []
while len(giants) < 10:
@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;
}
# 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)