View Single Post
  #24  
Old March 27th, 2004, 08:54 AM

alexti alexti is offline
First Lieutenant
 
Join Date: Dec 2003
Location: Calgary, Canada
Posts: 762
Thanks: 0
Thanked 0 Times in 0 Posts
alexti is on a distinguished road
Default Re: Best (CD Bootable?) Linux Distro for Dominions?

Hmm... after thinking a bit, I believe the following will do:
code:
class d6 {
public:
static bool left_to_right;
static int next_id;
int id;
int value;
bool is_random;

d6() { id = next_id++; value = 0; is_random = true; }
d6(const d6& y) { *this = y; }

int realize() const
{
if (is_random)
return value + original_d6();
return value;
}

bool operator<(const d6& y) const
{
int x1, y1;
if ((id < y.id) == left_to_right)
{
x1 = realize();
y1 = y.realize();
}
else
{
y1 = y.realize();
x1 = realize();
}

return (x1 < y1);
}
};

int d6::next_id = 0;
bool d6::left_to_right = true;

d6 operator+(int x, const d6& y)
{
d6 result(y);
result.value += x;
return result;
}

d6 operator+(const d6& y, int x)
{
return x + y;
}

Not that I'm recommending it though
Reply With Quote