• C

Connect4 Game

How do you code a Connect4 game?

-two players (represented each by a special symbol, i.e. 1 for player 1 or 2 for player 2 and 0 for empty entries)
-fixed size 8 by 8 table
-using a 2D array but 1D array to keep track of most bottom empty entry of each column in the board
-have a function that checks if a winning occurs after a specific player made a specific move. It must take the 2D array representing the board, player making the move, and the coordinates of that move( column: given by you as input, and row: generated automatically) as arguments
-have four constants TABLESIZE, PL1, PL2 and EMPTY.  #define them properly and they have to be used throughout the code

Since I'm just learning C language, I would appreciate it if there is no use of advanced C language so I can understand it.  Basically, this is to help me out in understanding Arrays.

Thanks alot in advance.  Hope to hear from you guys on what you think.
cooldeanAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

trifusionCommented:
Palm apps are almost all only in C, here is a good starting point:

http://freshmeat.net/projects/coconutfern/

Greg
cooldeanAuthor Commented:
How do I see the code though?
SethHoytCommented:
cooldean,

Please stop asking people to solve homework-type problems for you. You really need to try to do some of it yourself, then others can help to correct your errors and give you additional direction.

Try to do part of it, like setting up the main function, etc. then we can help you further.

-Seth
SolarWinds® IP Control Bundle (IPCB)

Combines SolarWinds IP Address Manager and User Device Tracker to help detect IP conflicts, quickly identify affected systems, and help your team take near instantaneous action. Help improve visibility and enhance reliability with SolarWinds IP Control Bundle.

cooldeanAuthor Commented:
First of all, everyone who posts here knows to give hints and not completey solve the problem.  

Second, what does it matter if it is homework or not.  If you answer questions on here, you get the points.  Who cares if that person uses it for homework, throws it to the garbage, or shows it to the President of the United States?  

Third, no one is forcing anyone to answer questions.  If you want to answer the question, answer it.  If not, then don't.  

And finally, I have set up the main functions.  I ask it on here to 1) move on from the main function and/or 2) see what I'm missing.


Anyways, back to the problem...a Connect4 game.  
SethHoytCommented:
"Second, what does it matter if it is homework or not."

It is against EE policy to solve homework problems or to ask for solutions to them. See here:

http://www.experts-exchange.com/help/member.jsp#12
http://www.experts-exchange.com/help/mistakes.jsp#7


-Seth
cooldeanAuthor Commented:
Like I said, people who post here direct you to the solution.

The policy is fine with that:

:What you CAN do is guide an asker through the process of figuring out their homework. To put it at its most ridiculously sublime: You can teach a person to count, but don't tell him that 2 + 2 = 4. "

Anyways, I don't want to get in a debate with you.  All I'm asking for is help on coding a Connect4 game.  I'm not asking anyone to write the entire code for me, but just to guide me in writing the main parts for it.


trifusionCommented:

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C

From novice to tech pro — start learning today.