![]() Also, by convention, NetLogo boolean variable names use a question mark at the end (to remind you they are boolean) so it would be better to have set hungry? false and change the philosophers-own statement accordingly. Assuming that you want to set the variable named 'hungry' to false, your code should be set hungry false. In NetLogo, you assign a variable value without an equals sign. Set x of one-of philosophers with Īny advice on how to solve this is appreciated! Thank you!įirst problem is your lines like set hungry hungry = false. this following line with in-radius was my attempt to move the forks but it doesn't workĪsk of philosophers with Set heading heading + 180 / num-philosophersĪsk philosophers with [set color red Philosophers-own Ĭro num-philosophers [set breed philosophersĬro num-philosophers [set breed forks fd 8 I'm trying to ask the 2 forks within the range of the hungry philosophers to move to the respective philosophers, but I'm not sure how to do it. They can only eat by obtaining 2 forks and after they're done eating, they put the forks down and think until they get hungry. The philosophers either eat, think, or get hungry. I'm trying to create a situation where there are 20 philosophers in a circle with one "fork" in front of each philosopher. I'm trying to make a simulation exactly the Dining Philosophers in the net logo library but with a different method.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |