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
"""Exact All Portals solver via formulating the problem as the ring star problem and solving that | |
with a MILP solver. | |
AP paths and this solver differ slightly from ring star as they require only a path and not a cycle. | |
AP paths additionally can make use of the world spawn point (origin) which technically makes most | |
edge weights asymmetrical. | |
The cycle issue is resolved by using a dummy root as the root that has a cost of 0 but must always | |
connect to the real root. | |
The edge from the last real node to the dummy root is then just not drawn. |
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 numpy as np | |
from matplotlib import pyplot as plt | |
from ortools.constraint_solver import routing_enums_pb2 | |
from ortools.constraint_solver import pywrapcp | |
angle = np.random.random() * np.pi * 2 | |
dist = np.random.randint(22784, 24320 + 1) | |
STARTING_POINT = (np.cos(angle) * dist, np.sin(angle) * dist) | |
OR_SCALE_FACTOR = 10000 | |
STRONGHOLD_DATA = ( |
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 array import array | |
import numpy as np | |
class Xorshift: | |
"""Xorshift128+ implementation used in JavaScript Engines""" | |
def __init__(self, seed: tuple[int]) -> None: | |
self.state = array("Q", seed) |
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 fractions import Fraction | |
from math import ceil | |
from random import randint | |
import numpy as np | |
from sympy import ZZ | |
from sympy.polys.matrices import DM | |
from cdd import gmp | |
import cdd | |
MOD = 1 << 17 |
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
""" | |
Finds rng states of the form (seed_0, 0x82A2B175229D6A5B) that produce a given sequence | |
of 64+ rand(2) observations when rand(121)s happen before each. | |
The probability of an arbitrary sequence can be solved for an initial state is roughly | |
P(X <= max jump count) for X ~ Bin(64, 7/128) (the fact that rand(121) can reject more than once | |
makes this not exactly correct) | |
The amount of work needed to solve the sequence scales with CR(64, max jump count) | |
(combination with replacement; technically sum{0 <= i <= max jump count} CR(64, i) but terms before |
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
""" | |
Finds rng states that produces a given sequence of 128 rand(2) observations when | |
rand(121)s happen after each. | |
This example has a max jump count of 2 (# of times total that rand(121)s reject the result | |
of rand(128) and cause an additional advancement throughout). | |
The probability that an arbitrary sequence can be solved for an initial state is roughly | |
P(X <= max jump count) for X ~ Bin(127, 7/128) (the fact that rand(121) can reject more than once | |
makes this not exactly correct) |
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
// sha256_12 taken from https://github.com/zoogie/bfCL/blob/master/cl/sha256_16.cl | |
// which was modified from https://github.com/ARMmbed/mbedtls/blob/development/library/sha256.c | |
typedef unsigned int uint32_t; | |
typedef unsigned char u8; | |
typedef unsigned short u16; | |
typedef unsigned int u32; | |
typedef unsigned long u64; |
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 pyopencl as cl | |
import numpy as np | |
import time | |
TID = int(input("TID: ")) | |
SID = int(input("SID: ")) | |
MAX_HOUR_VALUE = input("Max Hour Value (empty for full search): ") | |
MAX_HOUR_VALUE = int(MAX_HOUR_VALUE or 0xFF) | |
def untemper(y): |
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
# search config | |
MIN_NPC_COUNT = 25 | |
MAX_NPC_COUNT = 40 | |
# unknown what exactly determines this value but it should be consistent for the area and not very high | |
MIN_FLY_VALUE = 0 | |
MAX_FLY_VALUE = 12 | |
# rng config | |
BRUTEFORCE_RANGE = 5000 |
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
"""Script to play videos on the poketch memo pad by writing tile data to memory""" | |
import numpy as np | |
# hacky; https://github.com/scikit-video/scikit-video/issues/154#issuecomment-1445239790 | |
np.float = np.float64 | |
np.int = np.int_ | |
import skvideo.io | |
import cv2 | |
import pymem | |
from pymem.pattern import pattern_scan_all |
NewerOlder