Skip to content

Instantly share code, notes, and snippets.

View hrwatahiki's full-sized avatar

hrwatahiki hrwatahiki

View GitHub Profile
@hrwatahiki
hrwatahiki / mouse.py
Created January 30, 2015 14:29
Mouse management class for python 3(only). Pywin32 is required. See also http://stackoverflow.com/questions/4263608/ctypes-mouse-events .
import win32gui, win32api, win32con, ctypes
class Mouse:
"""It simulates the mouse"""
MOUSEEVENTF_MOVE = 0x0001 # mouse move
MOUSEEVENTF_LEFTDOWN = 0x0002 # left button down
MOUSEEVENTF_LEFTUP = 0x0004 # left button up
MOUSEEVENTF_RIGHTDOWN = 0x0008 # right button down
MOUSEEVENTF_RIGHTUP = 0x0010 # right button up
MOUSEEVENTF_MIDDLEDOWN = 0x0020 # middle button down
@hrwatahiki
hrwatahiki / join-image.py
Last active January 5, 2020 15:47
join-image.py
from PIL import Image
import datetime
import os.path
def getnewsize(size, direction):
if direction == 'V':
return (size[0], size[1]*number)
elif direction == 'H':
return (size[0]*number, size[1])
return (0, 0)
@hrwatahiki
hrwatahiki / puzzlequest.py
Last active November 23, 2020 13:39
Puzzle Quest 2 の呪文学習クエスト解法を探索する。幅優先。中断/再開機能付き。理論上は全て解ける。しかし、メモリ等の制限で複雑さが高い問題を解くのは難しい。C言語で作ったほうがよかった。
import datetime
import pathlib
import pickle
import sys
class Board:
def __init__(self, size_x: int, size_y: int, value: str):
self._size_x = size_x
self._size_y = size_y