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 defaultdict, Counter | |
| import csv | |
| def loadnums(filename): | |
| nums = [] | |
| with open(filename) as csvfile: | |
| reader = csv.reader(csvfile, delimiter=':') | |
| for r in reader: | |
| nums.extend([int(i) for i in r]) | |
| return nums |
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
| #include "M5Atom.h" | |
| #include <FastLED.h> | |
| #define NUM_LEDS 140 // Number of LEDs in your strip | |
| #define DATA_PIN 25 // Data pin connected to your LED strip | |
| #define BUTTON_PIN G39 | |
| #define STAR_START 57 // Start index of the "star" effect | |
| #define STAR_END 134 // End index of the "star" effect |
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
| fun dithering(bitmap: Bitmap) { | |
| val height: Int = bitmap.getHeight() | |
| val width: Int = bitmap.getWidth() | |
| val colors = 3 | |
| val threshold = 255/colors | |
| for (x in 0 until width) { | |
| for (y in 0 until height) { | |
| val pixel = bitmap.getPixel(x, y) | |
| var alpha = Color.alpha(pixel) |
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
| #include <M5StickC.h> | |
| #include "bugC.h" | |
| #define sampleTime 0.005 | |
| float pitch = 0.0F; | |
| float roll = 0.0F; | |
| float yaw = 0.0F; | |
| float roll_offset = 0.0F; |
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
| difference(){ | |
| scale([1,1,0.3]){ | |
| surface("YOUR FILE NAME GOES HERE", center=true); | |
| } | |
| cube([200,200,14], center=true); | |
| } |
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 GomokuBoard: | |
| def __init__(self, size=9): | |
| self.size = size | |
| self.board = [0]*(size*size) | |
| self.last_move = None | |
| self.total_moves = 0 | |
| def clone_board(self): | |
| new_board = GomokuBoard(self.size) |
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 GomokuSearchTree(Node): | |
| def __init__(self, parent, board, from_move, next_player, simulation_limit=1, exploration_constant=1): | |
| Node.__init__(self, parent=parent, simulation_limit=simulation_limit, exploration_constant=exploration_constant) | |
| self.board = board | |
| self.from_move = from_move | |
| self.next_player = next_player | |
| def create_from_move(self, move): | |
| new_board = self.board.clone_board() | |
| new_board.place_move(move, self.next_player) |
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
| def check_board(self, test=False): | |
| if self.last_move is None: | |
| return Gomoku.IN_PROGRESS | |
| x = self.last_move%self.size | |
| y = self.last_move//self.size | |
| cell = self.board[self.last_move] | |
| min_x = max(0, x-4) | |
| min_y = max(0, y-4) |
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
| def print(self): | |
| header = ' ' | |
| for x in range(self.size): | |
| if self.last_move is not None and x == self.last_move%self.size: | |
| header += '▼ ' | |
| else: | |
| header += f'{x+1} ' | |
| print(header) | |
| for y in range(self.size): |
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 math | |
| import random | |
| class Node: | |
| def __init__(self, parent=None, simulation_limit=1, exploration_constant=1): | |
| self.parent=parent | |
| self.reward = 0 | |
| self.visit_count = 0 | |
| self.possible_move_list = None | |
| self.expanded_children = {} |
NewerOlder