4
\$\begingroup\$

The challenge

This challenge is going to be a classic king of the hill game of RPS. You must write a program that takes two command line arguments, a string of all the moves that you have made, and a string of all the moves that your opponent has made. The program will then return either 'r', 'p' or 's' for rock, paper and scissors respectively. Your opponent's program will do the same thing, and the winner will get +1 point. The winner is determined by the following picture. As if we don't all know how to play rock paper scissors...

In the event of a tie, (Both throw the same move) no points will be awarded. If you fail to throw a valid move within 1/2 a second, or if you throw a move other than 'r', 'p' or 's', the other player will be awarded 2 points, and an 'x' will be added to the string of all of your moves. After 500 rounds, the program with more points will be awarded 1 win. If there is a tie after 500 rounds, it will go into sudden death mode. (First program to get any more points wins) The controller program (Which I haven't written yet, but I will get to) will keep track of calling the programs, keeping track of score and enforcing certain rules.

The twist

Now here is the part that makes it interesting. You must do it in a language that you have little to no experience with. I realize that this is highly subjective and there is nothing stopping someone from using a language that they already know very well, so this is on the honor system. The whole point of this challenge is to encourage people to experiment with languages that they wouldn't normally ever learn anything about. Also, I'm hoping this will be a little bit like code review. So the Java experts will comment on my answer that totally botches everything about Java and I learn a little bit more. And then when somebody who's never touched python before writes an answer in python, I will give them useful tips for how to improve their code, etc.

Rules

  • This isn't exactly a rule, since there is no way to enforce it, but don't use a language that you have already know. I will let you define what counts as "already knowing a language" but the spirit of the challenge is that everybody gets to try something new.

  • Every entrant will play every other entrant exactly one time. So if there were four entrants named a, b, c and d, we would have in this order, a vs b, a vs c, a vs d, b vs c, b vs d, c vs d.

  • You can not copy other entrants code to predict their behavior. You can try to predict entrants behavior, (e.g. analyzing their moves, looking for patterns etc.) but you cannot use their code directly.

  • Multiple submissions are not only allowed, they are encouraged! However, every submission by the same person must be in a different language. Also, no tag-teaming of any sort. Any entrants that attempt tag-teaming will have all of their entrances removed.

\$\endgroup\$
  • \$\begingroup\$ Is the removal of lizard and spock, and the addition of new languages not enough? \$\endgroup\$ – DJMcMayhem Feb 14 '15 at 17:58
  • 3
    \$\begingroup\$ As you say, there is no way to objectively enforce the first rule, so I think it's fairly insubstantial to the challenge, which makes this a duplicate of the existing RPSLV. Furthermore, I don't think it's a good idea to post a KotH before the controller is written. Despite the simplicity of this challenge, you might encounter issues with the challenge design once you write the controller, at which point it would be too late to amend the challenge. I recommend you use the sandbox next time. \$\endgroup\$ – Martin Ender Feb 14 '15 at 17:59
  • 2
    \$\begingroup\$ I like to imagine that people would enjoy the challenge and novelty of using a language that they haven't used before. Also, a quick scan of their profile would reveal whether or not they've answered a question in X language before. \$\endgroup\$ – DJMcMayhem Feb 14 '15 at 18:02
  • 4
    \$\begingroup\$ Learning through having fun is precisely why I am here, so I appreciate the idea of using a new language (despite the problems of enforcing it.) However, we really need to see the controller. \$\endgroup\$ – Level River St Feb 14 '15 at 18:27
  • 1
    \$\begingroup\$ I'd probably vote to reopen if you write a controller. \$\endgroup\$ – KSFT Feb 14 '15 at 21:14

Browse other questions tagged or ask your own question.