Thread: Tetris game

  1. #1
    Registered User
    Join Date
    Jun 2015
    Posts
    1

    Tetris game

    The work is to build a simple tetris game that has 2 parts, every part in different C file( ex21.c and ex22.c ).
    The game need to be running on terminal in linux by the command "./a.out"

    The instructions:
    The first part(ex21.c)-
    Tetris(keyboard listener)-
    write a program that create a son process (fork), the son process will run "draw.out" (the result of command "gcc -o draw.out ex22.c" - the other c file).
    the program need to listen to every char the user click.
    If the user click on one of the chars - q , w , a , s , d. the program need to write to pipe (to the other process) this char and send a signal to the son process(the signal must be SIGUSR2).
    on "q" click the program need to stop properly.

    Tetris(View)-
    ex22.c
    write a program that print a 20X20 board (the border should be with the char "*"), and the game piece that fall should be implement by 3 "-".
    the program need to down the piece one line every second.
    when the program get a SIGUSR2 signal the program need to read from the pipe the char and to act proper.
    for the char "a" - move the piece left.
    for the char "d" -move the piece right.
    for the char "s" - move the piece down.
    for the char "w" - rotate the piece (if possible- if there is not match the border or other piece.)
    for the char "q" -end the program.

    notes -
    1. the rotate of the piece need to be by the middle of the piece.
    2.when the user move the piece right and left the piece still down after 1 second.
    3.before every print of the board use the function system("clear") or any other to clear the last view.
    4.you may use the function "signal" or "sigaction".

    I started the view part so i got the basic of ex22.c file if you need it or want to see the way of thinking.
    I got 2 executable files that show how the game should be look like( i dont got the code itself only a.out and draw.out, a.out is the output of the listener and draw.out is the output of the view, running a.out will call to draw.out).
    I dont see it as a big project for someone who understand how to use pipes, signals, alarms and threading. so the price is not much, but you may offer also.

    I attached the files i got until now for you to take a look and use it in case you need.




  2. #2
    Registered User rstanley's Avatar
    Join Date
    Jun 2014
    Location
    New York, NY
    Posts
    659
    I attached the files i got until now for you to take a look and use it in case you need.
    No, you did not.

    Please read:

    Read before Posting
    Homework
    Forum Rules FAQ
    Posting code? Read this first!

  3. #3
    Registered User
    Join Date
    Jun 2011
    Posts
    4,509
    You were offering $10 here ... now you want it for free?

    so the price is not much, but you may offer also.
    How's this for a deal? I pay $0, and get the satisfaction of knowing a sponge like you has failed to infect the work-force.

  4. #4
    Registered User
    Join Date
    Jan 2013
    Posts
    106
    There are complete programming tutorials independent of language for Tetris online.
    then you only have to worry about the specifics of your particular task.

    I would have been interested to see what you put in, but don’t see the attached code that you referenced.
    No program like that written from scratch really takes such a short time, so I’m not surprised the reaction.

  5. #5
    Registered User rstanley's Avatar
    Join Date
    Jun 2014
    Location
    New York, NY
    Posts
    659
    Quote Originally Posted by xArt View Post
    No program like that written from scratch really takes such a short time, so Iím not surprised the reaction.
    No one here programs a solution in response to a posting, period!

    We are here to answer questions, point out errors in the code posted, and suggest alternatives to parts of what the OP has written.

    Please read the links I provided in my first response to see the well published policies of this web site. These same links can be seen as "Announcements" at the top of the C Programming forum.

  6. #6
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    Please note the forum guidelines, which forbid simply asking people to do all your work for you. Thread closed.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. problem with tetris game...
    By Sokay in forum C Programming
    Replies: 4
    Last Post: 10-11-2009, 03:16 AM
  2. Tetris game
    By Da-Nuka in forum Game Programming
    Replies: 1
    Last Post: 01-16-2005, 09:27 AM
  3. My tetris game 2.0
    By PJYelton in forum Game Programming
    Replies: 12
    Last Post: 04-25-2003, 03:40 AM
  4. Test my new tetris game
    By PJYelton in forum Game Programming
    Replies: 6
    Last Post: 04-19-2003, 05:21 PM
  5. tetris game
    By mrt in forum Game Programming
    Replies: 2
    Last Post: 04-08-2002, 10:01 AM