This file contains 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 math import * | |
import random | |
import bpy | |
N_FLAPS = 30 | |
N_SHAFTS = 42 | |
SHAFTS = ["Circle.{:03d}".format(i) for i in range(N_SHAFTS)] |
This file contains 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
# -*- coding: utf-8 -*- | |
from zipfile import ZipFile | |
from numpy.linalg import norm | |
import numpy as np | |
import regex as re | |
import requests | |
import pickle | |
import time |
This file contains 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
def throw_die(count, sides) | |
# Throw die randomly and add them up | |
count.times.sum{ rand(1..sides) } | |
end | |
def simulate(m, n, sides) | |
k = 100000 | |
wins = k.times.count{ | |
throw_die(m, sides) > throw_die(n, sides) |
This file contains 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
#include <iostream> | |
#include <vector> | |
std::vector<int> search(std::string text, std::string pattern); | |
std::vector<int> generate_table(std::string pattern); | |
int main() { | |
std::string text; |
This file contains 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
# The current algorithm uses a brute-force approach | |
NUMBER_OF_GAMES = 20000 | |
# When pendatic mode is not activated, we assume that the cards in a | |
# hand you haven't specified are different from the ones you have. | |
PEDANTIC = false | |
$hands = [ | |
["K", "Q"], | |
[], |
This file contains 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
$bets = [ | |
[0, 1], # Lost and drawn | |
[2.06], # Won | |
[2.04, 1], # Won and drawn | |
[1], # Drawn | |
[1.95, 1], # Won and drawn | |
[1.81] # Won | |
] | |
This file contains 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
#include <stdlib.h> | |
#include <stdio.h> | |
#include <string.h> | |
#include "auxiliar.h" | |
#define LINE_LENGTH 2049 | |
void process_contents(FILE* file); |
This file contains 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 * | |
import numpy as np | |
u = Symbol('u') | |
v = Symbol('v') | |
t = Symbol('t') | |
a = Symbol('a') | |
b = Symbol('b') |
This file contains 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 numpy as np | |
import math | |
K = 7 | |
data = [ | |
[np.array([1, 1, 1, 1]), 1], | |
[np.array([2, 2, 2, 2]), 0], | |
[np.array([3, 3, 3, 3]), 0], | |
[np.array([4, 4, 4, 4]), 1], |
This file contains 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
;;;; Black Jack | |
(defclass deck () | |
((card-count :initarg :card-count :initform 0 :reader deck-count) | |
(cards :initarg :cards :initform '() :reader deck-cards))) | |
(defclass hand () | |
((cards :initarg :cards :initform '() :reader hand-cards))) | |
(defclass card () |