Securing Higher Grades Costing Your Pocket? Book Your Assignment at The Lowest Price Now!
loader

Phone no. Missing!

Enter phone no. to receive critical updates and urgent messages !

Add File

Error goes here

Files Missing!

Please upload all relevant files for quick & complete assistance.

Guaranteed Higher Grade!

MN404 Fundamentals Of Operating Systems And Programming

tag 0 Download 5 Pages / 1,238 Words tag 28-10-2020

Question:

Write a detailed algorithm and a program that plays the ancient Chinese game of NIM. Actually, this is a simplified version of the game. In this game, the person who runs your program will be one of the two human players, your program will be a simple Artificial Intelligence (AI) that will serve as the other player, as well as provide the narrative for the game and keep score, invite a friend to be the third player. Your program must keep score impartially while participating in the game, but this is not a difficult task for the computer.

Rules of the Game:

  • Number of participating Players: 2 students and 1 computer
  • The player who goes first shall define the number of stones in the pile. The number must be between 30 to 50.
  • Each player then removes some number (between 1 to 3) of stones from the pile in turn until one player removes the final stone.
  • The player who goes first:
  1. Provides the number of stones to be placed in the pile,
  2. Removes the first set of 1 to 3 stones
  • Other player removes a set of 1 to 3 stones
  • The players then take turns(iteration) until the final stone is removed.
  • The player who removes the final stone is the winner (student player 1, student player 2 and the computer).

   The program must perform the following:

  • Use the System I/O (print (), or println()) to introduce and describe the game, Computer shall introduce itself as the AI player, and prompt the human players for his or her names along with MIT Ids.             2 marks
  • The program must use a Scanner object to receive the inputted response.           2 marks
  • The response must be assigned to a properly typed variable.             2 marks
  • Uses printf() to display a greeting to the human player that incorporates the name provided in response to the prompt: Welcome <user’s name> to the game of Taking Stones.4 marks
  • The user’s name must be output in proper name case (i.e., mixed case starting with upper case for the first letter) regardless of the case the user types in.                             4 marks
  • The users shall input the number of stones to be picked either by using a standard random number generator function or may input according to their own strategy but the number should be less than or equal to three (3).   3 marks
    • Java has two ways to generate random numbers
      • Random method from the Java API Math
      • util.random Class and the appropriate method from that class, to generate this number for the human player
    • The program must reject and display a valid message if the number of stones to be removed are either less than one(1) or more than three(3) students and remind them the game constrains.                                                                                                             2 marks
    • Prompt that player to re-enter an appropriate number. 2 marks
    • 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. 4 marks
    • Both the human players shall have their own strategies to play.                        4+4 marks
    • When one of the player has won a game, the program must output a congratulatory message naming the winner along with ID. 4 marks
    • Your program should allow the users 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.  5 marks 

Marking criteria:

Section to be included in the report

Description of the section

Marks

 

 

 

Algorithm

 

 

Program

All the minute details have to be addressed in the algorithm

 

Error free, well commented java program reflecting each line of the algorithm.

42

 

 

42

 

Following points to be considered:

Include appropriate import statements

Include a comment at the beginning of your program with basic information and a description of the program

Your code should be properly indented

Give meaningful names to variables and classes in your code.

Correct use of programming structures

Your program compiles successfully without any errors

Your program is interactive and gives correct output.

Your program should follow all the rules mentioned above.

Sufficient test cases considering all the requirements must be provided with valid and invalid inputs.

 

Draft copy submission in week 10

Students who fail to submit draft copies of both the algorithm and the program shall lose marks.

6

Demonstration and Viva

Tutor will see the outputs and assess your understanding of work done for this assignment in the laboratory class.  This will be done during Week-11 laboratory class.

Please Note: In case the student remains absent during week 11 for demonstration and viva without prior permission for special consideration through AMS, he /she may lose Demo and Viva marks.

10

 

Total

100


Grades

HD>80%

DI (70-79%)

CR (60-60%)

P (50% - 59%)

F (<50%)

Task

Optimal Algorithm devised (logic used) taking into considerations all possible end conditions as defined.

Flawless Code implemented for the devised algorithm without and gap between the algorithm and the program.

Relevant Algorithm devised (logic used) taking into considerations all possible end conditions.

Flawless Code implemented

 

Generally relevant Algorithm devised (logic used) taking into considerations most of the end conditions.

Flawless Code implemented.

Some relevance in the algorithm and few conditions are considered.

The logic used is not relevant.

Demonstration

Logic is clear and easy to follow with strong arguments

Consistency logical and convincing

Mostly consistent logical and convincing

Adequate cohesion and conviction

Not clear with the logic and could not answer simple and basic questions.

Download Sample Now

Earn back the money you have spent on the downloaded sample by uploading a unique assignment/study material/research material you have. After we assess the authenticity of the uploaded content, you will get 100% money back in your wallet within 7 days.

Upload
Unique Document

Document
Under Evaluation

Get Money
into Your Wallet

Total 5 pages

Cite This Work

To export a reference to this article please select a referencing stye below:

My Assignment Help. (2020). MN404 Fundamentals Of Operating Systems And Programming. Retrieved from https://myassignmenthelp.com/free-samples/mn404-fundamentals-of-operating-systems-and-programming/artificial-intelligence.html.

"MN404 Fundamentals Of Operating Systems And Programming." My Assignment Help, 2020, https://myassignmenthelp.com/free-samples/mn404-fundamentals-of-operating-systems-and-programming/artificial-intelligence.html.

My Assignment Help (2020) MN404 Fundamentals Of Operating Systems And Programming [Online]. Available from: https://myassignmenthelp.com/free-samples/mn404-fundamentals-of-operating-systems-and-programming/artificial-intelligence.html
[Accessed 28 January 2023].

My Assignment Help. 'MN404 Fundamentals Of Operating Systems And Programming' (My Assignment Help, 2020) <https://myassignmenthelp.com/free-samples/mn404-fundamentals-of-operating-systems-and-programming/artificial-intelligence.html> accessed 28 January 2023.

My Assignment Help. MN404 Fundamentals Of Operating Systems And Programming [Internet]. My Assignment Help. 2020 [cited 28 January 2023]. Available from: https://myassignmenthelp.com/free-samples/mn404-fundamentals-of-operating-systems-and-programming/artificial-intelligence.html.


Stuck on Any Question

Our best expert will help you with the answer of your question with best explanation.

question
We will use e-mail only for:

arrow Communication regarding your orders

arrow To send you invoices, and other billing info

arrow To provide you with information of offers and other benefits

Phone no. Missing!

Enter phone no. to receive critical updates and urgent messages !

loader
250 words
Error goes here

Error goes here

Files Missing!

Please upload all relevant files for quick & complete assistance.

We Can Help!

Get top notch assistance from our best tutors !
Excel in your academics & career in one easy click!

icon

Other Samples

Content Removal Request

If you are the original writer of this content and no longer wish to have your work published on Myassignmenthelp.com then please raise the content removal request.

icon

5% Cashback

On APP - grab it while it lasts!

Download app now (or) Scan the QR code

*Offer eligible for first 3 orders ordered through app!

screener
ribbon
callback request mobile
Have any Query?
close
Subtraction Payment required!

Only one step away from your solution of order no.