From 861621b9bdbdc7336183597b3ffd4ee161be19f3 Mon Sep 17 00:00:00 2001 From: Charles Cabergs Date: Sun, 27 Sep 2020 13:28:36 +0200 Subject: Initial commit --- src/test/table.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/test/table.py (limited to 'src/test/table.py') diff --git a/src/test/table.py b/src/test/table.py new file mode 100644 index 0000000..6aa1b15 --- /dev/null +++ b/src/test/table.py @@ -0,0 +1,23 @@ +# ############################################################################ # +# # +# ::: :::::::: # +# table.py :+: :+: :+: # +# +:+ +:+ +:+ # +# By: charles +#+ +:+ +#+ # +# +#+#+#+#+#+ +#+ # +# Created: 2020/09/27 12:44:48 by charles #+# #+# # +# Updated: 2020/09/27 12:54:01 by charles ### ########.fr # +# # +# ############################################################################ # + +class Table: + def __init__(self, philo_num): + self._philos = [Philo(id_) for id_ in range(1, philo_num + 1)] + + def update(self, match): + philo = itertools.first_true(self._philos, pred = lambda x: x.id == match.id) + philo.add_log(match) + + def check(self): + return True + -- cgit