66 lines
1.3 KiB
C
66 lines
1.3 KiB
C
|
typedef enum
|
||
|
{
|
||
|
STATE_ready_for_item,
|
||
|
STATE_ready_for_customer,
|
||
|
STATE_scanning,
|
||
|
STATE_finished,
|
||
|
}state;
|
||
|
|
||
|
typedef enum
|
||
|
{
|
||
|
tissues,
|
||
|
pasta,
|
||
|
tomato_sauce,
|
||
|
bread,
|
||
|
butter,
|
||
|
batteries,
|
||
|
toothbrush,
|
||
|
|
||
|
ITEM_TYPE_COUNT,
|
||
|
}item;
|
||
|
|
||
|
item Time[ITEM_TYPE_COUNT];
|
||
|
|
||
|
void initTimeTable()
|
||
|
{
|
||
|
Time[tissues] = 1;
|
||
|
Time[pasta] = 2;
|
||
|
Time[tomato_sauce] = 3;
|
||
|
Time[bread] = 10;
|
||
|
Time[butter] = 2;
|
||
|
Time[batteries] = 2;
|
||
|
Time[toothbrush] = 1;
|
||
|
}
|
||
|
#define CUSTOMER_ITEM_COUNT 5
|
||
|
typedef struct
|
||
|
{
|
||
|
item Items[CUSTOMER_ITEM_COUNT];
|
||
|
int PackingSpeed;
|
||
|
}customer;
|
||
|
|
||
|
customer CustomerQueue[3];
|
||
|
void InitCustomerQueue()
|
||
|
{
|
||
|
CustomerQueue[0].Items[0] = tissues;
|
||
|
CustomerQueue[0].Items[1] = pasta;
|
||
|
CustomerQueue[0].Items[2] = tomato_sauce;
|
||
|
CustomerQueue[0].Items[3] = bread;
|
||
|
CustomerQueue[0].Items[4] = butter;
|
||
|
CustomerQueue[0].PackingSpeed = 2;
|
||
|
|
||
|
CustomerQueue[1].Items[0] = toothbrush;
|
||
|
CustomerQueue[1].Items[1] = batteries;
|
||
|
CustomerQueue[1].Items[2] = bread;
|
||
|
CustomerQueue[1].Items[3] = bread;
|
||
|
CustomerQueue[1].Items[4] = butter;
|
||
|
CustomerQueue[1].PackingSpeed = 3;
|
||
|
|
||
|
CustomerQueue[2].Items[0] = bread;
|
||
|
CustomerQueue[2].Items[1] = batteries;
|
||
|
CustomerQueue[2].Items[2] = tomato_sauce;
|
||
|
CustomerQueue[2].Items[3] = pasta;
|
||
|
CustomerQueue[2].Items[4] = tissues;
|
||
|
CustomerQueue[2].PackingSpeed = 9;
|
||
|
|
||
|
}
|