Jump to content

programming contest


phillip1882

Recommended Posts

so here's my challange. the first place contestant will recieve 10 american dollars from me.

each player will start off with 10000 points. two players will face off at a time, and wager a certian number of points for each turn.

the player with the lower wager will win all the wagered points from the player with the higher.

however, the average of all wagers must be 100 points for each player. (that is, if i select any 100 bets, i should come up with an average of 100 or more for those bets your program produces.)

once a player drops below 100 points, he loses.

the game will be elimination style, once you lose, you're out of the contest.

here's your function definition:

int myusername(int myPoints, int opPoints, int betNum, int[] myBets, int[] opBets){
 int betAmount;  //must average 100 or more over a period of 100 bets.
 /*
 your program goes here.

*/
 return betAmount;
}

 

note that myBets and opBets wil keep track of up to 100 previous bets. you may not keep track of bets yourself.

 

one thing i forgot to note. the most recent bet will be betNum%100; with bets wrapping cylicly. ie on the the 101st bet; the arrays will be...

 

bets = [100th, 101st, 2nd, 3rd, 4th, 5th... 99th]

Link to comment
Share on other sites

What is the nature of the wager? Is it a simple coin toss, or a game with more complex rules?

 

however, the average of all wagers must be 100 points for each player. (that is, if i select any 100 bets, i should come up with an average of 100 or more for those bets your program produces.)

 

Those two conditions aren't quite the same. Average of all bets may not match the average of every subset of 100 bets. If I picked rand(100) or even rand(1000) for my betting function and you ran it for a sufficiently long time, you could pick a subset with average less than 100.

Link to comment
Share on other sites

hmmm good point about the random function.

random 1000 is sufficient or even random 200; random 100 wouldn't be.

 

basically i should see in your submitted code that you are attempting "fair play" and not just always betting 1 point.

 

 

on each turn your basically trying to under bid your opponent. if you do so, you win the bet.

so let's say player 1 wagers 10 points and player 2 wagers 30 points. player 1 wins and gets +30 points, and player 2 gets -30 points (that is he loses that many points from total score).

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.