Ejemplo n.º 1
0
//Rolls any dice that are -1 in value
void roll(){
  int i;

  for(i = 0; i < 5; i++){
    if(DICE[i] == -1){
      DICE[i] = get_dice();
    }
  }
  qsort(DICE, 5, sizeof(int), comp);
  print_roll();
}
Ejemplo n.º 2
0
int shake_dice()
{
  int dice, nmove;
  unsigned int moves[ SIZE_LEGALMOVES ];

  dice = get_dice();

  out("\n");

  if( dice == 1 )
    {
      out(" +--------+\n");
      out(" |        |\n");
      out(" |   ●   |\n");
      out(" |        |\n");
      out(" +--------+\n");
    }
  else if( dice == 2 )
    {
      out(" +--------+\n");
      out(" | ●     |\n");
      out(" |        |\n");
      out(" |     ● |\n");
      out(" +--------+\n");
    }
  else if( dice == 3 )
    {
      out(" +--------+\n");
      out(" | ●     |\n");
      out(" |   ●   |\n");
      out(" |     ● |\n");
      out(" +--------+\n");
    }
  else if( dice == 4 )
    {
      out(" +--------+\n");
      out(" | ●  ● |\n");
      out(" |        |\n");
      out(" | ●  ● |\n");
      out(" +--------+\n");
    }
  else if( dice == 5 )
    {
      out(" +--------+\n");
      out(" | ●  ● |\n");
      out(" |   ●   |\n");
      out(" | ●  ● |\n");
      out(" +--------+\n");
    }
  else
    {
      out(" +--------+\n");
      out(" | ●  ● |\n");
      out(" | ●  ● |\n");
      out(" | ●  ● |\n");
      out(" +--------+\n");
    }

  out("\n");
  nmove = gen_dicenum_legalmoves( moves, dice );
  out_legalmoves( moves, nmove );

  return dice;
}