Find Jobs
Hire Freelancers

java program:Game of NIM

$10-30 USD

ปิดแล้ว
โพสต์ มากกว่า 7 ปีที่ผ่านมา

$10-30 USD

ชำระเงินเมื่อส่งงาน
Draw a flowchart for the algorithm and write a program that plays the ancient Chinese game of NIM. Actually, this is a simplified version of the game. Each game starts with a user-specified number of stones in a pile. The user and the computer take turns removing either one or two stones from the pile. The player who takes the last stone loses. Your program should have the computer use the optimal playing strategy. The optimal strategy is as follows: Divide the remaining number of stones by three. If the remainder is zero, then two stones are removed, or else one stone is removed. For example, if the remaining number of stones is nine or fifteen, then two stones are removed; if the remaining number of stones is eight or ten, then one stone is removed. Your algorithm and program should allow the user to play additional games of NIM as long as he/she enters a “y” or “yes” (lowercase or uppercase) in response to a “Do you want to play again?” prompt. Keep the tally of wins and announce the winner at the end of the program. The tally will include for the player and the computer the number of wins by each and the total number of games played. The “player” with more wins is the winner. In the case where both the player and the computer have the same number of wins, then it is a draw. See the sample output. In addition, your will need to add input validation to your NIM algorithm and program. More specifically, 2 1) ask the user to re-enter the number of starting stones if he/she doesn’t enter an appropriate number, 2) ask the user to re-enter the number of stones to be removed if he/she doesn’t enter an appropriate number, and 3) ask the user to re-enter a “yes/no” response if he/she doesn’t enter an appropriate string. Your game (algorithm and program) is to be well designed – future users and maintainers of this solution would like to have a programmer-friendly, carefully planned design. Sample Output A sample run of the program is shown below. (Note: Bold texts are user input.) : T H E G A M E O F N I M Enter number of starting stones: 7 Would you like to go first? (y/n): yEs How many would you like to remove (1 or 2)? 1 The number of stones left is 6. The computer removes 2 stones. The number of stones left is 4. How many would you like to remove (1 or 2)? 2 The number of stones left is 2. The computer removes 1 stone. The number of stones left is 1. How many would you like to remove (1 or 2)? 1 The number of stones left is 0. The computer wins! Do you want to play again? (y/n): Y Enter the number of starting stones: 4 Would you like to go first? (y/n): n The computer removes 1 stone. The number of stones left is 3. How many would you like to remove (1 or 2)? 2 The number of stones left is 1. The computer removes 1 stone. The number of stones left is 0. You win! Do you want to play again? (y/n): n Results: Computer Wins – 1 Player Wins - 1 Total Games - 2 It is a DRAW! Thank you, good bye!
รหัสโปรเจกต์: 12015247

เกี่ยวกับโปรเจกต์

17 ข้อเสนอ
โปรเจกต์ระยะไกล
ใช้งานอยู่ 7 ปีที่ผ่านมา

กำลังมองหาการสร้างรายได้ใช่ไหม?

ประโยชน์ของการประมูลกับ Freelancer

