|
|
@@ -103,6 +103,9 @@ class MetroidState: |
|
|
|
self.locations = ["Brinstar", "Norfair", "Kraid's Lair", "Ridley's Lair", "Tourian"] |
|
|
|
self.startLocation = 0 |
|
|
|
self.bitfield = [] |
|
|
|
|
|
|
|
def initializeBitfield(self): |
|
|
|
self.bitfield = [] |
|
|
|
for _ in range(128): |
|
|
|
self.bitfield.append(0) |
|
|
|
|
|
|
@@ -377,9 +380,9 @@ class MetroidState: |
|
|
|
# Start Location |
|
|
|
self.startLocation = random.randint(0,4) |
|
|
|
self.missileCount = random.randint(0,255) |
|
|
|
self.createBitfield() |
|
|
|
|
|
|
|
def createBitfield(self): |
|
|
|
self.initializeBitfield() |
|
|
|
# Doing this in order, which is dumb and tedious but accurate. |
|
|
|
if self.itemsCollected["Maru Mari"]: |
|
|
|
self.bitfield[0] = 1 |
|
|
@@ -665,13 +668,11 @@ class MetroidState: |
|
|
|
# for bit in binShift: |
|
|
|
# bitfield.append(int(bit)) |
|
|
|
bitfield = bitfield + [0,0,0,0,0,0,0,0] |
|
|
|
checking = [] |
|
|
|
for i in range(16): |
|
|
|
checking.append(int("".join([str(x) for x in bitfield[i:i+8]]), 2)) |
|
|
|
decChecksum = sum(checking) |
|
|
|
print(decChecksum) |
|
|
|
# checking = [] |
|
|
|
# for i in range(16): |
|
|
|
# checking.append(int("".join([str(x) for x in bitfield[i:i+8]]), 2)) |
|
|
|
decChecksum = sum(bitfield) |
|
|
|
binChecksum = bin(decChecksum).replace('0b','') |
|
|
|
print(binChecksum) |
|
|
|
checksum = binChecksum[-8:] |
|
|
|
while len(checksum) < 8: |
|
|
|
checksum = checksum + "0" |