in reply to Re: calculating cribbage points
in thread calculating cribbage points

I'm sorry could some one explain what is up with the code for runs. I can't get it to work and I am having troubles figuring out how it is suspose to work.

Replies are listed 'Best First'.
Re^3: calculating cribbage points
by ikegami (Patriarch) on Mar 31, 2006 at 19:29 UTC
    You can't get them to run? Wierd, I've tested them. You shouldn't have any problems.

    $s is the index of the card at the start of a run.
    $e is the index of the card one beyond the end of a run.
    "lr" stands for "longest run".
    $lr_idx is the index of the card which starts the longest run.
    $c[$lr_idx] is the face value of the card which starts the longest run.
    $lr_len is the length of the run, as a number of cards.
    @runs is an array of runs, where a run is a reference to an array of card face values.