Department of Computer Science and Engineering, IIT Kanpur

CS245: Algorithms

Dr. R. K. Ghosh


Home | Notice Board | Instructor | TAs | Students | Assignments | Schedule | Lectures | Resources


Assignment 4
Deadline for submission : 7 March 2003, Midnight
   The fourth assignment is to write a program(in C/C++) which will act as a player for a simple game to pick coins,in which the one who picks the last coin loses the game.

  The organization of coins is as shown in the figure.

 

 Rules of the game

Code requirements:

  •     The aim of your code is to act as a player. Only thing you have to do is plan your strategy for the game.
  •   A move can be specified as  a sequence of integers denoting the coin to be picked separated by comma.   eg:     1) If   you are to pick coins numbered 1, 2 and 4, then the move string will  be "1,2,4".                           2) If the other player picks the coins    7, 11 and 16 then the moves2 string will be "7,11,6 ".             

--------------------------------------

Detection of malpractice:

     For each of the game conducted, the moves involved in it(of both the players) will be recorded, and any malpractice,(i.e, copying of programs) will be detected by an automated tool which will operate on this log file... So be aware of. copying of programs is dangerous!

Note

  • Your work is to develop a player program
  • Write the program in C/C++ only.
  • You will have to provide the executable file of your player program, games will be conducted (i.e your programs will be executed), in the presence of two players and TAs
  • Please put fflush(stdout); before scanf statement in your program

Home | Notice Board | Instructor | TAs | Students | Assignments | Schedule | Lectures | Resources


Page last updated 24 Feb, 2003 by Parag S. Mogre