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
#include <cstdio> | |
#include <cstdint> | |
#include <cmath> | |
#include <algorithm> | |
#include <chrono> | |
typedef int64_t s64; | |
typedef uint64_t u64; | |
typedef __int128 s128; |
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
#include <cstdio> | |
#include <cstdint> | |
#include <cmath> | |
typedef uint64_t u64; | |
const u64 A = 0x5d588b656c078965ll; | |
const u64 B = 0x269ec3ll; | |
int main() { |
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
M = 2**64 | |
A = 0x5d588b656c078965 | |
B = 0x269ec3 | |
BITS = 64 | |
P = 16 | |
LCGOperator = Struct.new(:a, :b) | |
class LCGOperator | |
# 合成 |
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
from z3 import BitVec, Solver | |
A = 0x5d588b656c078965 | |
B = 0x269ec3 | |
BITS = 64 | |
M = 2**BITS | |
SHIFT = BITS - 1 | |
K = 64 |
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
# HGSSのセーブデータにおいてペラップのおしゃべり音声にサインカーブを書きこむ | |
fname = ARGV[0] | |
bin = File.binread(fname).bytes.to_a | |
2.times do |j| | |
off = 0x40000 * j + 0x4e78 # hgss | |
off = 0x40000 * j + 0x64f0 # pt | |
1000.times do |i| | |
bin[off + i] = 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
#include <memory> | |
#include <cstdint> | |
#include <cstdio> | |
#define N 624 | |
#define M 397 | |
namespace MT { | |
int objects_count = 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
# is the map (32bit trainer id) -> (gen7 tid, tsv) is a injection? | |
# answer: no | |
from z3 import BitVec, Solver, LShR, URem | |
def g7tid(tid): | |
return URem(tid, 1000000) | |
def tsv(tid): | |
return (LShR(tid, 16) ^ (tid & 0xffff)) >> 4 |
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
#include <stdio.h> | |
/* Period parameters */ | |
#define N 624 | |
#define M 397 | |
#define MATRIX_A 0x9908b0dfUL /* constant vector a */ | |
#define UPPER_MASK 0x80000000UL /* most significant w-r bits */ | |
#define LOWER_MASK 0x7fffffffUL /* least significant r bits */ | |
static unsigned long mt[N]; /* the array for the state vector */ |
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
from z3 import BitVec, Solver | |
def nxt(x): | |
return (x * 1103515245 + 24691) & 0xffffffff | |
def tovalue(x): | |
return (x >> 16) & 0x7ffff | |
seed = BitVec("seed", 32) | |
s = Solver() |
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
x1+x2+x4+x6+x9+x13+x15+x20+x24+x26+x27+x28+x30+x32+x33+x34+x36+x38+x41+x44+x46+x49+x51+x52+x55+x57+x60+x61+x62+(1+x0)*(x3+x4+x6+x7+x9+x11+x14+x22+x24+x28+x30+x31+x35+x37+x39+x40+x41+x42+x43+x45+x50+x51+x52+x54+x58+x59)=0 | |
1+x9+x13+x17+x20+x21+x23+x25+x26+x28+x33+x37+x38+x41+x42+x45+x47+x48+x50+x51+x52+x53+x55+x56+x58+x59+x60+x61+(1+x31)*(1+x0+x2+x3+x6+x7+x8+x11+x13+x14+x17+x18+x20+x23+x24+x29+x30+x31+x33+x35+x36+x37+x38+x39+x40+x41+x42+x46+x51+x52+x53+x55+x58+x59+x60)=0 | |
x1+x3+x5+x7+x10+x11+x12+x13+x14+x16+x17+x23+x24+x25+x26+x27+x28+x29+x34+x39+x42+x45+x48+x52+x54+x55+x57+x62+(x61)*(x0+x1+x2+x6+x8+x10+x11+x12+x14+x17+x18+x22+x24+x25+x27+x28+x30+x32+x34+x36+x37+x38+x39+x40+x44+x45+x48+x50+x52+x53+x56+x57+x58+x59+x60)=0 | |
1+x0+x3+x5+x6+x11+x13+x15+x17+x18+x20+x25+x26+x27+x29+x30+x31+x36+x37+x39+x40+x44+x46+x47+x48+x50+x51+x52+x53+x54+x55+x60+(x3+x6+x8+x9+x11+x13+x14+x21+x22+x24+x25+x27+x28+x29+x36+x38+x39+x42+x44+x46+x47+x49+x53+x54+x61)*(x0+x2+x3+x4+x5+x7+x8+x12+x13+x15+x16+x17+x19+x22+x24+x25+x28+x33+x39+x40+x41 |