กำหนดงบประมาณและกรอบเวลาของคุณ
รับเงินจากการงานของคุณ
อธิบายข้อเสนอของคุณในภาพรวม
ลงทะเบียนและเสนอราคาฟรี
17 freelancers are bidding on average $36 USD for this job
รูปอวาตาร์ของผู้ใช้
Hi there, I would like to do this project if given the opportunity. Let me know if you are interested so I can have further details. Thanks.
$30 USD ใน 1 วัน
4.9 (964 รีวิว)
7.5
7.5
รูปอวาตาร์ของผู้ใช้
hi. I have a lot of experience in Java programming. I can easily complete this task for you. we can have a chat. thanks
$50 USD ใน 2 วัน
4.9 (182 รีวิว)
6.6
6.6
รูปอวาตาร์ของผู้ใช้
I am very proficient in java. I have 16 years java developing experience now, and have worked for more than 6 years. My work is online game developing, and mainly focus on server side, using java under linux environment. I used java to make many great projects, for example, I made the tools which can convert java files into c++ scripts, of course garbage collection included, this job is very similar to a compiler, and is very complex. I also made our own mobile game using java, I can show you the demo of client, if you like. I am very proficient in c++ also. I have a very good review on Freelancer.com, I never miss a project once I accept the job, you can check my review. Trust me, please let expert help you.
$120 USD ใน 2 วัน
4.8 (45 รีวิว)
6.0
6.0
รูปอวาตาร์ของผู้ใช้
Hello, I am expert in java/c/c++ and i can deliver your task in the least time and least payments. The code will be well commented and well formatted for better understanding. I believe in long term relations so first check your work then release the payments. Pm me for further details. Thank You!
$80 USD ใน 1 วัน
5.0 (79 รีวิว)
5.2
5.2
รูปอวาตาร์ของผู้ใช้
Hi i'm software engineer and expert java developer. I have experience developing games in java including fps games and simple board games. Please contact me and discus details Regards Usman Shery
$30 USD ใน 0 วัน
4.8 (66 รีวิว)
5.5
5.5
รูปอวาตาร์ของผู้ใช้
Hi Java developer here. I have done this kind of game before(baccarat, tic-tac-toe etc). I can do this work in a day. Thanks for clearly mentioning the requirement and the sample output. I can assure you that you will get your desired solution in a day. Thanks
$20 USD ใน 1 วัน
5.0 (6 รีวิว)
3.3
3.3
รูปอวาตาร์ของผู้ใช้
Hi there, I am a java developer with an experience of 3.5 years in core java,java swing and jdbc app development. Also have 3 years experience in implementing algorithms. I am glad if I could get this project so that I can help you in this project using my skills and make sure you never complain about the work I do. I am waiting for your positive reply. Regards!
$25 USD ใน 1 วัน
5.0 (5 รีวิว)
3.1
3.1
รูปอวาตาร์ของผู้ใช้
hi I am professionally software engineer I have lot of expertise in java and algorithms I will provide quality work according to your requirement I hope you will consider me on your project regards
$60 USD ใน 1 วัน
3.5 (7 รีวิว)
3.5
3.5
รูปอวาตาร์ของผู้ใช้
Hi I'm ready for this project. I'm expert in C# & Java, algorithms. Please give me an opportunity. I will do it perfectly. Best Regards VnNorthStar
$30 USD ใน 3 วัน
2.8 (18 รีวิว)
3.6
3.6
รูปอวาตาร์ของผู้ใช้
A proposal has not yet been provided
$15 USD ใน 3 วัน
5.0 (3 รีวิว)
1.4
1.4
รูปอวาตาร์ของผู้ใช้
I had made the same game like this and it's easy for me to do it again. i will make this game all with java, i will use software NetBeans if it is okay then i m in...
$35 USD ใน 5 วัน
0.0 (0 รีวิว)
0.0
0.0
รูปอวาตาร์ของผู้ใช้
I will develop the game you want in Java with clean and docummented code. The flowchart will be delivered as well
$15 USD ใน 2 วัน
0.0 (0 รีวิว)
0.0
0.0
รูปอวาตาร์ของผู้ใช้
Hello, I have hands on experience on JAVA, MYSQL, J2EE, C, C++. I can assure you that if you work with me once, you will always work with me. Thanks! Priyanka
$13 USD ใน 1 วัน
0.0 (0 รีวิว)
0.0
0.0

เกี่ยวกับลูกค้า

ปักธงของ UNITED KINGDOM
United Kingdom
0.0
0
เป็นสมาชิกตั้งแต่ พ.ย. 8, 2016

การยืนยันลูกค้า

ขอบคุณ! เราได้ส่งลิงก์สำหรับเครดิตฟรีให้คุณทางอีเมลแล้ว
เกิดข้อผิดพลาดขณะส่งอีเมลของคุณ กรุณาลองอีกครั้ง
โลโก้ Freelancer Thailand / ภาษาไทย ช่วยเหลือและสนับสนุน FreelancerประเภทโปรเจคการประกวดFreelancerองค์กรแพ็กเกจสมาชิกโครงการ Freelancer ชั้นแนวหน้าการจัดการโปรเจคงานในพื้นที่Photo Anywhereหน้าจัดแสดงผลงานAPI สำหรับนักพัฒนาได้รับการยืนยันDesktop App เกี่ยวกับเกี่ยวกับเราวิธีใช้งานความปลอดภัยนักลงทุนแผนผังเว็บไซต์เรื่องราวข่าวออกสื่อทีมรางวัลข่าวประชาสัมพันธ์ร่วมงานกับเรา ข้อกำหนดนโยบายความเป็นส่วนตัวข้อกำหนดและเงื่อนไขนโยบายลิขสิทธิ์ข้อพึงปฏิบัติค่าธรรมเนียมและค่าบริการหุ้นส่วนEscrow.comLoadshiftWarrior Forum แอปโลโก้ Apple App Store โลโก้ Google Play
ไม่สามารถคัดลอกไปยังคลิปบอร์ดได้ โปรดลองอีกครั้งหลังปรับเปลี่ยนการอนุญาต
คัดลอกไปยังคลิปบอร์ดแล้ว
ผู้ใช้ที่ลงทะเบียน งานที่มีการโพสต์ทั้งหมด
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
กำลังโหลดตัวอย่าง
ได้รับอนุญาตสำหรับตำแหน่งทางภูมิศาสตร์
เซสชั่นการเข้าสู่ระบบของคุณหมดอายุและคุณได้ออกจากระบบแล้ว กรุณาเข้าสู่ระบบอีกครั้ง