Skip to content

Instantly share code, notes, and snippets.

View shiracamus's full-sized avatar

@shiracamus shiracamus

View GitHub Profile
function iter(pattern) {
let index = 0
return {
[Symbol.iterator]: function() { return this },
next: function() {
if (index < pattern.length)
return { value: pattern[index++], done: false }
else
return { done: true }
},
import argparse
try:
from Crypto.Random import random
except ImportError:
try:
import secrets as random
except ImportError:
import random
"""
import random
from time import sleep
import tkinter as tk
from tkinter import messagebox
TITLE = "Othello"
class Stone:
NONE = "."
@shiracamus
shiracamus / othello_cui.py
Last active April 15, 2023 00:49
CUI Othello
class Stone:
SPACE = "."
BLACK = "X"
WHITE = "O"
class Board:
def __init__(self, size):
self.cells = [[Stone.SPACE] * size for i in range(size)]
board = """
| 45| 6| 3 |
| | 49|126|
| | | |
+---+---+---+
| 12| | 4|
|9 | 62| |
| 87| | 9|
+---+---+---+
| | | |
import numpy as np
_ = 0
problem = [
[_, _, _, _, 4, _, _, _, _],
[_, _, 5, _, _, _, _, _, _],
[_, 3, 6, 8, _, _, _, 7, 2],
[_, 8, _, _, _, 6, 5, _, _],
[1, _, _, 5, _, _, _, 9, _],
import math
import sys
import pygame
from pygame.locals import *
from random import randint
import time
pygame.init()
WIDTH, HEIGHT = 800, 600
screen = pygame.display.set_mode((WIDTH, HEIGHT))
import java.util.Scanner;
enum Cell {
EMPTY("[ ]"),
PLAYER1("[O]"),
PLAYER2("[X]");
private final String text;
private Cell(final String text) {
#!/usr/bin/env python3
from enum import IntEnum
import random
import itertools
import sys
# 隣のセルへの座標の差分 (x, y), [North, East, South, West]
#!/usr/bin/python3
import curses
import locale
from random import randint
INSTRUCTION = """\
Maneaters Ver 1.3
Mission : マンイーターを消して生き残れ!
O -- Maneater, 段階的に追い詰める敵