14 Replies - 950 Views - Last Post: 24 April 2013 - 07:57 PM Rate Topic: -----

#1 Little Horse  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 16
  • Joined: 10-April 13

a programming game

Posted 22 April 2013 - 02:55 AM

Hi,



I've been thinking of a programming game that would be simple to play, but hard to always win.
Here is what i came up with :



- players are programs, written in any language

- only source code can be submitted, all in 1 file (or 1 post)

- players must be deterministic (they can use randomness, but only with a constant seed, so that fights are reproducibles)

- players both start with $100

- repeat

- both players bet some money at the same time (minimum $1) by printing a byte on their standard output

- the player with the biggest bid earn 1 point and $1

- if both players have made the same bid, they earn nothing

- players can then read a byte from their standard input, to know what their opponent played

- until one player has zero dollar

- if a player still has money, its dollars are converted to points and added to its score

- final scores are expressed as percentage of efficiency of a player against another one



What do you think ?

Is This A Good Question/Topic? 0
  • +

Replies To: a programming game

#2 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 3168
  • View blog
  • Posts: 9,581
  • Joined: 05-May 12

Re: a programming game

Posted 22 April 2013 - 06:39 AM

Not a very interesting game.

It will play infinitely because the loser of each round never loses money so the ending condition of one player reaching zero dollars is not met. In other words, the game spec above doesn't say that the loser of a bid loses a dollar. It only states that the winner will win a dollar.

Assuming that it is implied that winner wins only a dollar, and the loser loses at least a dollar, then the winning strategy is always to bid everything. If the other player chickens out and bids less than everything, you earn a dollar, and now you can always bid 101, while they are stuck with bidding at most 99. At this point you'll always be winning.

Pseudo-code:
points = 100;
while(points != 0)
{
    output(points);
    otherPlayer = input();
    if (otherPlayer > points)
        throw exception: other player is cheating! (because they should have started with 100 as well)
    else if (otherPlayer < points)
        points++;
}


This post has been edited by Skydiver: 22 April 2013 - 06:39 AM

Was This Post Helpful? 0
  • +
  • -

#3 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 8375
  • View blog
  • Posts: 31,131
  • Joined: 12-June 08

Re: a programming game

Posted 22 April 2013 - 07:51 AM

Moving this to 'game dev'.
Was This Post Helpful? 0
  • +
  • -

#4 Little Horse  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 16
  • Joined: 10-April 13

Re: a programming game

Posted 22 April 2013 - 09:05 AM

You're right, i forgot to say :

- every bid is lost
Was This Post Helpful? 0
  • +
  • -

#5 jon.kiparsky  Icon User is online

  • Pancakes!
  • member icon


Reputation: 7293
  • View blog
  • Posts: 12,123
  • Joined: 19-March 11

Re: a programming game

Posted 22 April 2013 - 09:08 AM

Very depressing game, then.

"Congratulations, everyone loses."

"Man, I hate this. Let's play again."
Was This Post Helpful? 0
  • +
  • -

#6 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 8375
  • View blog
  • Posts: 31,131
  • Joined: 12-June 08

Re: a programming game

Posted 22 April 2013 - 10:15 AM

I agree - I don't see the 'fun' in this.. So I, the player, would have to gin up some code to try and 'learn' what the other person's code does (with minimal feed back), let it loose, and just.. watch? Ugh.. no, I would rather just do prisoner dilemma matrices for a while.
Was This Post Helpful? 0
  • +
  • -

#7 anonymous26  Icon User is offline

  • D.I.C Lover

Reputation: -4
  • View blog
  • Posts: 3,638
  • Joined: 26-November 10

Re: a programming game

Posted 22 April 2013 - 12:45 PM

Another thumbs down. It's just a boring game that hoards your cash, be it real or virtual.
Was This Post Helpful? 0
  • +
  • -

#8 Little Horse  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 16
  • Joined: 10-April 13

Re: a programming game

Posted 22 April 2013 - 01:51 PM

Ok, one last try :

Score1=0
Score2=0
Money1=100
Money2=100
Repeat
Bet1= GetBetFromPlayer1
Bet2= GetBetFromPlayer2
Money1=Money1-Bet1
Money2=Money2-Bet2
If Bet1>Bet2 then
Score1=Score1+1
Money1=Money1+1
Endif
If Bet2>Bet1 then
Score2=Score2+1
Money2=Money2+1
Endif
Until Money1=0 or Money2=0
Score1=Score1+Money1
Score2=Score2+Money2
If Score1>Score2 then Player1Wins else Player2Wins
Was This Post Helpful? 0
  • +
  • -

#9 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 8375
  • View blog
  • Posts: 31,131
  • Joined: 12-June 08

Re: a programming game

Posted 22 April 2013 - 01:52 PM

... is that supposed to convince folks on the fun factor?

;)
Was This Post Helpful? 0
  • +
  • -

#10 Little Horse  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 16
  • Joined: 10-April 13

Re: a programming game

Posted 22 April 2013 - 02:05 PM

Good point :-p
Was This Post Helpful? 0
  • +
  • -

#11 anonymous26  Icon User is offline

  • D.I.C Lover

Reputation: -4
  • View blog
  • Posts: 3,638
  • Joined: 26-November 10

Re: a programming game

Posted 22 April 2013 - 02:35 PM

lol!
Was This Post Helpful? 0
  • +
  • -

#12 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 3168
  • View blog
  • Posts: 9,581
  • Joined: 05-May 12

Re: a programming game

Posted 24 April 2013 - 11:12 AM

My google-fu is particulary weak today. Anybody remember the name of that game where you basically write a worm in a turing complete like language, and two worm programs battle it out as a battle of the fittest. Good solutions were very good in co-opting the opposing worm code to help your code multiply all the while thinking that it was multiplying itself.
Was This Post Helpful? 0
  • +
  • -

#13 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 8375
  • View blog
  • Posts: 31,131
  • Joined: 12-June 08

Re: a programming game

Posted 24 April 2013 - 11:31 AM

corewars?
Was This Post Helpful? 0
  • +
  • -

#14 jon.kiparsky  Icon User is online

  • Pancakes!
  • member icon


Reputation: 7293
  • View blog
  • Posts: 12,123
  • Joined: 19-March 11

Re: a programming game

Posted 24 April 2013 - 11:47 AM

That's the one. Described in a couple of scientific american columns which you can still find easily. (anyone else remember when sciam didn't suck?)

Unfortunately, it's kind of a solved game at this point.
Was This Post Helpful? 0
  • +
  • -

#15 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 3168
  • View blog
  • Posts: 9,581
  • Joined: 05-May 12

Re: a programming game

Posted 24 April 2013 - 07:57 PM

Yup! Corewars!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1