C two-buckets, 1st running version

This commit is contained in:
2021-09-07 21:46:23 +02:00
parent 07eb95fb58
commit 7b92456167
8 changed files with 699 additions and 0 deletions

27
c/two-bucket/two_bucket.h Normal file
View File

@@ -0,0 +1,27 @@
#ifndef TWO_BUCKET_H
#define TWO_BUCKET_H
#include <stdbool.h>
typedef enum {
BUCKET_ID_1,
BUCKET_ID_2
} bucket_id_t;
typedef unsigned int bucket_liters_t;
typedef struct {
bool possible;
int move_count;
bucket_id_t goal_bucket;
bucket_liters_t other_bucket_liters;
} bucket_result_t;
bucket_result_t measure(bucket_liters_t bucket_1_size,
bucket_liters_t bucket_2_size,
bucket_liters_t goal_volume,
bucket_id_t start_bucket);
#include "br-common.h"
#endif /* TWO_BUCKETS_H */