CSIE, EE: Introduction to Computers (II)
(Corrected by red marks.)
Project 1, Due 5/2 (Monday) 截止日期延後至期中考後
※ 因競賽確實無法排除機率,會使得評分不公正,所以取消競賽,評分以原始程式直接評分。
※ 評分後,若時間許可,將在電腦教室示範某些同學 (若可以匿名處理) 作業結果,由人出題給
程式猜,純粹觀摩,不另作加分。
A Game of Guessing Three Numbers
Example files: GUESS.C, guess.exe
1. This is a two-player game. Each player sets a private code composed of three distinct digits between 1 and 9, for example, 217 or 356. Then, both players alternately keep guessing the private codes of their opponents. An
xayb
answer is replied where 0 <= x <= 3, 0 <= y <= 3, x+y<=3. The number x is the number of correct digits in a guess, while the number y is the number of incorrect digits which appear in the private code. For example, if the private code is 217, then the replies should be given for the following guesses:
Guess: 217, reply: 3a0b.
Guess: 271, reply: 1a2b.
Guess: 123, reply: 0a2b.
2. Use GUESS.C as the template of the guessing game. Inside GUESS.C, try to design the C function
int guess_proc(int new_game)
such that your program can correctly find your opponent's private code.
Writing your own program without using GUESS.C is all right. The GUESS.C is only for your reference.
3. There is a contest on 4/13(EE) or 4/14(CSIE).
The arrangements of the players will be randomly generated on the contest day.
CS_Contest.doc, EE_Contest.doc, Sort.exe
4. Basic score is 80 if the function guess_proc(int new_game) is much better designed. For example, an good algorithm is implemented. ("The size of the codes in this function is more than 200" is canceled.) More points are given:
+3: Win one game.
+6: Win two games.
+9: Win three games.
+12: Win four games.
+15: Win five games.
+18: Win six games. The champion.
5. ftp your homework to
in the directory EE\PJ1 (EE class) or CSIE\PJ1 (CSIE class)
by the following format:
主旨:pj1_班級_學號
檔案名稱:pj1_班級_學號.c
例如:電機一B同學,
主旨:pj1_EE_a0925124
檔案名稱:pj1_EE_a0925124.c
資工一同學,
主旨:pj1_CS_a0925124
檔案名稱:pj1_CS_a0925124.c
The password is given in class.