Jump to content


Welcome to BrainDen.com - Brain Teasers Forum

Welcome to BrainDen.com - Brain Teasers Forum. Like most online communities you must register to post in our community, but don't worry this is a simple free process. To be a part of BrainDen Forums you may create a new account or sign in if you already have an account.
As a member you could start new topics, reply to others, subscribe to topics/forums to get automatic updates, get your own profile and make new friends.

Of course, you can also enjoy our collection of amazing optical illusions and cool math games.

If you like our site, you may support us by simply clicking Google "+1" or Facebook "Like" buttons at the top.
If you have a website, we would appreciate a little link to BrainDen.

Thanks and enjoy the Den :-)
Guest Message by DevFuse
 

Photo
- - - - -

Rock Paper Scissors Lizard Spock


  • Please log in to reply
4 replies to this topic

#1 phil1882

phil1882

    Senior Member

  • Members
  • PipPipPipPip
  • 543 posts

Posted 07 July 2013 - 10:54 PM

I've always thought that the rock paper scissors programming contest hosted by bonanova was one of the funnest.

I've tried this contest before without much success here, but i would like to try one more time before giving up.

the goal is the following. write a program that plays rock paper scissors lizard spock against another such program.

each program will receive as input all it's previous moves, all opponents previous moves, and the round number. the only "strict" rule is no random functions. you are of course allowed to write pseudo random number generators if you really want,

but most code submissions should hopefully be deterministic.

if you aren't much of a programmer, you may submit to me your general idea and ill try to code it for you.

here would be some example programs:

 

def only_rock(my[],op[],i):

   return ROCK

def rotate_moves(my[],op[].i):

   return i%5

def beat_previous(my[],op[],i):

   if i == 0:

      return PAPER

   else:

      return (op[i-1]+2)%5

you may of course write as complicated or as simple programs as you desire. may the best coder win!


  • 0

#2 BMAD

BMAD

    Senior Member

  • Members
  • PipPipPipPip
  • 1696 posts
  • Gender:Female

Posted 07 July 2013 - 11:36 PM

Spoiler for i hope C++ counts

 

my code relies on the user to input their move then mine tells what it plays.


Edited by BMAD, 07 July 2013 - 11:37 PM.

  • 0

#3 phil1882

phil1882

    Senior Member

  • Members
  • PipPipPipPip
  • 543 posts

Posted 08 July 2013 - 12:35 AM

CMAD, this is completely unnecessary, i already have the tournament code.

your objective is to write a code that plays ROCK PAPER SCISSORS LIZARD SPOCK.

note that random functions are not allowed.

and you won't be competing against a computer, you'll be competing against other programs. written by other people.

so for example someone may write the beat previous move program i have as an example above. so you want to try to write code that will beat as many deterministic ROCK PAPER SCISSORS LIZARD SPOCK players as possible.


  • 0

#4 phil1882

phil1882

    Senior Member

  • Members
  • PipPipPipPip
  • 543 posts

Posted 08 July 2013 - 12:39 AM

here's my code for the tourney, written in python.

Spoiler for

  • 0

#5 phil1882

phil1882

    Senior Member

  • Members
  • PipPipPipPip
  • 543 posts

Posted 08 July 2013 - 01:13 AM

edit:

slight code correction.

Spoiler for

  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users