Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   'C' puzzles (http://www.go4expert.com/forums/c-puzzles-t13035/)

kanaks_go4ex 18Aug2008 23:30

'C' puzzles
 
can anyone provide me with some interesting 'C' puzzles to solve ?

thanx.

xpi0t0s 19Aug2008 13:12

Re: 'C' puzzles
 
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.

kanaks_go4ex 25Aug2008 01:13

Re: 'C' puzzles
 
can u send me the exact link.
could not find the puzzle.

xpi0t0s 25Aug2008 22:59

Re: 'C' puzzles
 
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.

ungalnanban 26Feb2010 10:04

Re: 'C' puzzles
 
See the following links

http://www.scribd.com/doc/6674318/C-Puzzles

http://www.gowrikumar.com/c/

http://www.go4expert.com/showthread.php?t=1373

GummyBaby 23Nov2011 20:01

Re: 'C' puzzles
 
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.

Specifications:
• 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.
Functionality
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

xpi0t0s 24Nov2011 04:43

Re: 'C' puzzles
 
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.

GummyBaby 24Nov2011 16:45

Re: 'C' puzzles
 
Quote:

Originally Posted by xpi0t0s (Post 89500)
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?

xpi0t0s 24Nov2011 20:46

Re: 'C' puzzles
 
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.

sura 9Dec2011 23:29

Re: 'C' puzzles
 
A bit strange ................


All times are GMT +5.5. The time now is 19:15.