EM/0000700010252200001470000000000011327543250011217 5ustar cspjamdcsotherEM/Doste_Version/0000700010252200001470000000000011327543207014004 5ustar cspjamdcsotherEM/Doste_Version/DosteEdenConnection.e~0000600010252200001470000000377611326712406020257 0ustar cspjamdcsother%dasm ## output @root eden base chop1 is {@philosopher chop1}; @root eden base chop2 is {@philosopher chop2}; @root eden base chop3 is {@philosopher chop3}; @root eden base chop4 is {@philosopher chop4}; @root eden base statusColorA is {if(@philosopher statusIsEating_A){"green"} else if(@philosopher statusIsThinking_A){"yellow"} else {"red"}}; @root eden base statusColorB is {if(@philosopher statusIsEating_B){"green"} else if(@philosopher statusIsThinking_B){"yellow"} else {"red"}}; @root eden base statusColorC is {if(@philosopher statusIsEating_C){"green"} else if(@philosopher statusIsThinking_C){"yellow"} else {"red"}}; @root eden base statusColorD is {if(@philosopher statusIsEating_D){"green"} else if(@philosopher statusIsThinking_D){"yellow"} else {"red"}}; @root eden base doorStatus is {@philosopher doorStatus}; ## input @philosopher clickTry_A is {if(@root eden base actionTry_A > 0)true else false}; @philosopher clickStop_A is {if(@root eden base actionStop_A > 0)true else false}; @philosopher clickTry_B is {if(@root eden base actionTry_B > 0)true else false}; @philosopher clickStop_B is {if(@root eden base actionStop_B > 0)true else false}; @philosopher clickTry_C is {if(@root eden base actionTry_C > 0)true else false}; @philosopher clickStop_C is {if(@root eden base actionStop_C > 0)true else false}; @philosopher clickTry_D is {if(@root eden base actionTry_D > 0)true else false}; @philosopher clickStop_D is {if(@root eden base actionStop_D > 0)true else false}; @philosopher clickMachine_1 is {if(@root eden base actionMachine_1 > 0)true else false}; EM/Doste_Version/loadingDasm.e~0000600010252200001470000000014511327320222016562 0ustar cspjamdcsother%dasm @root notations dasm run=(new type=LocalFile filename="EM/Doste_Version/TestingPD8.dasm"); EM/Doste_Version/TriggerToDoste.e0000600010252200001470000000461311326713466017072 0ustar cspjamdcsother%eden MOUSE_BUTTON_PRESSED=4; MOUSE_BUTTON_RELEASED=5; actionTry_A=0; actionStop_A=0; actionTry_B=0; actionStop_B=0; actionTry_C=0; actionStop_C=0; actionTry_D=0; actionStop_D=0; actionMachine_1=0; actionMachine_2=0; actionMachine_3=0; actionMachine_4=0; ## triggers to 4 philosophers proc buttonA_Trigger:buttonA_mouse_1{ if(buttonA_mouse_1[2]==MOUSE_BUTTON_PRESSED && statusColorA=="yellow") {actionTry_A=1;} if(buttonA_mouse_1[2]==MOUSE_BUTTON_PRESSED && statusColorA=="green") {actionStop_A=1;} if(buttonA_mouse_1[2]==MOUSE_BUTTON_RELEASED){ actionTry_A=0; actionStop_A=0; } } proc buttonB_Trigger:buttonB_mouse_1{ if(buttonB_mouse_1[2]==MOUSE_BUTTON_PRESSED && statusColorB=="yellow") {actionTry_B=1;} if(buttonB_mouse_1[2]==MOUSE_BUTTON_PRESSED && statusColorB=="green") {actionStop_B=1;} if(buttonB_mouse_1[2]==MOUSE_BUTTON_RELEASED){ actionTry_B=0; actionStop_B=0; } } proc buttonC_Trigger:buttonC_mouse_1{ if(buttonC_mouse_1[2]==MOUSE_BUTTON_PRESSED && statusColorC=="yellow") {actionTry_C=1;} if(buttonC_mouse_1[2]==MOUSE_BUTTON_PRESSED && statusColorC=="green") {actionStop_C=1;} if(buttonC_mouse_1[2]==MOUSE_BUTTON_RELEASED){ actionTry_C=0; actionStop_C=0; } } proc buttonD_Trigger:buttonD_mouse_1{ if(buttonD_mouse_1[2]==MOUSE_BUTTON_PRESSED && statusColorD=="yellow") {actionTry_D=1;} if(buttonD_mouse_1[2]==MOUSE_BUTTON_PRESSED && statusColorD=="green") {actionStop_D=1;} if(buttonD_mouse_1[2]==MOUSE_BUTTON_RELEASED){ actionTry_D=0; actionStop_D=0; } } ## triggers to 4 chopstick machines proc machine1_Trigger:machine1_mouse_1{ if(machine1_mouse_1[2]==MOUSE_BUTTON_PRESSED) {actionMachine_1=1;} if(machine1_mouse_1[2]==MOUSE_BUTTON_RELEASED) {actionMachine_1=0;} } proc machine2_Trigger:machine2_mouse_1{ if(machine2_mouse_1[2]==MOUSE_BUTTON_PRESSED) {actionMachine_2=1;} if(machine2_mouse_1[2]==MOUSE_BUTTON_RELEASED) {actionMachine_2=0;} } proc machine3_Trigger:machine3_mouse_1{ if(machine3_mouse_1[2]==MOUSE_BUTTON_PRESSED) {actionMachine_3=1;} if(machine3_mouse_1[2]==MOUSE_BUTTON_RELEASED) {actionMachine_3=0;} } proc machine4_Trigger:machine4_mouse_1{ if(machine4_mouse_1[2]==MOUSE_BUTTON_PRESSED) {actionMachine_4=1;} if(machine4_mouse_1[2]==MOUSE_BUTTON_RELEASED) {actionMachine_4=0;} } EM/Doste_Version/TriggerToDoste.e~0000600010252200001470000000452211326713370017261 0ustar cspjamdcsother%eden MOUSE_BUTTON_PRESSED=4; MOUSE_BUTTON_RELEASED=5; actionTry_A=0; actionStop_A=0; actionTry_B=0; actionStop_B=0; actionTry_C=0; actionStop_C=0; actionTry_D=0; actionStop_D=0; actionMachine_1=0; ## triggers to 4 philosophers proc buttonA_Trigger:buttonA_mouse_1{ if(buttonA_mouse_1[2]==MOUSE_BUTTON_PRESSED && statusColorA=="yellow") {actionTry_A=1;} if(buttonA_mouse_1[2]==MOUSE_BUTTON_PRESSED && statusColorA=="green") {actionStop_A=1;} if(buttonA_mouse_1[2]==MOUSE_BUTTON_RELEASED){ actionTry_A=0; actionStop_A=0; } } proc buttonB_Trigger:buttonB_mouse_1{ if(buttonB_mouse_1[2]==MOUSE_BUTTON_PRESSED && statusColorB=="yellow") {actionTry_B=1;} if(buttonB_mouse_1[2]==MOUSE_BUTTON_PRESSED && statusColorB=="green") {actionStop_B=1;} if(buttonB_mouse_1[2]==MOUSE_BUTTON_RELEASED){ actionTry_B=0; actionStop_B=0; } } proc buttonC_Trigger:buttonC_mouse_1{ if(buttonC_mouse_1[2]==MOUSE_BUTTON_PRESSED && statusColorC=="yellow") {actionTry_C=1;} if(buttonC_mouse_1[2]==MOUSE_BUTTON_PRESSED && statusColorC=="green") {actionStop_C=1;} if(buttonC_mouse_1[2]==MOUSE_BUTTON_RELEASED){ actionTry_C=0; actionStop_C=0; } } proc buttonD_Trigger:buttonD_mouse_1{ if(buttonD_mouse_1[2]==MOUSE_BUTTON_PRESSED && statusColorD=="yellow") {actionTry_D=1;} if(buttonD_mouse_1[2]==MOUSE_BUTTON_PRESSED && statusColorD=="green") {actionStop_D=1;} if(buttonD_mouse_1[2]==MOUSE_BUTTON_RELEASED){ actionTry_D=0; actionStop_D=0; } } ## triggers to 4 chopstick machines proc machine1_Trigger:machine1_mouse_1{ if(machine1_mouse_1[2]==MOUSE_BUTTON_PRESSED) {actionMachine_1=1;} if(machine1_mouse_1[2]==MOUSE_BUTTON_RELEASED) {actionMachine_1=0;} } proc machine2_Trigger:machine2_mouse_1{ if(machine2_mouse_1[2]==MOUSE_BUTTON_PRESSED) {actionMachine_2=1;} if(machine2_mouse_1[2]==MOUSE_BUTTON_RELEASED) {actionMachine_2=0;} } proc machine3_Trigger:machine3_mouse_1{ if(machine3_mouse_1[2]==MOUSE_BUTTON_PRESSED) {actionMachine_3=1;} if(machine3_mouse_1[2]==MOUSE_BUTTON_RELEASED) {actionMachine_3=0;} } proc machine4_Trigger:machine4_mouse_1{ if(machine4_mouse_1[2]==MOUSE_BUTTON_PRESSED) {actionMachine_4=1;} if(machine4_mouse_1[2]==MOUSE_BUTTON_RELEASED) {actionMachine_4=0;} } EM/Doste_Version/runInDoste.e0000600010252200001470000000013511326721654016250 0ustar cspjamdcsother %eden include("../layout.e"); include("TriggerToDoste.e"); include("DosteEdenConnection.e");EM/Doste_Version/loadingDasm.e0000600010252200001470000000014011327320642016365 0ustar cspjamdcsother%dasm @root notations dasm run=(new type=LocalFile filename="EM/Doste_Version/Logic.dasm"); EM/Doste_Version/runInDoste.e~0000600010252200001470000000013211326716714016444 0ustar cspjamdcsother %eden include("layout.e"); include("TriggerToDoste.e"); include("DosteEdenConnection.e");EM/Doste_Version/Logic.dasm0000600010252200001470000001550511327535355015724 0ustar cspjamdcsother##%dasm @philosopher=(new); @philosopher ## A :initStatus is not eating, statusEating depends on successful in trying to eat and NOT been stoped A=( new statusIsEating=false statusIsEating is { if(@philosopher stop_A not){ if(@philosopher try_A) true else{.statusIsEating} } else false } ) B=( new statusIsEating=false statusIsEating is { if(@philosopher stop_B not){ if(@philosopher try_B) true else{.statusIsEating} } else false } ) C=( new statusIsEating=false statusIsEating is { if(@philosopher stop_C not){ if(@philosopher try_C) true else{.statusIsEating} } else false } ) D=( new statusIsEating=false statusIsEating is { if(@philosopher stop_D not){ if(@philosopher try_D) true else{.statusIsEating} } else false } ) clickTry_A=false ##change it back to false afterwards clickTry_B=false clickTry_C=false clickTry_D=false clickStop_A=false ##change it back to false afterwards clickStop_B=false clickStop_C=false clickStop_D=false chop_1=true chop_2=true chop_3=true chop_4=true ## successful in trying to eat, precondition is two chopsticks are ready. try_A is { if(.chop_1 and (.chop_2)){ if(.clickTry_A) {true} else {false} } else false } try_B is { if(.chop_2 and (.chop_3)){ if(.clickTry_B) {true} else {false} } else false } try_C is { if(.chop_3 and (.chop_4)){ if(.clickTry_C) {true} else {false} } else false } try_D is { if(.chop_4 and (.chop_1)){ if(.clickTry_D) {true} else {false} } else false } ## StopActions, if statusIs Eating, one click could make him stop stop_A is { if(.A statusIsEating and (.clickStop_A)) true else false} stop_B is { if(.B statusIsEating and (.clickStop_B)) true else false} stop_C is { if(.C statusIsEating and (.clickStop_C)) true else false} stop_D is { if(.D statusIsEating and (.clickStop_D)) true else false} ## chopstick and chopstick_machine clickMachine_1=false isMachineOn_1=false ##before A or D successfully try to eat action,click machine can make sure there will be a chopstick at the corresponding place. isMachineOn_1 is { if(.clickMachine_1 and (.try_A not) and (.try_D not)) true else if(.try_A or (.try_D)) false else {.isMachineOn_1} } Machine_1 is { if (.isMachineOn_1 and (.chop_1 not)) {.chop_1 not} else false} watcher_1=false watcher_1 is { if(.clickStop_A or (.clickStop_D)) true else if(.try_A or (.try_D)) false else {.watcher_1} } w_1 is {.D statusIsEating or(.A statusIsEating)} ##chop_1 depends on first if there is any machine_1 clicking, chop_1 is true; if not,at that instant, A or D eating and no one (A or D) take the stopEating action. chop_1 will be false. chop_1 is { if(.Machine_1 not and (.isMachineOn_1 not)){ if(.w_1 and (.watcher_1 not)) false else true} else true } ## clickMachine_2=false isMachineOn_2=false isMachineOn_2 is { if(.clickMachine_2 and (.try_B not) and (.try_A not)) true else if(.try_B or (.try_A)) false else {.isMachineOn_2} } Machine_2 is { if (.isMachineOn_2 and (.chop_2 not)) {.chop_2 not} else false} watcher_2=false watcher_2 is { if(.clickStop_B or (.clickStop_A)) true else if(.try_B or (.try_A)) false else {.watcher_2} } w_2 is {.A statusIsEating or(.B statusIsEating)} chop_2 is { if(.Machine_2 not and (.isMachineOn_2 not)){ if(.w_2 and (.watcher_2 not)) false else true} else true } ## clickMachine_3=false isMachineOn_3=false isMachineOn_3 is { if(.clickMachine_3 and (.try_C not) and (.try_B not)) true else if(.try_C or (.try_B)) false else {.isMachineOn_3} } Machine_3 is { if (.isMachineOn_3 and (.chop_3 not)) {.chop_3 not} else false} watcher_3=false watcher_3 is { if(.clickStop_C or (.clickStop_B)) true else if(.try_C or (.try_B)) false else {.watcher_3} } w_3 is {.B statusIsEating or(.C statusIsEating)} chop_3 is { if(.Machine_3 not and (.isMachineOn_3 not)){ if(.w_3 and (.watcher_3 not)) false else true} else true } ## clickMachine_4=false isMachineOn_4=false isMachineOn_4 is { if(.clickMachine_4 and (.try_C not) and (.try_D not)) true else if(.try_C or (.try_D)) false else {.isMachineOn_4} } Machine_4 is { if (.isMachineOn_4 and (.chop_4 not)) {.chop_4 not} else false} watcher_4=false watcher_4 is { if(.clickStop_C or (.clickStop_D)) true else if(.try_C or (.try_D)) false else {.watcher_4} } w_4 is {.D statusIsEating or(.C statusIsEating)} chop_4 is { if(.Machine_4 not and (.isMachineOn_4 not)){ if(.w_4 and (.watcher_4 not)) false else true} else true } isStatusSame is {if(.statusIsThinking_A and(.statusIsThinking_B) and (.statusIsThinking_C) and (.statusIsThinking_D))0 else if(.statusIsEating_A and (.statusIsEating_B) and (.statusIsEating_C) and (.statusIsEating_D))0 else 1} ## ,when 0, door will shut, in this case there is no chance 4 people waiting at the same time to make door shut. ## input ## output to connect to eden chop1 is {if(.chop_1)1 else 0} chop2 is {if(.chop_2)1 else 0} chop3 is {if(.chop_3)1 else 0} chop4 is {if(.chop_4)1 else 0} statusIsEating_A is {.A statusIsEating} statusIsEating_B is {.B statusIsEating} statusIsEating_C is {.C statusIsEating} statusIsEating_D is {.D statusIsEating} doorStatus is {.isStatusSame} statusIsThinking_A is {if(.statusIsEating_A not and (.chop_1) and (.chop_2)) true else false} statusIsThinking_B is {if(.statusIsEating_B not and (.chop_2) and (.chop_3)) true else false} statusIsThinking_C is {if(.statusIsEating_C not and (.chop_3) and (.chop_4)) true else false} statusIsThinking_D is {if(.statusIsEating_D not and (.chop_4) and (.chop_1)) true else false} statusIsWaiting_A is {if(.statusIsEating_A or (.statusIsThinking_A)) false else true} statusIsWaiting_B is {if(.statusIsEating_B or (.statusIsThinking_B)) false else true} statusIsWaiting_C is {if(.statusIsEating_C or (.statusIsThinking_C)) false else true} statusIsWaiting_D is {if(.statusIsEating_D or (.statusIsThinking_D)) false else true} ; EM/Doste_Version/DosteEdenConnection.e0000600010252200001470000000455711327526430020060 0ustar cspjamdcsother%dasm ## output to Eden GUI from Doste Unit @root eden base chop1 is {@philosopher chop1}; @root eden base chop2 is {@philosopher chop2}; @root eden base chop3 is {@philosopher chop3}; @root eden base chop4 is {@philosopher chop4}; @root eden base statusColorA is {if(@philosopher statusIsEating_A){"green"} else if(@philosopher statusIsThinking_A){"yellow"} else {"red"}}; @root eden base statusColorB is {if(@philosopher statusIsEating_B){"green"} else if(@philosopher statusIsThinking_B){"yellow"} else {"red"}}; @root eden base statusColorC is {if(@philosopher statusIsEating_C){"green"} else if(@philosopher statusIsThinking_C){"yellow"} else {"red"}}; @root eden base statusColorD is {if(@philosopher statusIsEating_D){"green"} else if(@philosopher statusIsThinking_D){"yellow"} else {"red"}}; @root eden base doorStatus is {@philosopher doorStatus}; ## input from Eden GUI to Doste Unit @philosopher clickTry_A is {if(@root eden base actionTry_A > 0)true else false}; @philosopher clickStop_A is {if(@root eden base actionStop_A > 0)true else false}; @philosopher clickTry_B is {if(@root eden base actionTry_B > 0)true else false}; @philosopher clickStop_B is {if(@root eden base actionStop_B > 0)true else false}; @philosopher clickTry_C is {if(@root eden base actionTry_C > 0)true else false}; @philosopher clickStop_C is {if(@root eden base actionStop_C > 0)true else false}; @philosopher clickTry_D is {if(@root eden base actionTry_D > 0)true else false}; @philosopher clickStop_D is {if(@root eden base actionStop_D > 0)true else false}; @philosopher clickMachine_1 is {if(@root eden base actionMachine_1 > 0)true else false}; @philosopher clickMachine_2 is {if(@root eden base actionMachine_2 > 0)true else false}; @philosopher clickMachine_3 is {if(@root eden base actionMachine_3 > 0)true else false}; @philosopher clickMachine_4 is {if(@root eden base actionMachine_4 > 0)true else false}; EM/Doste_Version/Logic.dasm~0000600010252200001470000001551511327526260016116 0ustar cspjamdcsother##%dasm @philosopher=(new); @philosopher ## A :initStatus is not eating, statusEating depends on successful in trying to eat and NOT been stoped A=( new statusIsEating=false statusIsEating is { if(@philosopher stop_A not){ if(@philosopher try_A) true else{.statusIsEating} } else false } ) B=( new statusIsEating=false statusIsEating is { if(@philosopher stop_B not){ if(@philosopher try_B) true else{.statusIsEating} } else false } ) C=( new statusIsEating=false statusIsEating is { if(@philosopher stop_C not){ if(@philosopher try_C) true else{.statusIsEating} } else false } ) D=( new statusIsEating=false statusIsEating is { if(@philosopher stop_D not){ if(@philosopher try_D) true else{.statusIsEating} } else false } ) clickTry_A=false ##change it back to false afterwards clickTry_B=false clickTry_C=false clickTry_D=false clickStop_A=false ##change it back to false afterwards clickStop_B=false clickStop_C=false clickStop_D=false chop_1=true chop_2=true chop_3=true chop_4=true ## successful in trying to eat, precondition is two chopsticks are ready. try_A is { if(.chop_1 and (.chop_2)){ if(.clickTry_A) {true} else {false} } else false } try_B is { if(.chop_2 and (.chop_3)){ if(.clickTry_B) {true} else {false} } else false } try_C is { if(.chop_3 and (.chop_4)){ if(.clickTry_C) {true} else {false} } else false } try_D is { if(.chop_4 and (.chop_1)){ if(.clickTry_D) {true} else {false} } else false } ## StopActions, if statusIs Eating, one click could make him stop stop_A is { if(.A statusIsEating and (.clickStop_A)) true else false} stop_B is { if(.B statusIsEating and (.clickStop_B)) true else false} stop_C is { if(.C statusIsEating and (.clickStop_C)) true else false} stop_D is { if(.D statusIsEating and (.clickStop_D)) true else false} ## chopstick and chopstick_machine clickMachine_1=false isMachineOn_1=false /*before A or D successfully try to eat action,click machine can make sure there will be a chopstick at the corresponding place. */ isMachineOn_1 is { if(.clickMachine_1 and (.try_A not) and (.try_D not)) true else if(.try_A or (.try_D)) false else {.isMachineOn_1} } Machine_1 is { if (.isMachineOn_1 and (.chop_1 not)) {.chop_1 not} else false} watcher_1=false watcher_1 is { if(.clickStop_A or (.clickStop_D)) true else if(.try_A or (.try_D)) false else {.watcher_1} } w_1 is {.D statusIsEating or(.A statusIsEating)} /* chop_1 depends on first if there is any machine_1 clicking, chop_1 is true; if not,at that instant, A or D eating and no one (A or D) take the stopEating action. chop_1 will be false. */ chop_1 is { if(.Machine_1 not and (.isMachineOn_1 not)){ if(.w_1 and (.watcher_1 not)) false else true} else true } ## clickMachine_2=false isMachineOn_2=false isMachineOn_2 is { if(.clickMachine_2 and (.try_B not) and (.try_A not)) true else if(.try_B or (.try_A)) false else {.isMachineOn_2} } Machine_2 is { if (.isMachineOn_2 and (.chop_2 not)) {.chop_2 not} else false} watcher_2=false watcher_2 is { if(.clickStop_B or (.clickStop_A)) true else if(.try_B or (.try_A)) false else {.watcher_2} } w_2 is {.A statusIsEating or(.B statusIsEating)} chop_2 is { if(.Machine_2 not and (.isMachineOn_2 not)){ if(.w_2 and (.watcher_2 not)) false else true} else true } ## clickMachine_3=false isMachineOn_3=false isMachineOn_3 is { if(.clickMachine_3 and (.try_C not) and (.try_B not)) true else if(.try_C or (.try_B)) false else {.isMachineOn_3} } Machine_3 is { if (.isMachineOn_3 and (.chop_3 not)) {.chop_3 not} else false} watcher_3=false watcher_3 is { if(.clickStop_C or (.clickStop_B)) true else if(.try_C or (.try_B)) false else {.watcher_3} } w_3 is {.B statusIsEating or(.C statusIsEating)} chop_3 is { if(.Machine_3 not and (.isMachineOn_3 not)){ if(.w_3 and (.watcher_3 not)) false else true} else true } ## clickMachine_4=false isMachineOn_4=false isMachineOn_4 is { if(.clickMachine_4 and (.try_C not) and (.try_D not)) true else if(.try_C or (.try_D)) false else {.isMachineOn_4} } Machine_4 is { if (.isMachineOn_4 and (.chop_4 not)) {.chop_4 not} else false} watcher_4=false watcher_4 is { if(.clickStop_C or (.clickStop_D)) true else if(.try_C or (.try_D)) false else {.watcher_4} } w_4 is {.D statusIsEating or(.C statusIsEating)} chop_4 is { if(.Machine_4 not and (.isMachineOn_4 not)){ if(.w_4 and (.watcher_4 not)) false else true} else true } isStatusSame is {if(.statusIsThinking_A and(.statusIsThinking_B) and (.statusIsThinking_C) and (.statusIsThinking_D))0 else if(.statusIsEating_A and (.statusIsEating_B) and (.statusIsEating_C) and (.statusIsEating_D))0 else 1} ## ,when 0, door will shut, in this case there is no chance 4 people waiting at the same time to make door shut. ## input ## output to connect to eden chop1 is {if(.chop_1)1 else 0} chop2 is {if(.chop_2)1 else 0} chop3 is {if(.chop_3)1 else 0} chop4 is {if(.chop_4)1 else 0} statusIsEating_A is {.A statusIsEating} statusIsEating_B is {.B statusIsEating} statusIsEating_C is {.C statusIsEating} statusIsEating_D is {.D statusIsEating} doorStatus is {.isStatusSame} statusIsThinking_A is {if(.statusIsEating_A not and (.chop_1) and (.chop_2)) true else false} statusIsThinking_B is {if(.statusIsEating_B not and (.chop_2) and (.chop_3)) true else false} statusIsThinking_C is {if(.statusIsEating_C not and (.chop_3) and (.chop_4)) true else false} statusIsThinking_D is {if(.statusIsEating_D not and (.chop_4) and (.chop_1)) true else false} statusIsWaiting_A is {if(.statusIsEating_A or (.statusIsThinking_A)) false else true} statusIsWaiting_B is {if(.statusIsEating_B or (.statusIsThinking_B)) false else true} statusIsWaiting_C is {if(.statusIsEating_C or (.statusIsThinking_C)) false else true} statusIsWaiting_D is {if(.statusIsEating_D or (.statusIsThinking_D)) false else true} ; EM/Eden_Version/0000700010252200001470000000000011326721454013602 5ustar cspjamdcsotherEM/Eden_Version/EdenVersion.e0000600010252200001470000002005211326720176016172 0ustar cspjamdcsother %eden statusIsEatingA=0; statusIsEatingB=0; statusIsEatingC=0; statusIsEatingD=0; ## input1 clickTry_A=0; clickTry_B=0; clickTry_C=0; clickTry_D=0; TryA=0; TryB=0; TryC=0; TryD=0; ## input2 clickStop_A=0; clickStop_B=0; clickStop_C=0; clickStop_D=0; stopA=0; stopB=0; stopC=0; stopD=0; proc statusIsEating_A:stopA,tryA { if(stopA==0){ if(tryA==1) {statusIsEatingA=1; chop1=0; chop2=0; } }else {statusIsEatingA=0; chop1=1; chop2=1; } } proc statusIsEating_B:stopB,tryB { if(stopB==0){ if(tryB==1) {statusIsEatingB=1; chop2=0; chop3=0; } }else {statusIsEatingB=0; chop2=1; chop3=1; } } proc statusIsEating_C:stopC,tryC { if(stopC==0){ if(tryC==1) {statusIsEatingC=1; chop3=0; chop4=0; } }else {statusIsEatingC=0; chop3=1; chop4=1; } } proc statusIsEating_D:stopD,tryD { if(stopD==0){ if(tryD==1) {statusIsEatingD=1; chop4=0; chop1=0; } }else {statusIsEatingD=0; chop4=1; chop1=1; } } proc try_A:chop1,chop2,clickTry_A { if(chop1==1 and chop2==1) { if(clickTry_A==1) {tryA=1;} else {tryA=0;} }else{tryA=0;} } proc try_B:chop2,chop3,clickTry_B { if(chop2==1 and chop3==1) { if(clickTry_B==1) {tryB=1;} else {tryB=0;} }else{tryB=0;} } proc try_C:chop3,chop4,clickTry_C { if(chop3==1 and chop4==1) { if(clickTry_C==1) {tryC=1;} else {tryC=0;} }else{tryC=0;} } proc try_D:chop4,chop1,clickTry_D { if(chop4==1 and chop1==1) { if(clickTry_D==1) {tryD=1;} else {tryD=0;} }else{tryD=0;} } proc stop_A:statusIsEatingA,clickStop_A { if(statusIsEatingA==1 and clickStop_A==1){stopA=1;} else {stopA=0;} } proc stop_B:statusIsEatingB,clickStop_B { if(statusIsEatingB==1 and clickStop_B==1){stopB=1;} else {stopB=0;} } proc stop_C:statusIsEatingC,clickStop_C { if(statusIsEatingC==1 and clickStop_C==1){stopC=1;} else {stopC=0;} } proc stop_D:statusIsEatingD,clickStop_D { if(statusIsEatingD==1 and clickStop_D==1){stopD=1;} else {stopD=0;} } ### setting button triggers #### %eden MOUSE_BUTTON_PRESSED=4; MOUSE_BUTTON_RELEASED=5; statusA=0; statusB=0; statusC=0; statusD=0; proc buttonA_Trigger:buttonA_mouse_1{ if(buttonA_mouse_1[2]==MOUSE_BUTTON_PRESSED){ if(statusIsEatingA==1){ clickStop_A=1; stop_A(); statusIsEating_A(); clickStop_A=0; }else{ clickTry_A=1; try_A(); statusIsEating_A(); clickTry_A=0; } } if (buttonA_mouse_1[2]==MOUSE_BUTTON_RELEASED){ statusTellingA(); statusShowingA(); statusTellingD(); statusShowingD(); statusTellingB(); statusShowingB(); } } proc buttonB_Trigger:buttonB_mouse_1{ if(buttonB_mouse_1[2]==MOUSE_BUTTON_PRESSED){ if(statusIsEatingB==1){ clickStop_B=1; stop_B(); statusIsEating_B(); clickStop_B=0; }else{ clickTry_B=1; try_B(); statusIsEating_B(); clickTry_B=0; } } if (buttonB_mouse_1[2]==MOUSE_BUTTON_RELEASED){ statusTellingB(); statusShowingB(); statusTellingA(); statusShowingA(); statusTellingC(); statusShowingC(); } } proc buttonC_Trigger:buttonC_mouse_1{ if(buttonC_mouse_1[2]==MOUSE_BUTTON_PRESSED){ if(statusIsEatingC==1){ clickStop_C=1; stop_C(); statusIsEating_C(); clickStop_C=0; }else{ clickTry_C=1; try_C(); statusIsEating_C(); clickTry_C=0; } } if (buttonC_mouse_1[2]==MOUSE_BUTTON_RELEASED){ statusTellingC(); statusShowingC(); statusTellingB(); statusShowingB(); statusTellingD(); statusShowingD(); } } proc buttonD_Trigger:buttonD_mouse_1{ if(buttonD_mouse_1[2]==MOUSE_BUTTON_PRESSED){ if(statusIsEatingD==1){ clickStop_D=1; stop_D(); statusIsEating_D(); clickStop_D=0; }else{ clickTry_D=1; try_D(); statusIsEating_D(); clickTry_D=0; } } if (buttonD_mouse_1[2]==MOUSE_BUTTON_RELEASED){ statusTellingD(); statusShowingD(); statusTellingA(); statusShowingA(); statusTellingC(); statusShowingC(); } } proc machine1_Trigger:machine1_mouse_1{ if(machine1_mouse_1[2]==MOUSE_BUTTON_PRESSED){ if(chop1==0) chop1=1; } if (machine1_mouse_1[2]==MOUSE_BUTTON_RELEASED){ statusTellingD(); statusShowingD(); statusTellingA(); statusShowingA(); } } proc machine2_Trigger:machine2_mouse_1{ if(machine2_mouse_1[2]==MOUSE_BUTTON_PRESSED){ if(chop2==0) chop2=1; } if (machine2_mouse_1[2]==MOUSE_BUTTON_RELEASED){ statusTellingA(); statusShowingA(); statusTellingB(); statusShowingB(); } } proc machine3_Trigger:machine3_mouse_1{ if(machine3_mouse_1[2]==MOUSE_BUTTON_PRESSED){ if(chop3==0) chop3=1; } if (machine3_mouse_1[2]==MOUSE_BUTTON_RELEASED){ statusTellingB(); statusShowingB(); statusTellingC(); statusShowingC(); } } proc machine4_Trigger:machine4_mouse_1{ if(machine4_mouse_1[2]==MOUSE_BUTTON_PRESSED){ if(chop4==0) chop4=1; } if (machine4_mouse_1[2]==MOUSE_BUTTON_RELEASED){ statusTellingC(); statusShowingC(); statusTellingD(); statusShowingD(); } } ## proc statusShowingA: statusA{ if(statusA==0){ statusColorA="yellow";} else if(statusA==1){statusColorA="red";} else{ statusColorA="green";} } proc statusTellingA: statusIsEatingA { if(statusIsEatingA==1){statusA=2;} else if(chop1==1 and chop2==1){statusA=0;} else{statusA=1;} } ## proc statusShowingB: statusB{ if(statusB==0){ statusColorB="yellow";} else if(statusB==1){statusColorB="red";} else{ statusColorB="green";} } proc statusTellingB: statusIsEatingB { if(statusIsEatingB==1){statusB=2;} else if(chop2==1 and chop3==1){statusB=0;} else{statusB=1;} } ## proc statusShowingC: statusC{ if(statusC==0){ statusColorC="yellow";} else if(statusC==1){statusColorC="red";} else{ statusColorC="green";} } proc statusTellingC: statusIsEatingC { if(statusIsEatingC==1){statusC=2;} else if(chop3==1 and chop4==1){statusC=0;} else{statusC=1;} } ## proc statusShowingD: statusD{ if(statusD==0){ statusColorD="yellow";} else if(statusD==1){statusColorD="red";} else{ statusColorD="green";} } proc statusTellingD: statusIsEatingD { if(statusIsEatingD==1){statusD=2;} else if(chop4==1 and chop1==1){statusD=0;} else{statusD=1;} } ## statusAllPhilosophers is (statusA+statusB+statusC+statusD); proc Door:statusAllPhilosophers{ if(statusAllPhilosophers==0 or statusAllPhilosophers==8) {doorStatus=0;} else {doorStatus=1;} } EM/Eden_Version/EdenVersion.e~0000600010252200001470000002027511326717610016376 0ustar cspjamdcsother %eden statusIsEatingA=0; statusIsEatingB=0; statusIsEatingC=0; statusIsEatingD=0; ## input1 clickTry_A=0; clickTry_B=0; clickTry_C=0; clickTry_D=0; TryA=0; TryB=0; TryC=0; TryD=0; ## input2 clickStop_A=0; clickStop_B=0; clickStop_C=0; clickStop_D=0; stopA=0; stopB=0; stopC=0; stopD=0; proc statusIsEating_A:stopA,tryA { if(stopA==0){ if(tryA==1) {statusIsEatingA=1; chop1=0; chop2=0; } }else {statusIsEatingA=0; chop1=1; chop2=1; } } proc statusIsEating_B:stopB,tryB { if(stopB==0){ if(tryB==1) {statusIsEatingB=1; chop2=0; chop3=0; } }else {statusIsEatingB=0; chop2=1; chop3=1; } } proc statusIsEating_C:stopC,tryC { if(stopC==0){ if(tryC==1) {statusIsEatingC=1; chop3=0; chop4=0; } }else {statusIsEatingC=0; chop3=1; chop4=1; } } proc statusIsEating_D:stopD,tryD { if(stopD==0){ if(tryD==1) {statusIsEatingD=1; chop4=0; chop1=0; } }else {statusIsEatingD=0; chop4=1; chop1=1; } } proc try_A:chop1,chop2,clickTry_A { if(chop1==1 and chop2==1) { if(clickTry_A==1) {tryA=1;} else {tryA=0;} }else{tryA=0;} } proc try_B:chop2,chop3,clickTry_B { if(chop2==1 and chop3==1) { if(clickTry_B==1) {tryB=1;} else {tryB=0;} }else{tryB=0;} } proc try_C:chop3,chop4,clickTry_C { if(chop3==1 and chop4==1) { if(clickTry_C==1) {tryC=1;} else {tryC=0;} }else{tryC=0;} } proc try_D:chop4,chop1,clickTry_D { if(chop4==1 and chop1==1) { if(clickTry_D==1) {tryD=1;} else {tryD=0;} }else{tryD=0;} } proc stop_A:statusIsEatingA,clickStop_A { if(statusIsEatingA==1 and clickStop_A==1){stopA=1;} else {stopA=0;} } proc stop_B:statusIsEatingB,clickStop_B { if(statusIsEatingB==1 and clickStop_B==1){stopB=1;} else {stopB=0;} } proc stop_C:statusIsEatingC,clickStop_C { if(statusIsEatingC==1 and clickStop_C==1){stopC=1;} else {stopC=0;} } proc stop_D:statusIsEatingD,clickStop_D { if(statusIsEatingD==1 and clickStop_D==1){stopD=1;} else {stopD=0;} } ### setting button triggers #### %eden MOUSE_BUTTON_PRESSED=4; MOUSE_BUTTON_RELEASED=5; doorStatus=0; statusA=0; statusColorA="yellow"; statusB=0; statusColorB="yellow"; statusC=0; statusColorC="yellow"; statusD=0; statusColorD="yellow"; chop1=1; chop2=1; chop3=1; chop4=1; proc buttonA_Trigger:buttonA_mouse_1{ if(buttonA_mouse_1[2]==MOUSE_BUTTON_PRESSED){ if(statusIsEatingA==1){ clickStop_A=1; stop_A(); statusIsEating_A(); clickStop_A=0; }else{ clickTry_A=1; try_A(); statusIsEating_A(); clickTry_A=0; } } if (buttonA_mouse_1[2]==MOUSE_BUTTON_RELEASED){ statusTellingA(); statusShowingA(); statusTellingD(); statusShowingD(); statusTellingB(); statusShowingB(); } } proc buttonB_Trigger:buttonB_mouse_1{ if(buttonB_mouse_1[2]==MOUSE_BUTTON_PRESSED){ if(statusIsEatingB==1){ clickStop_B=1; stop_B(); statusIsEating_B(); clickStop_B=0; }else{ clickTry_B=1; try_B(); statusIsEating_B(); clickTry_B=0; } } if (buttonB_mouse_1[2]==MOUSE_BUTTON_RELEASED){ statusTellingB(); statusShowingB(); statusTellingA(); statusShowingA(); statusTellingC(); statusShowingC(); } } proc buttonC_Trigger:buttonC_mouse_1{ if(buttonC_mouse_1[2]==MOUSE_BUTTON_PRESSED){ if(statusIsEatingC==1){ clickStop_C=1; stop_C(); statusIsEating_C(); clickStop_C=0; }else{ clickTry_C=1; try_C(); statusIsEating_C(); clickTry_C=0; } } if (buttonC_mouse_1[2]==MOUSE_BUTTON_RELEASED){ statusTellingC(); statusShowingC(); statusTellingB(); statusShowingB(); statusTellingD(); statusShowingD(); } } proc buttonD_Trigger:buttonD_mouse_1{ if(buttonD_mouse_1[2]==MOUSE_BUTTON_PRESSED){ if(statusIsEatingD==1){ clickStop_D=1; stop_D(); statusIsEating_D(); clickStop_D=0; }else{ clickTry_D=1; try_D(); statusIsEating_D(); clickTry_D=0; } } if (buttonD_mouse_1[2]==MOUSE_BUTTON_RELEASED){ statusTellingD(); statusShowingD(); statusTellingA(); statusShowingA(); statusTellingC(); statusShowingC(); } } proc machine1_Trigger:machine1_mouse_1{ if(machine1_mouse_1[2]==MOUSE_BUTTON_PRESSED){ if(chop1==0) chop1=1; } if (machine1_mouse_1[2]==MOUSE_BUTTON_RELEASED){ statusTellingD(); statusShowingD(); statusTellingA(); statusShowingA(); } } proc machine2_Trigger:machine2_mouse_1{ if(machine2_mouse_1[2]==MOUSE_BUTTON_PRESSED){ if(chop2==0) chop2=1; } if (machine2_mouse_1[2]==MOUSE_BUTTON_RELEASED){ statusTellingA(); statusShowingA(); statusTellingB(); statusShowingB(); } } proc machine3_Trigger:machine3_mouse_1{ if(machine3_mouse_1[2]==MOUSE_BUTTON_PRESSED){ if(chop3==0) chop3=1; } if (machine3_mouse_1[2]==MOUSE_BUTTON_RELEASED){ statusTellingB(); statusShowingB(); statusTellingC(); statusShowingC(); } } proc machine4_Trigger:machine4_mouse_1{ if(machine4_mouse_1[2]==MOUSE_BUTTON_PRESSED){ if(chop4==0) chop4=1; } if (machine4_mouse_1[2]==MOUSE_BUTTON_RELEASED){ statusTellingC(); statusShowingC(); statusTellingD(); statusShowingD(); } } ## proc statusShowingA: statusA{ if(statusA==0){ statusColorA="yellow";} else if(statusA==1){statusColorA="red";} else{ statusColorA="green";} } proc statusTellingA: statusIsEatingA { if(statusIsEatingA==1){statusA=2;} else if(chop1==1 and chop2==1){statusA=0;} else{statusA=1;} } ## proc statusShowingB: statusB{ if(statusB==0){ statusColorB="yellow";} else if(statusB==1){statusColorB="red";} else{ statusColorB="green";} } proc statusTellingB: statusIsEatingB { if(statusIsEatingB==1){statusB=2;} else if(chop2==1 and chop3==1){statusB=0;} else{statusB=1;} } ## proc statusShowingC: statusC{ if(statusC==0){ statusColorC="yellow";} else if(statusC==1){statusColorC="red";} else{ statusColorC="green";} } proc statusTellingC: statusIsEatingC { if(statusIsEatingC==1){statusC=2;} else if(chop3==1 and chop4==1){statusC=0;} else{statusC=1;} } ## proc statusShowingD: statusD{ if(statusD==0){ statusColorD="yellow";} else if(statusD==1){statusColorD="red";} else{ statusColorD="green";} } proc statusTellingD: statusIsEatingD { if(statusIsEatingD==1){statusD=2;} else if(chop4==1 and chop1==1){statusD=0;} else{statusD=1;} } ## statusAllPhilosophers is (statusA+statusB+statusC+statusD); proc Door:statusAllPhilosophers{ if(statusAllPhilosophers==0 or statusAllPhilosophers==8) {doorStatus=0;} else {doorStatus=1;} } EM/Eden_Version/runInEDEN.e0000600010252200001470000000007111326721454015477 0ustar cspjamdcsother %eden include("../layout.e"); include("EdenVersion.e");EM/Eden_Version/runInEDEN.e~0000600010252200001470000000007011326721342015670 0ustar cspjamdcsother %eden include("./layout.e"); include("EdenVersion.e");EM/ReadMe~0000600010252200001470000000176411327541563012514 0ustar cspjamdcsotherWeight: code 60%, report 40% How to Run: 1. Eden_Version: simply open tkeden2.10, File->Open->EM->Eden_Version->runInEDEN.e 2. Doste_Version: a. extract the EM.zip file in the home directory b. open tkeden2.10, enter the command line: %dasm @root notations dasm run=(new type=LocalFile filename="EM/Doste_Version/Logic.dasm"); c. to link the doste with the corresponding Eden GUI, File->Open->EM->Doste_Version->runInDoste.e PS.in Doste_Version,you can use doste command:"@philosopher clickTry_A=true","@philosopher clickTry_A=false" which means to press and release that button. to find more simply to enter the command line: %list@philosopher; (with space at front), finding more observables to change. step c is optional, but it is more fun to do it, as you can input actions using Eden GUI by clicking,of course it is great to enter Doste command line and click the Eden GUI at the same time. Some interesting testing cases for "Doste and Eden GUI" are in the EM/Doste_Version/To Play EM/layout.e0000600010252200001470000001070311326717236012713 0ustar cspjamdcsother%eden statusColorA="yellow"; statusColorB="yellow"; statusColorC="yellow"; statusColorD="yellow"; doorStatus=0; chop1=1; chop2=1; chop3=1; chop4=1; %donald viewport Layout int width,length point NW,NE,SW,SE,Centre line N,S,E,W N=[NW,NE] S=[SW,SE] W=[NW,SW] E=[NE,SE] SW={100,100} SE=SW+{width,0} NE=SW+{width,length} NW=SW+{0,length} Centre={(SW.1+NE.1) div 2, (SW.2+NE.2) div 2} width,length=800,800 ##### table openshape table within table { int radius point Centre circle table radius=180 Centre=~/Centre table=circle(Centre,radius) } %scout integer chop1; integer chop2; integer chop3; integer chop4; string statusColorA; string statusColorB; string statusColorC; string statusColorD; integer doorStatus; window table={ type:DONALD box:[{0,0},{500,500}] pict:"Layout" bgcolor:"grey" }; window doorShut={ type:TEXT bgcolor:"grey" bdcolor: if doorStatus==0 then "black"else "grey" endif border:1 frame:([{50,70},{50,110}]) }; window doorOpen={ type:TEXT bgcolor:"grey" bdcolor:if doorStatus==1 then "black"else "grey" endif border:1 frame:([{50,70},{90,70}]) }; window chop_1={ type:TEXT bgcolor:"grey" bdcolor:if chop1==1 then "black" else "grey" endif border:1 frame:([{250,180},{250,200}]) }; window chop_2={ type:TEXT bgcolor:"grey" bdcolor:if chop2==1 then "black" else "grey" endif border:1 frame:([{300,250},{320,250}]) }; window chop_3={ type:TEXT bgcolor:"grey" bdcolor:if chop3==1 then "black" else "grey" endif border:1 frame:([{250,300},{250,320}]) }; window chop_4={ type:TEXT bgcolor:"grey" bdcolor:if chop4==1 then "black" else "grey" endif border:1 frame:([{180,250},{200,250}]) }; window buttonA={ type:TEXT string: " A" bgcolor:statusColorA bdcolor:"black" border:1 sensitive:ON frame:([{325,140},{350,165}]) }; window buttonB={ type:TEXT string: " B" bgcolor:statusColorB bdcolor:"black" border:1 sensitive:ON frame:([{325,335},{350,360}]) }; window buttonC={ type:TEXT string: " C" bgcolor:statusColorC bdcolor:"black" border:1 sensitive:ON frame:([{150,335},{175,360}]) }; window buttonD={ type:TEXT string: " D" bgcolor:statusColorD bdcolor:"black" border:1 sensitive:ON frame:([{150,140},{175,165}]) }; window machine1={ type:TEXT string: "1" fgcolor:"grey" bgcolor:"blue" bdcolor:"black" border:1 sensitive:ON frame:([{245,125},{255,140}]) }; window machine2={ type:TEXT string: "2" fgcolor:"grey" bgcolor:"blue" bdcolor:"black" border:1 sensitive:ON frame:([{360,245},{370,260}]) }; window machine3={ type:TEXT string: "3" fgcolor:"grey" bgcolor:"blue" bdcolor:"black" border:1 sensitive:ON frame:([{245,360},{255,375}]) }; window machine4={ type:TEXT string: "4" fgcolor:"grey" bgcolor:"blue" bdcolor:"black" border:1 sensitive:ON frame:([{135,245},{145,260}]) }; window thinking={ type:TEXT string:"philosopher thinking" fgcolor:"blue" bgcolor:"grey" frame:([{90,395},{250,410}]) }; window eating={ type:TEXT string:"philosopher eating" fgcolor:"blue" bgcolor:"grey" frame:([{90,410},{250,425}]) }; window waiting={ type:TEXT string:"philosopher waiting" fgcolor:"blue" bgcolor:"grey" frame:([{90,425},{250,440}]) }; window chopstickMachine={ type:TEXT string:"chopstick machine" fgcolor:"blue" bgcolor:"grey" frame:([{295,425},{450,440}]) }; window yellowbox={ type:TEXT bgcolor:"yellow" bdcolor:"black" border:1 frame:([{70,395},{85,410}]) }; window greenbox={ type:TEXT bgcolor:"green" bdcolor:"black" border:1 frame:([{70,410},{85,425}]) }; window redbox={ type:TEXT bgcolor:"red" bdcolor:"black" border:1 frame:([{70,425},{85,440}]) }; window bluebox={ type:TEXT bgcolor:"blue" bdcolor:"black" border:1 frame:([{275,425},{285,440}]) }; screen=< buttonA/ buttonB/ buttonC/ buttonD / machine1/ machine2/ machine3/ machine4/ chop_1/ chop_2/ chop_3/ chop_4/ thinking/ eating/ waiting/ chopstickMachine/ yellowbox/ greenbox/ redbox/ bluebox/ doorShut/ doorOpen/ table >; EM/layout.e~0000600010252200001470000001070611326714330013104 0ustar cspjamdcsother %eden statusColorA="yellow"; statusColorB="yellow"; statusColorC="yellow"; statusColorD="yellow"; doorStatus=0; chop1=1; chop2=1; chop3=1; chop4=1; %donald viewport Layout int width,length point NW,NE,SW,SE,Centre line N,S,E,W N=[NW,NE] S=[SW,SE] W=[NW,SW] E=[NE,SE] SW={100,100} SE=SW+{width,0} NE=SW+{width,length} NW=SW+{0,length} Centre={(SW.1+NE.1) div 2, (SW.2+NE.2) div 2} width,length=800,800 ##### table openshape table within table { int radius point Centre circle table radius=180 Centre=~/Centre table=circle(Centre,radius) } %scout integer chop1; integer chop2; integer chop3; integer chop4; string statusColorA; string statusColorB; string statusColorC; string statusColorD; integer doorStatus; window table={ type:DONALD box:[{0,0},{500,500}] pict:"Layout" bgcolor:"grey" }; window doorShut={ type:TEXT bgcolor:"grey" bdcolor: if doorStatus==0 then "black"else "grey" endif border:1 frame:([{50,70},{50,110}]) }; window doorOpen={ type:TEXT bgcolor:"grey" bdcolor:if doorStatus==1 then "black"else "grey" endif border:1 frame:([{50,70},{90,70}]) }; window chop_1={ type:TEXT bgcolor:"grey" bdcolor:if chop1==1 then "black" else "grey" endif border:1 frame:([{250,180},{250,200}]) }; window chop_2={ type:TEXT bgcolor:"grey" bdcolor:if chop2==1 then "black" else "grey" endif border:1 frame:([{300,250},{320,250}]) }; window chop_3={ type:TEXT bgcolor:"grey" bdcolor:if chop3==1 then "black" else "grey" endif border:1 frame:([{250,300},{250,320}]) }; window chop_4={ type:TEXT bgcolor:"grey" bdcolor:if chop4==1 then "black" else "grey" endif border:1 frame:([{180,250},{200,250}]) }; window buttonA={ type:TEXT string: " A" bgcolor:statusColorA bdcolor:"black" border:1 sensitive:ON frame:([{325,140},{350,165}]) }; window buttonB={ type:TEXT string: " B" bgcolor:statusColorB bdcolor:"black" border:1 sensitive:ON frame:([{325,335},{350,360}]) }; window buttonC={ type:TEXT string: " C" bgcolor:statusColorC bdcolor:"black" border:1 sensitive:ON frame:([{150,335},{175,360}]) }; window buttonD={ type:TEXT string: " D" bgcolor:statusColorD bdcolor:"black" border:1 sensitive:ON frame:([{150,140},{175,165}]) }; window machine1={ type:TEXT string: "1" fgcolor:"grey" bgcolor:"blue" bdcolor:"black" border:1 sensitive:ON frame:([{245,125},{255,140}]) }; window machine2={ type:TEXT string: "2" fgcolor:"grey" bgcolor:"blue" bdcolor:"black" border:1 sensitive:ON frame:([{360,245},{370,260}]) }; window machine3={ type:TEXT string: "3" fgcolor:"grey" bgcolor:"blue" bdcolor:"black" border:1 sensitive:ON frame:([{245,360},{255,375}]) }; window machine4={ type:TEXT string: "4" fgcolor:"grey" bgcolor:"blue" bdcolor:"black" border:1 sensitive:ON frame:([{135,245},{145,260}]) }; window thinking={ type:TEXT string:"philosopher thinking" fgcolor:"blue" bgcolor:"grey" frame:([{90,395},{250,410}]) }; window eating={ type:TEXT string:"philosopher eating" fgcolor:"blue" bgcolor:"grey" frame:([{90,410},{250,425}]) }; window waiting={ type:TEXT string:"philosopher waiting" fgcolor:"blue" bgcolor:"grey" frame:([{90,425},{250,440}]) }; window chopstickMachine={ type:TEXT string:"chopstick machine" fgcolor:"blue" bgcolor:"grey" frame:([{295,425},{450,440}]) }; window yellowbox={ type:TEXT bgcolor:"yellow" bdcolor:"black" border:1 frame:([{70,395},{85,410}]) }; window greenbox={ type:TEXT bgcolor:"green" bdcolor:"black" border:1 frame:([{70,410},{85,425}]) }; window redbox={ type:TEXT bgcolor:"red" bdcolor:"black" border:1 frame:([{70,425},{85,440}]) }; window bluebox={ type:TEXT bgcolor:"blue" bdcolor:"black" border:1 frame:([{275,425},{285,440}]) }; screen=< buttonA/ buttonB/ buttonC/ buttonD / machine1/ machine2/ machine3/ machine4/ chop_1/ chop_2/ chop_3/ chop_4/ thinking/ eating/ waiting/ chopstickMachine/ yellowbox/ greenbox/ redbox/ bluebox/ doorShut/ doorOpen/ table >; EM/ReadMe0000600010252200001470000000163111327543171012304 0ustar cspjamdcsotherWeight: code 60%, report 40% How to Run: 1. Eden_Version: simply open tkeden2.10, File->Open->EM->Eden_Version->runInEDEN.e 2. Doste_Version: a. extract the EM.zip file in the home directory b. open tkeden2.10, enter the command line: %dasm @root notations dasm run=(new type=LocalFile filename="EM/Doste_Version/Logic.dasm"); c. to link the doste with the corresponding Eden GUI, File->Open->EM->Doste_Version->runInDoste.e PS.in Doste_Version,you can use doste command:"@philosopher clickTry_A=true","@philosopher clickTry_A=false" which means to press and release that button. to find more simply to enter the command line: %list@philosopher; (with space at front), finding more observables to change. step c is optional, but it is more fun to do it, as you can input actions using Eden GUI by clicking,of course it is great to enter Doste command line and click the Eden GUI at the same time. EM/TO PLAY0000600010252200001470000000350611327543114012217 0ustar cspjamdcsother Open the Doste Version and link it to Eden GUI. when in %dasm 1.to see all the observables %list@philosopher; 2. Philosopher A tries to eat. @philosopher clickTry_A=true; ## the same as press mouse button. @philosopher clickTry_A=false; ## the same as release mouse button. ## Philosopher A will change his colour to green, a eating status.you could easily do the same thing by clicking Philosopher A in Eden GUI. 3. Philosopher A tries to stop eating. @philosopher clickStop_A=true; @philosopher clickStop_A=false; #### Philosopher A will change his colour to yellow, a thinking status.you could easily do the same thing by clicking Philosopher A in Eden GUI. 4. do step2 or make philosopher A in a eating status by clicking him or using the Doste command line. Notes now there are no chopsticks on the tables by the left and right hand side of A. enter the command line: @philosopher clickMachine_1=true; ## press machine1 mouse button @philosopher clickMachine_1=false; ##release machine1 mouse button 5. enter @philosopher chop1 is {0}; ## that is no senses and you will see sth strange,(didn't affect anything, just disappear) see the source code to find out. hint: in source code there is a dependency: chop1 is {if(.chop_1)1 else 0} To fix it, simply enter the command line: @philosopher chop1 is {if(@philosopher chop_1)1 else 0} 6. this time if you want to make the chop1 properly disappear,enter this @philosopher chop_1 is {false}; ## it of course affects all the things around. and check the sourse code to fix it back or restart it to continue. 6. you could play with other philosophers and chopstickMachines in the same way,maybe there are more interesting cases, either in entering DOSTE command line or Eden GUI mouse clicking. have fun :) EM/TO PLAY~0000600010252200001470000000276511327542442012426 0ustar cspjamdcsother Open the Doste Version and link it to Eden GUI. when in %dasm 1.to see all the observables %list@philosopher; 2. Philosopher A tries to eat. @philosopher clickTry_A=true; ## the same as press mouse button. @philosopher clickTry_A=false; ## the same as release mouse button. ## Philosopher A will change his colour to green, a eating status.you could easily do the same thing by clicking Philosopher A in Eden GUI. 3. Philosopher A tries to stop eating. @philosopher clickStop_A=true; @philosopher clickStop_A=false; #### Philosopher A will change his colour to yellow, a thinking status.you could easily do the same thing by clicking Philosopher A in Eden GUI. 4. do step2 or make philosopher A in a eating status by clicking him or using the Doste command line. Notes now there are no chopsticks on the tables by the left and right hand side of A. enter the command line: @philosopher clickMachine_1=true; ## press machine1 mouse button @philosopher clickMachine_1=false; ##release machine1 mouse button 5. enter @philosopher chop1 is {0}; ## that is no senses and you will see sth strange,(didn't affect anything, just disappear) see the source code to find out. hint: @philosopher chop1 is {if(@philosopher chop_1)1 else 0} @philosopher chop_1 is {false}; ## making the chop1 disappear 6. you could play with other philosophers and chopstickMachines in the same way, either in entering DOSTE command line or Eden GUI mouse clicking. have fun :)