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
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 } | |
}, |
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 argparse | |
try: | |
from Crypto.Random import random | |
except ImportError: | |
try: | |
import secrets as random | |
except ImportError: | |
import random | |
""" |
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 | |
from time import sleep | |
import tkinter as tk | |
from tkinter import messagebox | |
TITLE = "Othello" | |
class Stone: | |
NONE = "." |
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 Stone: | |
SPACE = "." | |
BLACK = "X" | |
WHITE = "O" | |
class Board: | |
def __init__(self, size): | |
self.cells = [[Stone.SPACE] * size for i in range(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
board = """ | |
| 45| 6| 3 | | |
| | 49|126| | |
| | | | | |
+---+---+---+ | |
| 12| | 4| | |
|9 | 62| | | |
| 87| | 9| | |
+---+---+---+ | |
| | | | |
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 numpy as np | |
_ = 0 | |
problem = [ | |
[_, _, _, _, 4, _, _, _, _], | |
[_, _, 5, _, _, _, _, _, _], | |
[_, 3, 6, 8, _, _, _, 7, 2], | |
[_, 8, _, _, _, 6, 5, _, _], | |
[1, _, _, 5, _, _, _, 9, _], |
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 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)) |
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.Scanner; | |
enum Cell { | |
EMPTY("[ ]"), | |
PLAYER1("[O]"), | |
PLAYER2("[X]"); | |
private final String text; | |
private Cell(final String text) { |
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
#!/usr/bin/env python3 | |
from enum import IntEnum | |
import random | |
import itertools | |
import sys | |
# 隣のセルへの座標の差分 (x, y), [North, East, South, West] |
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
#!/usr/bin/python3 | |
import curses | |
import locale | |
from random import randint | |
INSTRUCTION = """\ | |
Maneaters Ver 1.3 | |
Mission : マンイーターを消して生き残れ! | |
O -- Maneater, 段階的に追い詰める敵 |