This file contains 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
const WORDS = { | |
"ポケモン": ['株式会社ポケモン', '任天堂', 'ゲームソフト'], | |
"株式会社ポケモン": ["登場する架空の生物", "アニメ", "メディアミックス"], | |
"任天堂": ["マリオ", "ゼルダ", "星のカービィ"], | |
}; | |
function getAncWords(word) { | |
// 引数の文字列を元に検索でキーワードを文字列の配列で返す処理 | |
// 例:['株式会社ポケモン', '任天堂', 'ゲームソフト']、空配列が返る事もある | |
console.log("getAncWords:", word); |
This file contains 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
def solution(garden): | |
days = 0 | |
# 咲いている花(1)の周囲で咲いていない花(0)、つまり次に咲く花の位置を列挙 | |
grows = {(ny, nx) | |
for y, row in enumerate(garden) | |
for x, flower in enumerate(row) | |
if flower == 1 | |
for ny, nx in ((y-1, x), (y+1, x), (y, x-1), (y, x+1)) | |
if 0 <= ny < len(garden) and 0 <= nx < len(garden[ny]) | |
if garden[ny][nx] == 0} |
This file contains 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.Random; | |
public class RPG { | |
public static void main(String[] args) { | |
Hero hero = new Hero(); | |
Monster monster = new Dragon(); | |
Character attacker = hero; | |
Character defender = monster; | |
while (attacker.isAlive()) { | |
attacker.attack(defender); |
This file contains 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 | |
""" | |
download a Qiita article and print program in code blocks | |
example: | |
$ python3 qiitacode.py https://qiita.com/shiracamus/items/556ff8d916712a9f7055 | |
$ python3 qiitacode.py https://qiita.com/shiracamus/items/556ff8d916712a9f7055 c | |
$ python3 qiitacode.py https://qiita.com/shiracamus/items/556ff8d916712a9f7055 py | |
""" |
This file contains 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 tkinter as tk | |
import math | |
import pyautogui | |
info = { | |
'position': (-1, -1), | |
'state': tk.NORMAL, | |
} | |
This file contains 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 | |
class Character: | |
def __init__(self, name, hit_point, attack_power): | |
self.name = name | |
self.hit_point = hit_point | |
self.attack_power = range(attack_power + 1) | |
def is_dead(self): |
This file contains 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 wordlist | |
from typing import Callable | |
def best_candidate(words: list[str]) -> str: | |
if len(words) > 3**5: | |
return None | |
for candidate in words: | |
patterns = set("".join("g" if c == w else "y" if c in word else "w" | |
for c, w in zip(candidate, word)) |
This file contains 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.ArrayList; | |
import java.util.List; | |
import java.util.Collections; | |
import java.util.stream.Collectors; | |
import java.util.Scanner; | |
public class BlackJack { | |
public static void main(String[] args) { | |
System.out.println("ブラックジャックゲーム"); | |
Deck deck = new Deck(); |
This file contains 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 Blackjack | |
def play | |
puts <<~END | |
======================= | |
Welcome to Blackjack!!! | |
======================= | |
END |
This file contains 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 | |
class Hand: | |
def __init__(self, shape, stronger_than): | |
self.shape = shape | |
self._stronger_than = stronger_than | |
def __repr__(self): |