diff --git a/.vscode/targets.log b/.vscode/targets.log index f9b0452..e99b150 100644 --- a/.vscode/targets.log +++ b/.vscode/targets.log @@ -8,7 +8,7 @@ make all --print-data-base --no-builtin-variables --no-builtin-rules --question # This program built for i386-apple-darwin11.3.0 -# Make data base, printed on Wed May 12 17:25:51 2021 +# Make data base, printed on Thu May 13 12:04:43 2021 # Variables @@ -16,6 +16,9 @@ make all --print-data-base --no-builtin-variables --no-builtin-rules --question data_philo->philors[i].left_fork = all->number_of_philosophers; - all->data_philo->philors[i].right_fork = 0; + all->data_philo->philors[i].more_fork = all->number_of_philosophers; + all->data_philo->philors[i].less_fork = 0; } else { - all->data_philo->philors[i].left_fork = i; - all->data_philo->philors[i].right_fork = i + 1; + all->data_philo->philors[i].more_fork = return_big(i, i + 1); + all->data_philo->philors[i].less_fork = return_less(i, i + 1); } i++; } @@ -73,12 +73,23 @@ int prepare_resources(t_all *all) return (0); } +void run_all_philor(t_all *all) +{ + +} + +// void run_observer(t_all *all) +// { + +// } + int runner(t_all *all, int optional) { if (optional) { - // func_test(all); prepare_resources(all); + run_all_philor(all); + // run_observer(all); return(0); } else diff --git a/philo_one/srcs/utilc.c b/philo_one/srcs/utilc.c index 45eb288..80c3779 100644 --- a/philo_one/srcs/utilc.c +++ b/philo_one/srcs/utilc.c @@ -68,3 +68,21 @@ t_all *structalloc_and_bzero(void) all->number_of_times_each_philosopher_must_eat = -1; return(all); } + +int return_big(int a, int b) +{ + if (a > b) + { + return (a); + } + return (b); +} + +int return_less(int a, int b) +{ + if (a < b) + { + return (a); + } + return (b); +}