Skip to content

Instantly share code, notes, and snippets.

PikalaxALT

  • University of Pennsylvania
  • United States
View GitHub Profile
View dism_battle_ai.py
import collections
import os
import sys
PTRTYPE_SCRIPT = 0
PTRTYPE_BYTEARRAY = 1
PTRTYPE_HWORDARRAY = 2
if len(sys.argv) > 1:
project_dir = sys.argv[1]
@PikalaxALT
PikalaxALT / moves.tsv
Created Dec 18, 2018
All moves in gen 2 and whether they are considered damaging by bingo rules
View moves.tsv
Name Effect Power Type Accuracy PP Effect chance Is damaging?
POUND EFFECT_NORMAL_HIT 40 NORMAL 100 35 0 TRUE
KARATE_CHOP EFFECT_NORMAL_HIT 50 FIGHTING 100 25 0 TRUE
DOUBLESLAP EFFECT_MULTI_HIT 15 NORMAL 85 10 0 TRUE
COMET_PUNCH EFFECT_MULTI_HIT 18 NORMAL 85 15 0 TRUE
MEGA_PUNCH EFFECT_NORMAL_HIT 80 NORMAL 85 20 0 TRUE
PAY_DAY EFFECT_PAY_DAY 40 NORMAL 100 20 0 TRUE
FIRE_PUNCH EFFECT_BURN_HIT 75 FIRE 100 15 10 TRUE
ICE_PUNCH EFFECT_FREEZE_HIT 75 ICE 100 15 10 TRUE
THUNDERPUNCH EFFECT_PARALYZE_HIT 75 ELECTRIC 100 15 10 TRUE
@PikalaxALT
PikalaxALT / save.s
Last active Nov 18, 2018
output by arm-none-eabi-gcc-8.1.0
View save.s
.file ""
.text
.syntax divided
.section .rodata
.align 2
.thumb
.syntax unified
.align 1
.p2align 2,,3
.arch armv4t
@PikalaxALT
PikalaxALT / gbz80disasm.py
Last active Jun 9, 2018
Rudimentary GBZ80 disassembler (MBC3 only for the time being)
View gbz80disasm.py
import argparse
from functools import total_ordering
from z80table import z80table, extdtable
import re
def fread(file, n):
return int.from_bytes(file.read(n), 'little')
View make_shim.c
#include <stdio.h>
#include <getopt.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
struct Section {
unsigned short end;
bool invalid;
char * name;
View vote_counter.py
import asyncio
import discord
from discord.ext import commands
from collections import Counter
class FooCog:
THUMBS_UP = '\U0001ff4d'
THUMBS_DOWN = '\U0001ff4e'
@PikalaxALT
PikalaxALT / test_sql.py
Created May 15, 2018
Test suite for [PikalaxBOT](/pikalaxalt/pikalaxbot)
View test_sql.py
import unittest
import sqlite3
from utils import sql
from collections import namedtuple
User = namedtuple('User', ['id', 'name'])
Context = namedtuple('Context', ['author'])
me = User(148462033770119168, 'PikalaxALT')
ctx = Context(me)
View youtube-com-20170616132500
APCGX7rC47Q43Cpp4Y8E9sHsJWJPlVzbUyRCbxcRHCEkb4na8b3e6LPZ
F7RXzOZn-I846wC8K-ajSNH2B0PX1U9GWcxG5tsx102uC_0jPsLsVqUU
GdAUOqrmHXOPu5ciaQ6ARunk9EYVx2jNH6o9N2cxIUbEL06e5a75oW5J
mR2ruEhtEz6TTvUDJ46tEieWq1QD_909sVCleLz_4BK8C3RnTVoEifvk
B_r2L9YaQGI8EgtN3EUaNvC329BeGP0FxznOOB28fwz5Y9HBX_eEvy25
vdYw1EvfJLlWxCM4XHwzhXN9zyANs7-3dlHOjXTG0cr8KcJ5W2juJNw1
udF91MCBjyJjpi3_8FQ08YW2w38ndZ7CsIHjcjdVk8A1S1BUGEAslnxB
a8b3FcCM9t4wGQbcDTT2XschjREgz2rWha4bSnhMRTCaAr3h2vebTly6
GkyBAZhQHKl-xwQfFDT016lKrhCNtVygxYy6vXFMWVyBqJwldq7gvy7z
YJvwS1mASoOfW1AJpcMLWL317bLSq1kaJk-7JRgzrqyJSEclWNkBQ2P5
@PikalaxALT
PikalaxALT / pokecrystal_rng.txt
Created May 10, 2017
Brief description of how and when the RNG updates in the Pokemon Crystal overworld, with the goal of bringing RNG manipulation to gen 2 speedrunning.
View pokecrystal_rng.txt
The RNG update function is as follows:
* The value at 0xFF04 (rDIV) is read and added, with carry, to 0xFFE1 (hRandomAdd); the value is stored back to hRandomAdd.
* The value at rDIV is read again (it may have incremented) and subtracted, with carry, from 0xFFE2 (hRandomSub); the value is stored back to hRandomSub and returned in the accumulator.
Every time the VBlank interrupt toggles, the RNG is called. This happens once every frame.
When you turnframe or step onto a tile that can generate an encounter, the RNG is rolled a number of times for that encounter. This excludes the first 5 steps after loading the current map from a connection, warp, or battle; during this time, no wild encounters may be generated so as to prevent the player from being encounter-locked. Note that encounters are not rolled until the frame your step or turnframe finishes. The pattern is as such:
* Roll RNG and compare it with the modified encounter rate. If the rolled number is greater than the encounter rate, the ro
@PikalaxALT
PikalaxALT / z80disasm.py
Created Mar 9, 2017
Script for disassembling Gameboy Z80
View z80disasm.py
#!/usr/bin/python3
import re, sys, argparse, random
TileMap = -1000 # 0xc3a0
AttrMap = -1000 # 0xccd9
SCREEN_WIDTH = 20
SCREEN_HEIGHT = 18
z80table = [
# $00
You can’t perform that action at this time.