×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Genesis 3

Genesis 3

Genesis 3

(OP)
How to write a code for Adam and eve in the Garden
Serpent comes to tell them it is ok to eat the fruit.
They Eat the fruit, they realize they sin.
Then curse happens

RE: Genesis 3

So what is the question?

RE: Genesis 3

Anyways, because I was bored and curious about nested state machines using Transitions:

<<Deleted>>

Not fully functional, but I've wasted enough time....

RE: Genesis 3

And after a bit more study about Transitions Nested and Parallel states:

CODE --> Python

from transitions.extensions.factory import HierarchicalGraphMachine
import graphviz
from IPython import display 

CODE -->

Fruit = {'name': 'Fruit', 'states': ['forbidden', 'tasty'], 'transitions': [['god_says', 'tasty', 'forbidden'],['serpent_says', 'forbidden', 'tasty']], 'initial': 'forbidden'}
Sinned = {'name': 'Sinned', 'states': ['True', 'False'], 'transitions':[['eat_fruit', 'False', 'True'],['repent', 'True', 'False']], 'initial': 'False'}
GodIs = {'name': 'GodIs', 'states': ['Benevolent', 'Vengeful'],'transitions': [['eat_fruit', 'Benevolent', 'Vengeful'],['forgiven', 'Vengeful', 'Benevolent']],  'initial': 'Benevolent'}

Beliefs = {'name': 'Beliefs', 'parallel': [Fruit, Sinned, GodIs]}

Ate_Fruit = {'name': 'Ate', 'states': ['True', 'False'], 'transitions': [['eat_fruit', 'False', 'True'],['vomit', 'True', 'True']], 'initial': 'False'}

states = [{'name': 'Self', 'parallel': [Beliefs, Ate_Fruit]}]

Eve = HierarchicalGraphMachine(states=states, initial=['Self_Beliefs_GodIs_Benevolent', 'Self_Beliefs_Sinned_False', 'Self_Beliefs_Fruit_forbidden' ,'Self_Ate_False']) 



CODE -->

Eve.serpent_says() 



CODE -->

Eve.eat_fruit() 


RE: Genesis 3

(OP)
Thank you i did not see it.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close