#include <stdio.h>
#include "dice.h"

int dice()
{
  return (rand()>>5)%6+1; /* the low bits of rand() are bad */
}

int Total(struct dice *d) 
{ 
  return d->d1 + d->d2;
}

int Pair(struct dice *d) 
{
  return d->d1 == d->d2; 
}

void Roll(struct dice *d) 
{
  d->d1 = dice(); d->d2 = dice(); 
}

void Read(struct dice *d) 
{
  scanf("%d%d", &(d->d1), &(d->d2)); 
}

void Write(struct dice *d) 
{
  printf("%d %d\n", d->d1, d->d2); 
}
