I am writing a c++ yahtzee program for my programming class, and i am having trouble with the small straights. I have no idea how to tell if the player has rolled a small straight, can anyone give me a clue as to where to start?

03-19-2009

vart

I have no idea what small straigt is. You should learn first ask questions...

03-19-2009

Nightowl

As much as I have to agree, I'd say that the Wikipedia page has some good info on that kind of thing.

Simply put, it's not difficult. Just check if the maximum difference between the lowest and highest dies is 4, and that no dice are equal to each other.

(There's probably a simpler solution, but that's the first thing that springs to mind, besides sorting the die values. ;) )

03-19-2009

VirtualAce

A small straight can be:

1234
2345
3456

A large straight can be:

12345
23456

What nightowl said is a good way to check for both a small and a large straight with the exception of a large straight having a max difference of 4 and a small straight a max difference of 3 between the dies.