mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 20:21:32 -06:00
Pokemon Emerald: Implement New Game (#1813)
This commit is contained in:
19
worlds/pokemon_emerald/util.py
Normal file
19
worlds/pokemon_emerald/util.py
Normal file
@@ -0,0 +1,19 @@
|
||||
from typing import List
|
||||
|
||||
from .data import data
|
||||
|
||||
|
||||
def location_name_to_label(name: str) -> str:
|
||||
return data.locations[name].label
|
||||
|
||||
|
||||
def int_to_bool_array(num: int) -> List[bool]:
|
||||
binary_string = format(num, '064b')
|
||||
bool_array = [bit == '1' for bit in reversed(binary_string)]
|
||||
return bool_array
|
||||
|
||||
|
||||
def bool_array_to_int(bool_array: List[bool]) -> int:
|
||||
binary_string = ''.join(['1' if bit else '0' for bit in reversed(bool_array)])
|
||||
num = int(binary_string, 2)
|
||||
return num
|
Reference in New Issue
Block a user