void processSelectedAction(CreatureActions externalAction) { Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US"); if (worldServer != null && worldServer.IsConnected) { switch (externalAction) { case CreatureActions.DO_NOTHING: // Do nothing as the own value says break; case CreatureActions.ROTATE_CLOCKWISE: Console.WriteLine("Rotate clockwise"); worldServer.SendSetAngle(creatureId, 2, -2, 2); break; case CreatureActions.GO_TO_CLOSEST_JEWEL: Console.WriteLine("Move to closest jewel required in a leaflet: " + closestJewel.Name); worldServer.SendSetGoTo(creatureId, 1, 1, closestJewel.comX, closestJewel.comY); break; case CreatureActions.GO_TO_CLOSEST_FOOD: Console.WriteLine("Move to closest food: " + closestFood.Name); worldServer.SendSetGoTo(creatureId, 1, 1, closestFood.comX, closestFood.comY); break; case CreatureActions.GO_AHEAD: Console.WriteLine("Go ahead"); worldServer.SendSetAngle(creatureId, 1, 1, prad); break; case CreatureActions.EAT_FOOD: worldServer.SendEatIt(creatureId, foodName); Console.WriteLine("Eat food " + foodName); break; case CreatureActions.SACK_JEWEL: worldServer.SendSackIt(creatureId, jewelName); Console.WriteLine("Sack jewel " + jewelName); break; case CreatureActions.PREPARE_TO_DELIVER_LEAFLET: Console.WriteLine("Ready to deliver " + leafletId); // don't actually deliver it, otherwise the world creates a new leaflet and the 3 will never end //worldServer.SendDeliverIt (creatureId, leafletId); deliverableLeaflets[leafletId] = true; break; case CreatureActions.STOP: worldServer.SendStopCreature(creatureId); foreach (string leafletIdKey in deliverableLeaflets.Keys) { worldServer.SendDeliverIt(creatureId, leafletIdKey); } Console.WriteLine("Success! All leaflets delivered. Stop the creature."); mind.ShowCompleteMessage(); stopped = true; break; default: break; } } }