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
class DataTable { | |
std::int64_t rows; | |
std::vector<std::string> names; | |
std::vector<std::pair<double, double>> locations; | |
std::string table_name; | |
public: | |
DataTable() { |
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 random | |
class Board: | |
_DIGITS = 4 | |
def __init__(self, height=4, width=4): | |
self.h = height | |
self.w = width |
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 math | |
import random | |
def recur(n, lst, chance): | |
if n == 1: | |
lst.append(1) | |
return | |
r = random.uniform(0, 1) | |
if r <= chance: | |
lst.append(n) |
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 math | |
import statistics | |
import random | |
import pyspiel | |
game = pyspiel.load_game("breakthrough") | |
trials = int(1e4) | |
white_wins = 0 | |
black_wins = 0 | |
lst = [] |
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 java.util.*; | |
public class Hello { | |
public static void main(String[] args) { | |
Random rand = new Random(); | |
int tries = 1; | |
int num = rand.nextInt(99) + 1; | |
Scanner sc = new Scanner(System.in); | |
System.out.println("Guess a number between 1 and 100"); | |
int plr = Integer.parseInt(sc.nextLine()); |
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
# Frogs problem on TED | |
import random | |
def run(): | |
bothFrogs = 0 | |
oneFrog = 0 | |
# Doing 100000 trials, bothfrogs probability printed top, one below |
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
# Monty hall problem | |
import random | |
def run(): | |
stay = 0 | |
dif = 0 | |
for i in range(100000): | |
# doing different door | |
car = random.randint(0, 2) |