Skip to content

Instantly share code, notes, and snippets.

import numpy as np
from collections.abc import Sized, Iterable, Iterator
from itertools import product, count, combinations, permutations
from collections import defaultdict
from typing import Optional
import cycosat
BlocksColor = [
'#ffb631',
'#f0ea4b',
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import taichi as ti
ti.init(arch=ti.gpu)
StatusSearch, StatusAtFood, StatusGoHome, StatusAtHome = 1, 2, 3, 4
pi = 3.1415926
width = 80
height = 60
N = 1000
ant_length = 1
@ruoyu0088
ruoyu0088 / taichi_zoo_life.py
Last active September 19, 2022 08:52
taichi_zoo_life.py
import taichi as ti
Category10_10 = ('#1f77b4', '#ff7f0e', '#2ca02c', '#d62728', '#9467bd',
'#8c564b', '#e377c2', '#7f7f7f', '#bcbd22', '#17becf')
ti.init(arch=ti.gpu)
N = 2000
N_COLOR = 10
COLORS = [int(c[1:], 16) for c in Category10_10]
from kiwisolver import strength
import taichi as ti
import numpy as np
Category10_10 = ('#1f77b4', '#ff7f0e', '#2ca02c', '#d62728', '#9467bd', '#8c564b', '#e377c2', '#7f7f7f', '#bcbd22', '#17becf')
ti.init(arch=ti.gpu)
N = 5000
N_COLOR = 10
. ....... .......,,,.......*(* /%/
.. . .... .,,... .*//, /&/
... ... ....,,,,,,,,. ,*//, /&/
.. .....,,,,.*/*,. *%*
. .. ..,,,*,,. *(,
..... ..,*,,.. *#*
..,***,. *#*
.,*(*,. *%/.
. .,/#* *(*.
.. .,**,**,
@ruoyu0088
ruoyu0088 / numba-skeletonize.ipynb
Created February 9, 2021 01:39
numba-skeletonize.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
from scipy import integrate
import numpy as np
def spring_sys(t, y, m, b, k, F):
x, v = y
dx = v
dv = (F - k * x - b * v) / m
return dx, dv
def run_sim(x0, v0, m, b, k, F, tend, n):