Re: programing help


[Prev][Next][Index][Thread]

Re: programing help



In article <338CA429.B63265F6@www.cedarnet.org>, Nadler
<sn11162@WWW.CEDARNET.ORG> wrote:
>I am making yatzee in ti-basic for the ti-83 and I am stumped.  I don't
>know a way for the calc to know if a 3 of a kind is really a 3 of a
>kind.  The only way I can think of is to type in all the possibilities
>that 3 digits would be the same, but this would take a long time and a
>lot of space.  Does anyone know a better way to do this?


Ugh... ti-basic...Just see if they're equal...

What I'd do is to sort the numbers in ascending or descending order, so you
know that if there's a three of a kind, the numbers are next to each other.

Then check...

if( item1=item2 and item2=item3 )
or (item2 = item3 and item3 = item4)
or (item3 = item4 and item4 = item5)

Four of a kind is a little easier, only two checks, but three = per (1=2=3=4
or 2=3=4=5).

Got it?

J. Masters
trent@circle.net


References: