bulk changes, forgot what ;-)
This commit is contained in:
@@ -4,10 +4,9 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
resistor_band_t color_code(resistor_band_t *colors)
|
resistor_band_t color_code(resistor_band_t colors[static 2])
|
||||||
{
|
{
|
||||||
resistor_band_t c1=*colors, c2=*(colors+1);
|
resistor_band_t c1=*colors, c2=*(colors+1);
|
||||||
|
|
||||||
return c1>=BLACK && c1<=WHITE && c2>=BLACK && c2<=WHITE? c1*10+c2: ERROR;
|
return c1>=BLACK && c1<=WHITE && c2>=BLACK && c2<=WHITE? c1*10+c2: ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -19,7 +18,7 @@ int main(int ac, char **av)
|
|||||||
|
|
||||||
for (; arg<ac-1; ++arg, ++arg) {
|
for (; arg<ac-1; ++arg, ++arg) {
|
||||||
*i=atoi(av[arg]);
|
*i=atoi(av[arg]);
|
||||||
*(i+1)=atoi(av[arg+1]);
|
//*(i+1)=atoi(av[arg+1]);
|
||||||
printf("color(%d, %d)=%d\n", i[0], i[1], color_code(i));
|
printf("color(%d, %d)=%d\n", i[0], i[1], color_code(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -15,7 +15,7 @@ typedef enum {
|
|||||||
ERROR=-1,
|
ERROR=-1,
|
||||||
} resistor_band_t;
|
} resistor_band_t;
|
||||||
|
|
||||||
extern resistor_band_t color_code(resistor_band_t *);
|
extern resistor_band_t color_code(resistor_band_t [static 2]);
|
||||||
|
|
||||||
#ifdef TESTALL
|
#ifdef TESTALL
|
||||||
#undef TEST_IGNORE
|
#undef TEST_IGNORE
|
||||||
|
@@ -20,7 +20,7 @@ int main(int ac, char **av)
|
|||||||
res = measure(b1, b2, goal, start);
|
res = measure(b1, b2, goal, start);
|
||||||
printf(" pos=%d count=%d goal=%d liters=%d\n",
|
printf(" pos=%d count=%d goal=%d liters=%d\n",
|
||||||
res.possible, res.move_count, res.goal_bucket,
|
res.possible, res.move_count, res.goal_bucket,
|
||||||
##res.other_bucket_liters);
|
res.other_bucket_liters);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
#include "two_bucket.h"
|
#include "two_bucket.h"
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
/* We will choose to use a board of (X,Y) squares, with the sizes of the 2
|
/* We will choose to use a board of (X,Y) squares, with the sizes of the 2
|
||||||
|
@@ -22,6 +22,6 @@ bucket_result_t measure(bucket_liters_t bucket_1_size,
|
|||||||
bucket_liters_t goal_volume,
|
bucket_liters_t goal_volume,
|
||||||
bucket_id_t start_bucket);
|
bucket_id_t start_bucket);
|
||||||
|
|
||||||
#include "br-common.h"
|
|
||||||
|
|
||||||
#endif /* TWO_BUCKETS_H */
|
#endif /* TWO_BUCKETS_H */
|
||||||
|
|
||||||
|
#include "br-common.h"
|
||||||
|
@@ -18,10 +18,10 @@
|
|||||||
* The following will return INVALID_WORD:
|
* The following will return INVALID_WORD:
|
||||||
* P2P
|
* P2P
|
||||||
* 0xFF
|
* 0xFF
|
||||||
* A'2
|
* A''B
|
||||||
* The following will return 2 numbers/words:
|
* The following will return 2 numbers/words:
|
||||||
* 1'2
|
* 1'2
|
||||||
* A''B
|
* A'2
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* get next word in string
|
/* get next word in string
|
||||||
|
Reference in New Issue
Block a user