Em Andamento

The Game of NIM - open to bidding

this lab is really not that hard. Much easier than the last one. It should just be a little tricky, and fun. Reinforcing your new programming skills.

This is a well known game with little tricks.

The game is played with two players alternately take marbles from a pile. In each move, a player chooses how many marbles to take. The player must take at least one but at most half of the marbles. Then the other players takes a turn. The player who takes the last marble loses.

Write a program in which the computer plays against a human opponent.

Generate a random integer between 10 and 100 to represent the original stack of marbles.

Generate another random number between 0 and 1 to determine who goes first, computer or player.

Generate another random number between 0 and 1 to determine if the computer plays smart or stupid.

In stupid mode the computer simply takes a random number of marbles between 1 and n/2 (n being the total marbles).

In smart mode the computer takes off enough marbles to make the size of the pile a power of two minus 1 -- that is 3, 7, 15, 31 or 63. (example 2^2 - 1 = 3 and 2^3 - 1 = 7 and 2^4 - 1 = 15). This will always work unless the pile is 1 less than ppower of 2, so in that case the computer will take a random legal move.

See if you can beat the computer if it goes first, if you programmed it correctly you can't.

Grading

This will be graded on the program working, by allowing a human player to play against the computer following the rules and a winner is decided.

Proper programming skills, good clear variable definitions, good class structure, and the proper use of methods will all be graded. As well as properly commented code.

Turn in

Your program will be due 5pm December 3rd. No late assignments will be accepted. Turn in what you get done if you don't finish it. All assignments should be turned in to your lab TA.

Habilidades: Java

Ver mais: variable computer programming, programming definitions, programming computer game, play nim game, nim number, nim game rules, nim game play, nim game java code, nim game code, last nim, programming fun, computer programming hard, play nim, get good programming, hard computer programming, game nim java code, game nim, fun december, first lab, first computer programming, december fun, programming random number, computer programming skills, computer programming game, computer game programming

Acerca do Empregador:
( 2 comentários ) BOZEMAN, United States

ID do Projeto: #5147294

Premiar a:

theincredible

Dear Sir, I am expert java programer, and I am clear with this game requirements, I guarantee that I can complete it in one day with the best quality. Thanks and regards, Yasser

$16 USD / hora
(18 Avaliações)
4.9

7 freelancers estão ofertando em média $17/hora para este trabalho

apr159

Hello I can help you working in your project. I have experience on NIM from my experience teaching AI. If you accept it and create milestone I can finish it today. Thanks

$25 USD / hora
(38 Comentários)
5.5
SlohVeeN

Acctually i have ALREADY FINISHED your assignment, so if you want to test it, I can send it to you. If you want any changes or clarification it can be done asap. I will accept minimum payment, (one hour of work,15 usd, Mais

$15 USD / hora
(0 Comentários)
0.0
lexeyka

I have 5 years java experience. I am a software engineer since school. It seems to me that this assignment is easy and there will be no technical problems.

$16 USD / hora
(0 Comentários)
0.0
codelangthang

I have over ten years experiences in java develop with many framework and technologies of java. i'm available to server your project..

$16 USD / hora
(0 Comentários)
0.0
jeffvincent

Hello, I am eager to work on your project. I know that I could write you a high quality program to meet your needs. Here are some samples of my work: http://www.astre471.org/jeff/portfolio/autodecrypt/autodecrypt- Mais

$15 USD / hora
(0 Comentários)
0.0
JoaoCarlosCG

A proposal has not yet been provided

$15 USD / hora
(0 Comentários)
0.0