Esempio n. 1
0
int clean_trash()
{
	mapping exits;
	string *dirs;
	string last_dir;
	if( last_dir = this_object()->query("last_dir"))
	{
        if( !mapp(exits = environment()->query("exits")) ) 
	{
	destruct(this_object());
	return 0;
	}
        dirs = keys(exits);
	if( member_array(last_dir, dirs) != -1)
	{
	if( random(2) )
		command("go "+ last_dir);
	else
		randommove();
	}		
	else
		randommove();
		

	}
	else
		randommove();
}
Esempio n. 2
0
File: ai4.c Progetto: UIKit0/picogui
void ai4(struct board *it)
{
  int temp;

  temp = nextmovewin(it);
#ifdef DEBUG
  fprintf(stderr,"nextmovewin returned %d\n",temp);
#endif
  if(temp != -1)
  {
    move(it,temp);
    return;
  }

  temp = linetrap(it);
#ifdef DEBUG
  fprintf(stderr,"linetrap returned %d\n",temp);
#endif
  if(temp != -1)
  {
    move(it,temp);
    return;
  }

  temp = nextmovelose(it,-1);
#ifdef DEBUG
  fprintf(stderr,"nextmovelose returned %d\n",temp);
#endif
  if(temp != -1)
  {
    notmove(it,temp);
    return;
  }

  randommove(it);
}