Skip to content

Instantly share code, notes, and snippets.

@Cartman0
Cartman0 / 02_Unixコマンドの基礎.ipynb
Created May 8, 2016 15:39
言語処理100本ノック 2章メモ(Unixコマンドの基礎)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Cartman0
Cartman0 / 01_準備運動.ipynb
Last active May 7, 2016 08:59
言語処理100本ノック 1章 準備運動 with python
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Cartman0
Cartman0 / lifegame.py
Created May 6, 2016 09:26
LifeGameのクラスファイル(matplotlibで可視化)
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from matplotlib.ticker import MultipleLocator
class LifeGame(object):
STATE = {'alive': 2, 'death': 0, 'birth': 1}
def __init__(self, cells):
self._cells_initial = np.copy(cells) # 初期のセル配列
@Cartman0
Cartman0 / lifgame_class.py
Created May 3, 2016 11:56
LifeGame (クラス)
import numpy as np
class LifeGame(object):
STATE = {'alive': 2, 'death': 0, 'birth': 1}
def __init__(self, cells):
self._cells_initial = np.copy(cells) # 初期のセル配列
self._cells_in = np.copy(cells) # ルール適用前のセル配列
self._cells_out = np.copy(cells) # ルール適用後のセル配列 np.copy(cells)
self._SHAPE = cells.shape
@Cartman0
Cartman0 / lifegame_process.py
Created May 2, 2016 16:04
LifeGame 処理のみ(classなし、可視化なし)
import numpy as np
CELLS_WIDTH=8
cells = np.zeros((CELLS_WIDTH, CELLS_WIDTH), 'int')
cells[:3,:3] = 1
print(cells)
# 条件:自分が生きている
def isAlive(cell_idx, cells):
if cells[cell_idx] == 0:
@Cartman0
Cartman0 / NumPyTutorial_6.ipynb
Created April 23, 2016 15:59
NumPy Tutorial メモ6(Linear Algebra)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Cartman0
Cartman0 / NumPyTutorial_5.ipynb
Last active April 21, 2016 13:49
NumPyTutorial メモ5(Fancy indexing and index tricks)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Cartman0
Cartman0 / NumPyTutorial_4.ipynb
Last active April 21, 2016 13:52
NumPy Tutorial メモ4(Less Basic)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Cartman0
Cartman0 / NumPyTutorial_3.ipynb
Created April 16, 2016 16:31
NumPy Tutorial メモ3 (Copies and Views)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Cartman0
Cartman0 / NumPyTutorial_2.ipynb
Created April 16, 2016 05:32
Numpy Tutorial メモ2(ShapeManipulation)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.