Skip to content

Instantly share code, notes, and snippets.

##Brian Chesley, Connect 4
def run():
board = []
for i in range(0,6):
board.append([0]*7)
for row in board:
print row
turn = 1
p1_wins = False

Recursion day

Talk to other people - this didn't happen enough last week! Many people are already good at using recursion, and but would still learn something by working through problems with you. Consider describing your strategy before actually implementing it. Try doing this on a whiteboard.

Some resource to come back to later:

  • The little schemer - a mindbending intro to programming and recursion
  • SICP section 1.2 - you might need to read 1.1 to get up to speed
  • Add some more! Is there a MOOC you really like the recursion section of, or a textbook that gives it a nice treatment? Add it on Zulip and I'll add it here.
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <stdint.h>
#define MAX_CANDIDATES 25000
#define TWOTOTHE32 4294967296
int64_t random64bit(){
// we need 64 bits of random data
@thomasballinger
thomasballinger / dd.py
Created July 3, 2012 17:50 — forked from jasonLaster/dd.py
Dynamic Dispatch in Python
class FlexiDict(dict):
def get_gt(self, key):
return [v for k,v in d.iteritems() if k > key]
def __getattr__(self, name):
if name.startswith("find_"):
params = name.split("_")
if len(params) == 3:
def func():