Skip to content
Snippets Groups Projects
Commit 5dad04d5 authored by nicolas.albanesi's avatar nicolas.albanesi
Browse files

Ajout des paramètres

parent ed765c87
No related branches found
No related tags found
No related merge requests found
......@@ -14,15 +14,20 @@ def correct_list(len_list: int, p: polynome):
if __name__ == "__main__":
l = [115, 117, 101, 118, 122, 116, 57, 108, 32, 224, 62, 116, 115, 140, 32, 108, 153, 83, 169, 117, 108, 112, 32, 110, 101, 55, 96, 61, 160, 218, 228, 156, 224, 203, 12, 75, 180, 23, 220, 211, 137, 139, 206]
# PARAMETRES
# Variables dans reed_solomon.py
INDEX_MAX = 20
ERROR_MAX = 9
MSG_LEN = 25
# Find the correct polynom
reed_solomon = reed_decode(l)
l_ok = correct_list(len(l), reed_solomon)
print(l)
print(l_ok)
print("".join(map(chr, l[:25])))
print("".join(map(chr, l_ok[:25])))
print("Message recu : " + "".join(map(chr, l[:MSG_LEN])))
print("Message décodé : " + "".join(map(chr, l_ok[:MSG_LEN])))
\ No newline at end of file
......@@ -3,6 +3,13 @@ from polynome import *
from inverse_mult import *
from itertools import combinations
# Global Variables
# Parameters
INDEX_MAX = 20
ERROR_MAX = 9
def get_possibilities(l_og: list, index: int):
l = l_og.copy()
# Transforme the list in list of tupples with their indexes
......@@ -43,9 +50,9 @@ def check_nb_error(l: list, p: polynome) -> int:
def reed_decode(l: list) -> polynome:
for points in get_possibilities(l, 20):
for points in get_possibilities(l, INDEX_MAX):
err = check_nb_error(l, lagrange_compute(points))
if ((err) <= 9):
if ((err) <= ERROR_MAX):
# ? Chercher un polynome avec moins de 9 erreurs ?
# Possibilité d'optimiser en evitant de compute 2 fois le poly
return lagrange_compute(points)
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment