phillip1882 Posted August 23, 2010 Report Posted August 23, 2010 your mission, should you chose to accept it, is to write a program that plays a non random game of rock paper scissors.you will be given three things, your previous set of moves a[], your opponents set of moves b[], and the current round i.each coder can submit up to three programs. once again however, no random functions are allowed. in short, your program should play the same set of moves against the same opponent. i will be hosting the contest in java, but you can write in any language you wish, just provide a description of what yours does.here are some example programs. int rotate(int a[], int b[], int i){ return i%3; } this one just goes through the three moves in order. int beatUsed(int a[], int b[], int i){ int[] moves; int max = 0, index; if(i == 0) return ROCK; moves = new int[3] for(j = 0; j<i; j++){ moves[b[j]]++; } for(j= 0; j< 3; j++){ if(moves[j] > max){ max = moves[j] index = j } } return (moves[index]+1)%3; } this one plays the move that beats the move the opponent has used the most. and here is my first submission. int sqFree(int a[], int b[], int i){ int[] moves; int index = 0; if(i==0) return PAPER; moves = new int[i*3]; for(j = 0; j< i; j++){ if(b[j] == 0){ moves[index] = 1 moves[index+1] = 2 index = index +2 } if(b[j] == 1){ moves[index] = 1 moves[index+1] = 0 moves[index+2] = 2 index += 3 } if(b[j] == 2){ moves[index] = 0 index += 1 } } return moves[int(index/2)]; } this program uses the square free substitution rules to try to respond to my opponent without being predictable.note that most programs will need a static first move. Quote
phillip1882 Posted August 23, 2010 Author Report Posted August 23, 2010 there will be 50 rounds per match, and it will be a round robin tournament. each program that wins by more than 2.5 rounds will get a full point for the victory, else it will be a split point. Quote
alexander Posted September 14, 2010 Report Posted September 14, 2010 I'm trying to figure out what the point of playing this is, whether its a set of moves i present or is it based on a decision i am to make (and thus the program i am to write) with regards to what my next move will be, and see if i can get a better prediction model then the human pre-programmed set of moves? Quote
phillip1882 Posted September 16, 2010 Author Report Posted September 16, 2010 your playing against other human non random algorithms. everyone will have code that generates rock or 0, paper or 1, and scissors or 2, based on what they think their opponent's next move will be. you have your opponents previous set of moves and your own set of moves to work with. basically your goal is to do three things. predict what your opponent's algorithm is, play moves that beat it, and try to remain unpredictable yourself.but the primary point is to have fun! :-) Quote
alexander Posted September 16, 2010 Report Posted September 16, 2010 Ah, ok, i'll write something up, i think that inability to use randomness is a bit of a crippling factor, but i like a good challenge... (just dont complain at crazy code) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.