Skip to content

Instantly share code, notes, and snippets.

@emoose
emoose / compare.py
Last active April 10, 2025 16:00
sh1 map compare
# Save script as asm/maps/compare.py
# Then run
# python compare.py map0_s01 map0_s02 0
# This will compare line count between files in each maps nonmatchings folder
# For each pair that matches it removes comments & data/func refs and uses Levenshtein to compare them
# Last param is max distance to show, use 0 to get exact matches, but can tweak it to find others if wanted.
# (since this only works with asm files in nonmatchings folder, it can't compare map0_s00 since we've matched some of them)
import os
import re
import Levenshtein
@emoose
emoose / compare.py
Last active April 18, 2025 21:33
compare.py with symbols/includes
# Save script as asm/maps/compare.py
# Then run
# python compare.py map0_s01 map0_s02
# This compares matching funcs in first maps matchings folder against nonmatchings in the second map
# For each pair that matches it removes comments & data/func refs and uses Levenshtein to compare them
# Funcs with distance 0 Levenshtein score will then be printed, along with lines to use in symbols.txt & #include lines to add to .c
import os
import re
import Levenshtein