P3 init und Text in Binär und in Blöcke unterteilt

This commit is contained in:
2025-06-25 16:37:06 +02:00
parent ca8e8e9621
commit 0fbfe58fbb
4 changed files with 390 additions and 7 deletions

View File

@@ -181,24 +181,28 @@ def main():
print(f"==========BLOCK {i + 1}==========")
print(f" Codewort: {codeword}")
print(f" Fehlerwort: {error_pattern}")
print(f" Empfangen: {received}")
detected_blocks += 1 if "1" in check else 0
total_transmited_data += len(codeword)
repeats += 1
'''
if "1" in check:
print(" ❌ Fehler ")
total_errors += error_pattern.count("1")
print(" ❌ Fehler ")
total_errors += error_pattern.count("1")
else:
print(" ✅ Erfolgreich")
print(" ✅ Erfolgreich")
'''
'''
Version in der fehlerhafte Übertragungen so lange wiederholt werden, bis sie fehlerfrei sind
'''
'''
while "1" in check:
print(" ❌ Fehler ")
total_errors += error_pattern.count("1")
@@ -213,7 +217,7 @@ def main():
print(" ✅ Erfolgreich \n")
'''
# Ende
@@ -224,8 +228,7 @@ def main():
print(f" Blockgröße: {blocksize}")
print(f" Blockanzahl: {len(blocks)}")
print(f" übertragene Datenmenge: {total_transmited_data} Bit")
print(
f" fehlerfreie Blöcke: {len(blocks) - detected_blocks} = {((len(blocks) - detected_blocks) / len(blocks) * 100):.2f} %")
print(f" fehlerfreie Blöcke: {len(blocks) - detected_blocks} = {((len(blocks) - detected_blocks) / len(blocks) * 100):.2f} %")
print(f" Wiederholungen: {repeats}, ca. {(repeats / len(blocks)):.1f} p.Bl.")
print(f" fehlerhafte Bits: {total_errors} Bit = {(total_errors / total_transmited_data * 100):.2f}%")