4
\$\begingroup\$

I am considering to post a draft answer AKA "my advance" (obviously warning to the users that it is incomplete and future updates are coming) on this question

I think my 90% done answer can help people by borrowing some of my ideas.

But I am unsure if posting drafts answers is unwanted.

So what do you advice me, to post or not to post this advance?:

    //JavaScript
    str="AD 2D 3D 4D | 2D".split(/\s\|\s|\s/);
    i=j=v=f=p=0;
    arr=[];arr2=[];//don't merge arr=arr2=[]

    for(sc="SCDH";i<5;i++){
        x=str[i];
        xx=x[0];

        arr[sc.indexOf(x[1])]+=".";
        arr2[("ATJQK".indexOf(xx)+1)||(xx- -4)]+=".";

        if((i<4)&&(x==("J"+sc[sc.indexOf(str[4][1])]))){
            j++;
        }

        v+=((xx=="A")?1:((xx*1)||10));
    }

    y=(yy=(arr+"")).indexOf("....");//cache yy counterproductive?
    f=(!!(++y))?(yy[y+3]==".")?5:(str.length<6)?4:0:0;//improve !!()?

    for(i in arr2){
        p+=(((xxx=((arr2[i]+"").length-9))*(xxx-1))/2);
    }



    //Fifteens: for each subset of five cards whose sum is 15, add two points.
    //if(v==15) add +2

    //Pairs: for each pair of cards with the same rank (not value), add two points.
    //add +(p*2)

    //Runs: for each maximal run of consecutive cards of length longer than 2, add the length of the run in points.
    //

    //Flush: if all five cards are the same suit, add five points. Otherwise, if all but the up card are the same suit, add four points. If this is a crib hand, the four-point variant is not counted.
    //add +f

    //Nobs: if there is a jack in hand with the same suit of the up card, add one point.
    //if(j) add +1
\$\endgroup\$

1 Answer 1

4
\$\begingroup\$

Sometimes it's useful to post your own answer, even if not golfed, as a proof of feasibility. For example, Generate Newton fractals generated some discussion in the comments as to whether it was golfable, and that's the kind of situation in which the question setter could intervene with "I have a working solution in XYZ chars, and I'll post it in a week".

In the case of your cribbage question, there's nothing difficult about the problem. So while you can by all means answer it yourself (with a golfed solution), it's not really worth cluttering up the page with a non-golfed solution which serves purely as a proof of feasibility. As a tactical matter (in terms of keeping the question on the front page without upsetting people), I'd wait until a week after posting it before posting your own answer.

\$\endgroup\$
2
  • \$\begingroup\$ great advise, I will follow your advise \$\endgroup\$
    – ajax333221
    Commented Apr 16, 2012 at 20:31
  • \$\begingroup\$ Good answer. I like to see proof of feasibility answers on on question that look really challenging, but it doesn't see necessary here. \$\endgroup\$ Commented Apr 16, 2012 at 22:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .