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 random | |
import time | |
DEPOP = 1 # 過疎条件 | |
OVERCROW = 4 # 過密条件 | |
ALIVE_LOWER = 3 # 発生条件(下限) | |
ALIVE_UPPER = 3 # 発生条件(上限) | |
ETERNAL = False # セルの永続化フラグ | |
INITIALIZE_ALIVE_RATE = 20 # 初期セルの生存率(%) |
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 time | |
def sec_to_time(sec): | |
"""引数secの秒数を'HH:MM:SS'形式文字列に変換して返す""" | |
m, s = divmod(int(sec), 60) | |
h, m = divmod(m, 60) | |
return f'{h:02}h {m:02}m {s:02}s' | |
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 time | |
from multiprocessing import Process, Pipe | |
from tkinter import Tk, ttk, StringVar | |
def execute(): | |
""" | |
コマンド実行 | |
""" | |
print('コマンドボタン 押下') |
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
# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1181&lang=ja | |
from collections import defaultdict | |
class Die: | |
TOP, FRONT, RIGHT, BACK, LEFT, BOTTOM = 0, 1, 2, 3, 4, 5 | |
ROLL = { | |
TOP: (FRONT, RIGHT, BACK, LEFT), | |
FRONT: (TOP, FRONT, BOTTOM, BACK), | |
RIGHT: (TOP, RIGHT, BOTTOM, LEFT), |
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
# To build and launch (first time): | |
# $ docker-compose up -d | |
# To create new images (--no-cache) to force building from scratch: | |
# $ docker-compose build | |
# To launch again (leave out -d for non daemon launch): | |
# $ docker-compose up -d | |
# Short command for rebuilding and restarting | |
# $ docker-compose up -d --build | |
# To stop containers: | |
# $ docker-compose stop |
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 java.util.List; | |
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.Random; | |
import java.util.function.Consumer; | |
import java.awt.Component; | |
import java.awt.CardLayout; | |
import java.awt.Graphics; | |
import java.awt.Font; | |
import java.awt.Color; |
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 java.util.List; | |
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.Random; | |
import java.awt.*; | |
import java.awt.event.*; | |
import java.awt.Color; | |
import java.awt.Rectangle; | |
import javax.swing.*; |
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 sys | |
import csv | |
from time import sleep | |
import requests | |
from bs4 import BeautifulSoup | |
def main(): | |
genre = 'tonkatsu' if len(sys.argv) < 2 else sys.argv[1] | |
save_csv(f'{genre}.csv', shops(genre), |
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
enum Cell { WALL, ROAD }; | |
class Map { | |
public final int width; | |
public final int height; | |
private final Cell[][] cells; | |
public Map(int width, int height) { | |
if (width < 5 || height < 5 || width % 2 == 0 || height % 2 == 0) { | |
new IllegalArgumentException("縦・横共に5以上の奇数で作成してください。"); |
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 java.awt.*; | |
import javax.swing.*; | |
class Life { | |
private static final String DEAD = "0"; | |
private static final String ALIVE = "1"; | |
private String state = DEAD; | |
public void dead() { state = DEAD; } | |
public void alive() { state = ALIVE; } |