view dpp_common.h @ 6:4a68716b7488

Fix tableau
author Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
date Fri, 25 Dec 2015 18:19:55 +0900
parents a04eccfc69ae
children a15437a1e94c
line wrap: on
line source

#ifndef _DPP_COMMON_H_
#define _DPP_COMMON_H_

#include<stdio.h>
#include<stdlib.h>

enum Action {
    PutDownLeftFork,
    PutDownRightFork,
    Eating,
    WaitLeftFork,
    WaitRightFork,
    PickUpLeftFork,
    PickUpRightFork,
    Thinking,
};

typedef struct phils {
    int id;
    struct fork *right_fork;
    struct fork *left_fork;
    struct phils *right;
    struct phils *left;
    enum Action next;
} Phils, *PhilsPtr;

typedef struct fork {
    int id;
    struct phils *owner;
} Fork, *ForkPtr;

typedef struct task {
    struct task *next;
    struct phils *phils;
} Task, *TaskPtr;

#endif