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
#!/usr/bin/env python | |
import numpy as np | |
# from github.com/int8/monte-carlo-tree-search.git | |
from mctspy.tree.nodes import TwoPlayersGameMonteCarloTreeSearchNode | |
from mctspy.tree.search import MonteCarloTreeSearch | |
from mctspy.games.examples.tictactoe import TicTacToeGameState, TicTacToeMove | |
initial_board = np.zeros((3,3)) |
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
#!/usr/bin/env python | |
from enum import IntEnum | |
import math | |
import random | |
import logging | |
logging.basicConfig(level=logging.INFO) | |
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
version: "3" | |
services: | |
roach0: | |
image: cockroachdb/cockroach | |
container_name: roach0 | |
command: start --logtostderr --insecure | |
ports: | |
- "26257:26257" | |
- "8080:8080" | |
networks: |
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
#!/usr/bin/env python | |
# Inspired by: https://www.youtube.com/watch?v=Oq2E2yGadnU | |
# What i did was moving the first index to 0. | |
class SegmentTree(object): | |
def __init__(self, data): | |
n = len(data) | |
self.offset = n - 1 | |
self.nodes = [0 for _ in range(n * 2 - 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
#!/usr/bin/env python | |
import sys | |
# RBT != 仙踪林 | |
# https://en.wikipedia.org/wiki/Red%E2%80%93black_tree | |
class RBNode(object): | |
def __init__(self, val, is_red=False, left=None, right=None, parent=None): | |
self.val = val |