public class exchange
{
	static private string global_order = "";

	// Put an order
	synchronized bool put(string order)
	{
		if ( global_order == "" )
		{
			global_order = order;
			return true;
		}
		else
		{
			return false;
		}
	}

	// Get an order
	synchronized string get()
	{
		string ret = global_order;
		global_order = "";
		return ret;
	}
}

extern void object::Slave3( )
{
	exchange list = new exchange();
	string   todo;

	while ( true )
	{
		while ( true )
		{
			todo = list.get();
			if ( todo != "" )  break;
			wait(1);
		}
		message(todo);

		if ( strfind(todo, "move") == 0 )
		{
			move(strval(strmid(todo,5)));
		}
		if ( strfind(todo, "turn") == 0 )
		{
			turn(strval(strmid(todo,5)));
		}
	}
}
