-- card: 13170 from stack: in -- bmap block id: 23687 -- flags: 4000 -- background id: 8367 -- name: Forward Chaining ----- HyperTalk script ----- on openCard global cardWait put 0 into cardWait end openCard on idle global cardWait if cardWait=13 then exit idle wait 1 seconds put cardWait+1 into cardWait if cardWait=12 then send cardStuff to this card end idle on cardStuff play "harpsichord" "c" put "Key is in ignition" into line 1 of card field "A2" wait 1 seconds play "harpsichord" "e" put "Gas gauge is empty" into line 2 of card field "A2" wait 1 seconds play "harpsichord" "g" put "No gas in car" into card field "C2" play "boing" choose eraser tool drag from 155,239 to 341,243 choose line tool set the linesize to 1 drag from 155,239 to 341,243 drag from 341,243 to 336,238 drag from 341,243 to 336,248 choose browse tool play "harpsichord" "c" put "The sky is clear" into line 1 of card field "A1" play "harpsichord" "g" put "No gas in car" into line 2 of card field "A1" play "harpsichord" "c5" put "Take a walk" into card field "C1" show card field "Comments" end cardStuff on closeCard put empty into card field "A1" put empty into card field "C1" put empty into card field "A2" put empty into card field "C2" choose eraser tool drag from 155,239 to 341,243 choose line tool set the linesize to 2 drag from 214,231 to 214,249 set the linesize to 1 drag from 290,234 to 290,252 choose browse tool hide card field "Comments" end closeCard -- part 1 (field) -- low flags: 01 -- high flags: 0001 -- rect: left=24 top=76 right=184 bottom=490 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 14 -- style flags: 256 -- line height: 18 -- part name: -- part 2 (field) -- low flags: 01 -- high flags: 0000 -- rect: left=39 top=190 right=214 bottom=64 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 14 -- style flags: 16640 -- line height: 18 -- part name: -- part 3 (field) -- low flags: 01 -- high flags: 0000 -- rect: left=11 top=225 right=247 bottom=63 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 14 -- style flags: 16640 -- line height: 18 -- part name: -- part 4 (field) -- low flags: 01 -- high flags: 0000 -- rect: left=65 top=192 right=227 bottom=214 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: A2 -- part 5 (field) -- low flags: 01 -- high flags: 0000 -- rect: left=64 top=228 right=247 bottom=213 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: C2 -- part 6 (field) -- low flags: 01 -- high flags: 0000 -- rect: left=320 top=216 right=237 bottom=344 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 14 -- style flags: 16640 -- line height: 18 -- part name: -- part 7 (field) -- low flags: 01 -- high flags: 0000 -- rect: left=292 top=250 right=272 bottom=344 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 14 -- style flags: 16640 -- line height: 18 -- part name: -- part 8 (field) -- low flags: 01 -- high flags: 0000 -- rect: left=344 top=217 right=252 bottom=493 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: A1 -- part 9 (field) -- low flags: 01 -- high flags: 0000 -- rect: left=344 top=252 right=271 bottom=493 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: C1 -- part 11 (field) -- low flags: 81 -- high flags: 0001 -- rect: left=10 top=279 right=336 bottom=381 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 14 -- style flags: 256 -- line height: 18 -- part name: Comments -- part contents for background part 1 ----- text ----- Forward Chaining -- part contents for card part 1 ----- text ----- The inference engine in HyperX also uses one other strategy to find Rules to test, called forward chaining. When a Conclusion is reached, HyperX will look the other way for an untested Rule with that Conclusion in it's list of Assertions and add it to the Goal Trail of Rules to be tested. -- part contents for card part 2 ----- text ----- If: -- part contents for card part 3 ----- text ----- Then: -- part contents for card part 6 ----- text ----- If: -- part contents for card part 7 ----- text ----- Then: -- part contents for card part 11 ----- text ----- The same Conclusion was reached as in the backward chaining example, but the Rules were tested in the opposite order.