Lurker News
Preferably an elegant snippet rather than an entire (well engineered) codebase.

Comments (380) 116 threads

Show all comments

Showing thread 75 of 116

candu#
From [1], a terse one-liner that outperformed many longer and more complicated entries in The Second International RoShamBo Programming Competition:

    int henny() {
      return((*opp_history?opp_history[random()%*opp_history+1]+1:random())%3);
    }
[1] https://webdocs.cs.ualberta.ca/~darse/rsbpc.html