Discussion in 'C' started by kanaks_go4ex, Aug 18, 2008.
can anyone provide me with some interesting 'C' puzzles to solve ?
There are some good ones on osix.net. They're not specifically C puzzles but you can use C to solve the ones that need a program writing.
can u send me the exact link.
could not find the puzzle.
osix.net. That is the site URL. Can't give you a more exact link, unless you want the http://www bit as well. Once you're on the site, look for the GEEK block on the left and click Challenge.
See the following links
I have a C puzzle for you to solve. Please post the codes here when you're done.
Bonus Item: Any additional functionality other than the specified requirements.
• Develop a game with C that will automatically generate a set of puzzle (2-dimensional array) with integers randomly allocated each time the program is run. The user/player will try to slide those numbers around to solve the puzzle.
• You are free to select the size of the array for your game. Minimum requirement of the board size will be 4 by 4.
• Each square contains the following suggested attributes :
o a variable to store integer
o a variable to store integer as backup copy
o Or any other attributes you think appropriate to your program
Thus, square can be described as “struct” of array in the C programming language.
• The performance of the player will be evaluated based on the number of steps/moves taken to solve the puzzle. However, you are given the freedom to define your own set of criteria to evaluate the performance of a player, please state the rules and instructions of your game clearly at the beginning of the program.
• In order to win the game, the player must arrange all the numbers in either ascending or descending order next to each other (can be in either vertical or horizontal direction)
• In the process of solving the entire puzzle, it is very common to mess up the initial part that has been solved by the player earlier on. So, players should be able to backup their existing layout of puzzle at any time during the game and restore the backup copy in future whenever they need to before the game ends.
• The information of previous players is stored in a plain text data file. The information of all previous players should be displayed at the beginning of the game. User / player will also be prompted to key in their information to be stored in a text file.
• Input to the system is through a DOS command window.
• Output should be printed in the DOS command window or graphics window (optional) to show the latest layout of the board.
• Build options must include strict ANSI/ISO compliance, C99 support.
This program must first prompt the user (in the command window) for the next action to be carried out. (Please provide appropriate menu of actions).
After each action entered by the user, the latest layout of the puzzle will be printed / display.
The user should be able to terminate the program at any time.
The program codes MUST be in functions. DO NOT write all the code in the “main()” function.
Thanks a lot!!! Your help is greatly appreciated!!! =D
Strange thing about this "puzzle" is that it reads just like a homework assignment.
Site's called Go4Expert for a reason. I think you wanted to post this on Go4GullibleIdiot.
Ha-ha, you got me! :p
OK, since I am required to hand in my program in softcopy, they might do a random checking on the net for some plagiarism. So here's what I have done.
My program of number slide puzzle only works for:
-displaying a generated random number(without repeating) in an array of 4 by 4.
-the random number generated is from 0 to 15.
-displaying an empty space when the random number generated equals to 0.
-Any idea on the source code for moving number part?
Just swap the entries in the array (after verifying one of them is zero), then you could either clear the whole screen and redraw all the numbers (easy but the game will flicker horribly, unless you can do all that during the vertical refresh, or if you can do double buffering), or if you have control over the display cursor then clear and redraw the four character spaces involved in the swap.
A bit strange ................
Separate names with a comma.