Here is my entire C code for my friend - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Here is my entire C code for my friend

tienkhoanguyentienkhoanguyen houPosts: 158Member


  • IcepickleIcepickle GermanyPosts: 49Member

    here i happily give you a javascript implementation of it i wrote in 2.5 hours ;)


  • tienkhoanguyentienkhoanguyen houPosts: 158Member
  • tienkhoanguyentienkhoanguyen houPosts: 158Member

    i love you. haha the program works - i told you that you are the best ;)

  • usman121212usman121212 pakistanPosts: 1Member

    nice ... play online games at Mr bean games

  • IcepickleIcepickle GermanyPosts: 49Member

    Your code runs, and compiles, and it is playable.

    Your sourcecode however is "a mess". It shows that you have started with basic, and never really touched the topic of OOP programming. I don't really know that many programs which are written inside a single method, and only uses goto statements. Your code is something, which is referred to as Spaghetti Code

    Now, i understand that for such a program, structure might not be required. As you are the only one who is editting the source code, it might also not be a problem for you now to write such a code.

    However, the cost of maintaining, and understand your code will greatly increase with the time you are not checking your source code. Making changes to the game structure in your current design will make it a virtual rewrite.

    Say that i would need to change the size of the tic-tac-toe grid, then i only need to change 1 nr, nl the size given to the tic-tac-toe board (which is currently 3), all algorithms still work and also the game drawing will still work. I cannot say that would be that easy in your case?

    Now, the fact i could do it so fast, is simply because it's not the first time i'm writing a game, i am a programmer in daily live (all be it, software for companies, not games). I try to keep all requirements of an application separated (drawing, logic, interaction, ...), make programs by writing small blocks of code that only work on 1 problem at the time :)

    If you really want a challenge, then, try to program this one in C ;)


  • tienkhoanguyentienkhoanguyen houPosts: 158Member

    Somewhere along the line I do not know what happened to me. I have lost my will to really do anything. Tic-Tac-Toe was the only thing I could think of one day waking up. I did actually consider the board size and so forth. It was originally written in Basic and works for the Samsung Galaxy smartphones. It has music and so forth. I also did a version for Microsoft Windows XP, Vista, etc. However, found that it was not compatible with all computers due to some of the old computers not having graphics. That was why I chose DOS. It is popular enough that anyone with Microsoft Windows could run it. Of course for 64-bit Microsoft Windows, you need DOSbox to emulate 16-bit mode. However, 32-bit versions seems to work fine. So in this version I was merely showing off the pure thinking part. I wanted people on any computer to be able to play my game. I know it is ugly to look at however I hope that the logic was "talented" enough to hook people onto the game. Whether it be a quick game or a long round, I hoped that it would be FUN for everyone. In fact, to be honest, even though I programmed it one day out of the blue and it took me 3+ months of inspirations, I do not really play it myself. These days, I have to say that I have lost my will to do anything else at the moment. I do not know why that is. In fact, I am obsessed with Borland Turbo C 2.01 and I just managed to get a hold of the entire C manuals for it. Did you know that back in 1988 it was $450 or so for this software? Anyways, at that time I was a student and bought it for academic price. As for your Pac-Man challenge, I am not really up for a challenge because it would mean a lot of my time. Thinking drains a lot of effort from me. These days I am old and weak. I am not like normal people who can have energy like some 80 years olds who still run around. I am disabled to tell you the truth in more ways than one. My physical endurance is short. I might be able to lift heavy, however, I need to lay down or sit in one place often. Anyways, I think your Pac-Man is pretty amazing. You are totally out-classing me in every way. You say you work for a company in your daily life programming and it shows. That is why they hire you. I am too slow and too irregular for a company to hire me. That is why I depend on everyone's help.

  • tienkhoanguyentienkhoanguyen houPosts: 158Member

    Jesus Christ!hehe I looked at your code and it is impressive. It seems very clean and efficient. I am impress that the Pac-Man seems to travel along a path. I personally would have not thought of that. I would have sensed the walls and allowed it to flow along the the walls. Your programming is fast and impressive. If you want to see something I did here is another source code however I am using graphics.h which is proprietary to Borland. So if you do not have graphics.h you probably won't be able to compile it.!630&authkey=!AOmeMDf7--xgzGQ&ithint=file,C

  • tienkhoanguyentienkhoanguyen houPosts: 158Member

    Jesus! Well, I know my code is a mess however I am able to keep track of it. The reason I decided not to pretty it up is because if I pretty it up I would be doing it for appearances. I wanted it to work. Also it is a lot of repetition however changing 1 small thing like the square size is also doable. It is just work that I prefer instead of using too many variables. The way that you are talking about actually makes it harder on me to remember. Just my personal preference. ;)

  • IcepickleIcepickle GermanyPosts: 49Member
    edited August 28

    Thank you for the comments on my code, in all honesty, that was not the first time i wrote pacman, but the browser environment was more "challenging/fun".

    About your live story, i cannot say anything, i am not even an observer in it, though i did notice your "cries for help", so in that sense, i wish you the best.

    Your logic towards C, and especially Turbo C, is for me purely a nostalgic/irrational one, wishing for simpler times perhaps, i do have days where i program stuff with qbasic 7, but apart from the occasional thrill of returning to the language with started it all, i am happy that programming has evolved.

    About your code:

    Not to get you down, but if all you are drawing is a square (with 1 pixel missing at 350, 350), then you can do it easier with the rectangle function

    further more

    your loop could could simply use the for statement, which is much easier readable:

    for (x = 0; x < 350; x++) {
        for (y = 0; y < 350; y++) {
            putpixel(x, y, 15);

    in programming, one can not stand still, you have to grow...

    -> one exception, if you learn Cobol, you might actually get a high paying job, where you don't have to be fast/the master, nobody knows the language anymore but still plenty of systems are running on it (banks, goverments) and most of the current programmers are retiring ;)

  • tienkhoanguyentienkhoanguyen houPosts: 158Member

    To return the favor, I do have Common Business Oriented Language experience. hehe It just so happens that I have programmed many languages in my community college days. However, it has been a while since I used Formula Translation and stuffs that are related to serious sides of the trade. I only have 2 years of college though. However, I love you for caring. I do know my programming is simpler however I try not to use things that are too many words. It is funny however I try to apply my textbook theories of living over to my programming style. For instance, "Keep it simple silly, etc! hehe" As for the block, you are very observant with the missing pixel. I had to smile at that one.

Sign In or Register to comment.