Jump to content
  • Advertisement
Sign in to follow this  
subflood

Lines in tic-tac-toe

This topic is 5119 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
I'd guess about 300 or 400, yeah. What do you mean "lazy code"?
The number of lines of code in an application really doesn't matter. You could probably write tic-tac-toe in about 50 lines, but it would be horrible. Or you could write it in 1000 lines, with loads of flashy (console mode) graphics.

Share this post


Link to post
Share on other sites
Well, the number of lines of code won't really help you judge that. If you write down an algorithm first, and try to stick to it when coding, that'll help. E.g.
Draw board
Draw lines
Draw X's
Draw O's
Get Input
Ask player for board position (1-9)
Get position
Check position is valid
Etc etc.

Share this post


Link to post
Share on other sites
mine is kinda more flashy than that. It actually uses windows!!! console windows using the ncurses library that is.

BTW before starting a project like tic-tac-toe would you first plan and then start coding?

Share this post


Link to post
Share on other sites
Quote:
Original post by subflood
BTW before starting a project like tic-tac-toe would you first plan and then start coding?


The most important thing is ofcourse to figure out the maximum lines of code that you allow!!!!

/MindWipe

Share this post


Link to post
Share on other sites
I wrote mine in 155, including comments. So 300 should be plenty.

The difference with a game like tic-tac-toe is that it is very easy to plan. Infact, Evil already planned it for you. But writing out how you want your program to run is very crucial for large scale projects. Its good to get the practice with small ones, and normally leads to more legible, more constructed, and faster programs.

Share this post


Link to post
Share on other sites
It takes as many lines as it takes, really. The way to tell if you wrote too much is to look for duplication. And if you find some, fix it!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!