예제 #1
0
#Ipod -- Question 3
f = FSA.singleton('Turn iPod on')
g = FSA.singleton('Turn iPod off')

fg = FSA.concatenation(f,g)
fg_star = FSA.closure(fg)

min_fg = FSA.minimize(fg_star)
#min_fg.view()

show3 = min_fg.checkQ3()
#print(show3)

#Interleaving -- Question 4
test = FSA.preInterleave(min_at_door, min_notes)
level2 = FSA.interleave(test,min_fg)
#test2.view()

show4 = level2.checkQ4()
#print(show4)

#Dials -- Question 5

turn1 = FSA.singleton('Turn dial 1')
dial = FSA.minimize(FSA.concatenation(turn1,turn1))
dialloop = FSA.minimize(FSA.concatenation(dial, dial))
dialtest = FSA.minimize(FSA.concatenation(dial,FSA.closure(dialloop)))
#dialtest.view()
show5 = dialtest.checkQ5a()
#print(show5)
예제 #2
0
import FSA

guard = FSA.singleton("Pass Guard" 
, "There is a guard blocking your entrance")

leave = FSA.singleton("Leave Main Area"
, "Go past the guard, who's asleep")

office = FSA.singleton("To office"
, "There's a door to an office")

exitoffice = FSA.singleton("Leave office"
, "Back to the entrance")

seePlane = FSA.singleton("To plane"
, "In the office, you see a plane")

leavePlane = FSA.singleton("Leave plane"
, "Back to the office")

test = FSA.minimize((FSA.closure (FSA.concatenation (seePlane,leavePlane) ) ))
test2 = FSA.minimize(FSA.preInterleave(everything,test))

entrance = FSA.minimize(FSA.concatenation(leave, guard))
everything = FSA.minimize(FSA.closure(FSA.concatenation(guard,(FSA.closure(FSA.preinterleave(test, (FSA.concatenation(office, exitoffice)))), leave)))


#everything.view()
test2.view()

예제 #3
0
exitoffice = FSA.singleton("Leave office"
, "Back to the entrance")

seePlane = FSA.singleton("To plane"
, "In the office, you see a plane")

leavePlane = FSA.singleton("Leave plane"
, "Back to the office")

inspectPlane = FSA.singleton("Inspect plane"
, "You need a key to operate this")

askGuard = FSA.singleton("Ask Guard a question"
, "There is a key in the office...snore...")

takeKey = FSA.singleton("Take the key"
, "You thief!")

flyPlane = FSA.singleton("Fly the plane"
, "Whoosh!")

test = FSA.minimize(FSA.closure( 

level1 = FSA.minimize(FSA.closure(FSA.concatenation(FSA.closure(askGuard),guard,(FSA.closure(FSA.concatenation(FSA.closure(FSA.concatenation(office,exitoffice)), office, FSA.concatenation( FSA.closure(FSA.concatenation(seePlane,FSA.closure(inspectPlane), leavePlane, ))), FSA.preInterleave(takeKey, FSA.concatenation( (FSA.closure(FSA.concatenation(seePlane,FSA.closure(inspectPlane), leavePlane, ))), exitoffice))))), leave)))

levelb = FSA.minimize(FSA.closure(FSA.concatenation(FSA.closure(askGuard),guard,(FSA.closure(FSA.concatenation(FSA.closure(FSA.concatenation(office,exitoffice)), office, FSA.preInterleave(takeKey, FSA.concatenation( (FSA.closure(FSA.concatenation(seePlane,FSA.closure(inspectPlane), leavePlane, ))), exitoffice)), FSA.concatenation( FSA.closure(FSA.concatenation(seePlane,FSA.closure(inspectPlane), leavePlane, )))))), leave)))


level1.view()
#levelb.view()