P3 init und Text in Binär und in Blöcke unterteilt
This commit is contained in:
17
P2/main.py
17
P2/main.py
@@ -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}%")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user