'C' puzzles

Discussion in 'C' started by kanaks_go4ex, Aug 18, 2008.

  1. kanaks_go4ex

    kanaks_go4ex New Member

    Joined:
    Jun 11, 2008
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    0
    can anyone provide me with some interesting 'C' puzzles to solve ?

    thanx.
     
  2. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,009
    Likes Received:
    203
    Trophy Points:
    63
    Occupation:
    Senior Support Engineer
    Location:
    England
    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.
     
  3. kanaks_go4ex

    kanaks_go4ex New Member

    Joined:
    Jun 11, 2008
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    0
    can u send me the exact link.
    could not find the puzzle.
     
  4. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,009
    Likes Received:
    203
    Trophy Points:
    63
    Occupation:
    Senior Support Engineer
    Location:
    England
    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.
     
  5. ungalnanban

    ungalnanban New Member

    Joined:
    Feb 19, 2010
    Messages:
    45
    Likes Received:
    2
    Trophy Points:
    0
    Location:
    Chennai
  6. GummyBaby

    GummyBaby New Member

    Joined:
    Nov 23, 2011
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Student
    Location:
    Melbourne
    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
     
  7. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,009
    Likes Received:
    203
    Trophy Points:
    63
    Occupation:
    Senior Support Engineer
    Location:
    England
    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.
     
  8. GummyBaby

    GummyBaby New Member

    Joined:
    Nov 23, 2011
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Student
    Location:
    Melbourne
    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?
     
  9. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,009
    Likes Received:
    203
    Trophy Points:
    63
    Occupation:
    Senior Support Engineer
    Location:
    England
    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.
     
  10. sura

    sura Banned

    Joined:
    Aug 4, 2011
    Messages:
    47
    Likes Received:
    1
    Trophy Points:
    0
    Location:
    India,Tamil Nadu.
    A bit strange ................
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice