Skip to content

Instantly share code, notes, and snippets.

@Tempate
Tempate / animation.py
Last active September 23, 2023 09:35
from math import *
import random
import bpy
N_FLAPS = 30
N_SHAFTS = 42
SHAFTS = ["Circle.{:03d}".format(i) for i in range(N_SHAFTS)]
# -*- 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
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)
#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;
# 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"],
[],
$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
]
@Tempate
Tempate / bocabajo.c
Last active November 28, 2020 23:02
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "auxiliar.h"
#define LINE_LENGTH 2049
void process_contents(FILE* file);
from sympy import *
import numpy as np
u = Symbol('u')
v = Symbol('v')
t = Symbol('t')
a = Symbol('a')
b = Symbol('b')
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],
;;;; 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 ()