Thread: connect4 in C

  1. #1
    Registered User
    Join Date
    Jan 2003
    Posts
    1

    Exclamation connect4 in C

    Hi guys,
    I am a beginner in C, would like to know how u guys would write connect 4 in C ( not C++!)
    All suggestions and programs(via email) are welcome.
    thanks!!

    tahjiun

  2. #2
    mov.w #$1337,D0 Jeremy G's Avatar
    Join Date
    Nov 2001
    Posts
    704
    PHP Code:
    ccccccccccccccccccccccccccccccccccccc
    ccccccccccccccccccccccccccccccccccccc
    ccccccccccccccccccccccccccccccccccccc
    ccccccccccccccccccccccccccccccccccccc
    ccccccccccccccccccccccccccccccccccccc
    ccccccccccccccccccccccccccccccccccccc
    ccccccccccccccccccccccccccccccccccccc 

    It would go on something like that, of course I don't want to give away my complete source for connect four written c.






    get it? See? I made a funny!
    c++->visualc++->directx->opengl->c++;
    (it should be realized my posts are all in a light hearted manner. And should not be taken offense to.)

  3. #3
    Back after 2 years Panopticon's Avatar
    Join Date
    Dec 2002
    Posts
    262
    what a coincidence
    I was experimenting with C++ just a few days ago and made myself a connect 4 console game. Although I used C++, nothing specific to C++ was "needed" to make my program work so I guess its in C. (so much opportunity for puns... must resist)

    anyways, basically you make functions of checking. e.g
    i had the following check routines in this order of execution as part of my AI:
    check for winning move
    check for threat
    check for 'ok' move

    then i had the following neutral functions:
    display
    check for winner
    check for draw
    player move
    computer move

    I wont go into detail of how to make each function because it will become obvious as you make it.

    As you can see, if you think systematically, you can make simple AIs with relatively little skill required. (For advanced AI programming, i think you'll need to think recursively, something my peuny brain is incapable of )
    I AM WINNER!!!1!111oneoneomne

  4. #4
    I lurk
    Join Date
    Aug 2002
    Posts
    1,361
    I made this a LONG TIME AGO. and the code SUCKS. The only copy I still have is the one I posted to this board almost a year ago.

    Check here for ideas: http://cboard.cprogramming.com/showt...&threadid=8222
    Note: The code was written when I was a complete newbie, and it's not very pretty.

  5. #5
    Cheesy Poofs! PJYelton's Avatar
    Join Date
    Sep 2002
    Location
    Boulder
    Posts
    1,728
    If you want an idea of some AI, check out my C4 game on this thread:
    http://cboard.cprogramming.com/showt...threadid=32459
    Its in C++ but you should get the idea by looking at it.

  6. #6
    Registered User
    Join Date
    Sep 2002
    Posts
    1,640

    Re: connect4 in C

    Originally posted by tahjiun
    All suggestions and programs(via email) are welcome.
    So if i post something here i get slapped by you?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Post your games here...
    By Hammer in forum Game Programming
    Replies: 132
    Last Post: 02-28-2013, 09:29 AM
  2. Connect4 update
    By Rutabega in forum Game Programming
    Replies: 1
    Last Post: 01-06-2004, 02:26 PM
  3. Connect4 game
    By ihsir in forum Game Programming
    Replies: 0
    Last Post: 12-25-2001, 01:20 AM