This file contains hidden or 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
from sympy import Matrix | |
Q = [[-2, 1, 1],[3, -5, 2], [1, 1, -2]] | |
M = Matrix(Q) | |
pi = M.transpose().nullspace()[0] | |
pi = list(pi / sum(pi)) | |
print pi |
This file contains hidden or 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
from __future__ import division | |
import matplotlib.pyplot as plt | |
import matplotlib.gridspec as gridspec | |
import random | |
import math | |
import tqdm | |
def lognormal_cdf(x, m, s): | |
x1 = x[0] | |
x2 = x[1] |
This file contains hidden or 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
""" | |
Code and go | |
""" | |
import random | |
import math | |
import ciw | |
ciw = False |
This file contains hidden or 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 Pet: | |
noise = "" | |
def make_noise(self): | |
return self.noise | |
class Dog(Pet): | |
noise = "Woof" | |
class Cat(Pet): | |
noise = "Meow" |
This file contains hidden or 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
\documentclass{article} | |
\usepackage{hyperref} | |
\begin{document} | |
If you're awesome you should use \cite{hypothesisx.y}. | |
\bibliographystyle{plain} | |
\bibliography{demo.bib} |
This file contains hidden or 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
import axelrod as axl | |
players = [axl.Cooperator(), axl.Defector(), axl.TitForTat(), | |
axl.PSOGambler(), axl.BackStabber(), axl.ThueMorse()] | |
tournament = axl.Tournament(players, processes=2) | |
results = tournament.play() | |
print(results.ranked_names) |
This file contains hidden or 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
from collections import Counter | |
responses = ['E', 'B', 'C', 'E', 'E', 'B', 'A'] | |
counts = Counter(responses) | |
# Print all of the counter object: | |
print counts | |
# Iterate through everything in counts and print them (a Counter acts like a | |
# dictionary). |
This file contains hidden or 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
import json | |
import time | |
from multiprocess import Process, Queue | |
import axelrod as axl | |
def match_generator(players, turns=100, repetitions=1000): | |
for rep in range(repetitions): | |
for player1 in players: |
This file contains hidden or 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
import axelrod as axl | |
import random | |
from sys import argv | |
random.seed(1) | |
if len(argv) == 1: | |
processes = None | |
else: | |
processes = 2 |
This file contains hidden or 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
import doctest | |
import os | |
import unittest | |
def load_tests(loader, tests, ignore): | |
for root, dirs, files in os.walk("./docs"): | |
for f in files: | |
if f.endswith(".rst"): | |
tests.addTests( |