Sudoku Programmers Forum Index

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log inLog in          Games  Calendar

Log in to check your private messagesLog in to check your private messages   

How many lines of code.
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Sudoku Programmers Forum Index -> Solving sudoku
View previous topic :: View next topic  
Author Message
eclark

Joined: 28 Dec 2005
Posts: 70
:

Items
PostPosted: Thu Jan 26, 2006 2:01 am    Post subject: How many lines of code. Reply with quote

How many lines of code are everyone's solvers ? I'm just curious what the largest and smallest and average are.

Code:
wc -l *.{h,cpp}
     76 coloring.h
     40 constants.h
     66 crosshatcher.h
     59 fishy.h
     51 printer.h
     51 reader.h
     60 rowbox.h
     45 solver.h
     70 square.h
     79 subsets.h
  16422 table.h
     45 uniquness.h
    338 coloring.cpp
     84 constants.cpp
    167 crosshatcher.cpp
    310 fishy.cpp
    161 printer.cpp
    109 reader.cpp
    410 rowbox.cpp
     36 solver.cpp
    109 square.cpp
    445 subsets.cpp
    173 supersudoku.cpp
     34 uniquness.cpp
  19440 total


That include comments and blank lines

Not including those we have a total of 18738

Thats with no gui code included. I'm still debating a gui or a web interface. Or what I'm going to do.

16408 of which are my number of bits lookup table.... hehe trade off space for speed.
Back to top
View user's profile Send private message
eclark

Joined: 28 Dec 2005
Posts: 70
:

Items
PostPosted: Thu Jan 26, 2006 2:10 am    Post subject: Reply with quote

Blah sorry its in the wrong forum. It can be moved to programming forum I guess. sorry.
Back to top
View user's profile Send private message
marty

Joined: 09 Jan 2006
Posts: 1
:

Items
PostPosted: Thu Jan 26, 2006 5:32 am    Post subject: Reply with quote

about 300 lines in C
Back to top
View user's profile Send private message
Miles

Joined: 29 Dec 2005
Posts: 30
:

Items
PostPosted: Fri Jan 27, 2006 8:49 am    Post subject: Reply with quote

About 3500 lines, with a GUI, but no advanced techniques as X-Wings Sad
Back to top
View user's profile Send private message Visit poster's website
Ruud
Site Admin
Joined: 17 Sep 2005
Posts: 708
:
Location: Netherlands

Items
PostPosted: Fri Jan 27, 2006 10:48 am    Post subject: Reply with quote

Sudo Cue is written in 43 source files, 15562 lines of code in total, with (an estimated) 30% consumed by comments, whitespace and outlining.

The largest code file defines the log entries and has 2817 lines of code. The DLX solver has 75 lines of code.

There are 9 files with a total of 5227 lines of code used for the GUI. Most of this code is maintained with a visual GUI designer, which saves its code in a very inefficient way if you count lines.

769 lines of HTML are used for the help files.

(I thought it would be more, but I've rewritten parts of the program so often, that I should also count the discarded lines of code)

Ruud.
_________________
Meet me at sudocue.net
Back to top
View user's profile Send private message Visit poster's website
norvig

Joined: 28 Jan 2006
Posts: 1
:

Items
PostPosted: Sat Jan 28, 2006 11:33 pm    Post subject: 150 Reply with quote

I needed 150 lines of Python to solve the 50 puzzles at
http://mathschallenge.net/index.php?section=project&ref=view&id=96

-Peter
Back to top
View user's profile Send private message Visit poster's website
Henk

Joined: 13 Nov 2005
Posts: 105
:

Items
PostPosted: Mon Jan 30, 2006 8:13 pm    Post subject: Reply with quote

About 19000 lines of code and comments in my object oriented solver written in C++/MFC with user interface. There are 128 source/header files and about 250 html files. The program is 1 executable of 2.6Mb.

http://www.intosudoku.com/

I support most techniques like box line reduction, naked subsets, hidden subsets, pointing pairs, remote pairs, x-wing, xy-wing, xyz-wing, swordfish, colors, multicolors, forcing chains, uniqueness tests and nishio.
_________________
Generate and solve Sudoku puzzles with Into Sudoku!


Last edited by Henk on Fri Feb 03, 2006 11:59 pm; edited 1 time in total
Back to top
View user's profile Send private message
evert

Joined: 30 Aug 2005
Posts: 68
:
Location: Amsterdam

Items
PostPosted: Fri Feb 03, 2006 10:51 pm    Post subject: Reply with quote

1721 lines
includes comments, alignment, user interface
Back to top
View user's profile Send private message Send e-mail
Alvaro

Joined: 16 Feb 2006
Posts: 1
:
Location: New York (USA)

Items
PostPosted: Thu Feb 16, 2006 1:48 pm    Post subject: Reply with quote

I tried wrote a sudoku solver a couple of days ago. It took me about two hours to make it work, and it has 136 lines of code.

After that I read this article and now I know that what I wrote is a solver that uses only naked singles and backtracking. I was surprised at how well such a simple technique works.
Back to top
View user's profile Send private message MSN Messenger
dfhwze

Joined: 15 Feb 2006
Posts: 6
:

Items
PostPosted: Thu Feb 16, 2006 6:31 pm    Post subject: Reply with quote

3672 lines ,spaces & comment included, a class for a square and one for the puzzle

these methods i use:

singles
naked/hidden subsets
n-gonks n=1,2,3,... (seafood)
unit-interactions
xy-wings xyz- wxyz- vwxyz- ...
discontinious y-cycles


i still need to look through my code to make it much smaller.

If one wants to make a solver with at least as possible lines i think
the most important thing is the preset, meaning how one's interpretation
of the creation of the puzzle (without any solver methods) is.

my preset:
I don't believe the way i do it, is the best, but it works very nicely for me.
Every cell is a new instance of the cell-class which has the following members : row , col , block , possibilitites , candidates
The puzzle itself is a cell-class-array of 81 cell instances.

from this i start making solver methods ...
Back to top
View user's profile Send private message
rwaddilove

Joined: 17 Mar 2006
Posts: 5
:

Items
PostPosted: Fri Mar 17, 2006 1:51 pm    Post subject: Most code has little to do with solving Reply with quote

Most of the code in a soduko program has little to do with solving the puzzle. There are zillions of lines to do with the windows, buttons, dialogs, menus and so on. The actual solver can be very small - 4 lines:

1 sp(cell(ptr))=(sp(cell(ptr)) + 1) mod 10
2 if sp(cell(ptr))=0 then ptr=ptr+1:goto 1
3 if countnum(cell(ptr))=3 then ptr=ptr-1
4 if ptr>-1 then goto 1

This assumes:
sp(80) is sudoku puzzle
cell(80) is list of blank cells
ptr is last blank cell in list
countnum() counts how many times a number occurs in a row/column/block

You could write a fully working program in 20 lines. However, it would not be very user friendly or very attractive. It takes an hour to write a solver and a month to create a fun user interface!
Back to top
View user's profile Send private message Visit poster's website
whizter

Joined: 19 Jul 2007
Posts: 30
:

Items
PostPosted: Tue Jul 31, 2007 12:35 pm    Post subject: Reply with quote

Does someone know of a free SLOC counter or something like this for Eclipse SDK or is there a way to display the lines of code of a project in a vanilla Eclipse installation? My object-oriented java solver has lots of source-files and there's no wc program in windows.

EDIT: Finally I used cygwin:
Code:

$ find .|grep .java$|xargs wc -l
  202 ./AbstractUnit.java
   18 ./Block.java
  261 ./Cell.java
   22 ./Column.java
   21 ./Row.java
   98 ./Solver.java
  117 ./strategies/GenericSeafoodScanner.java
   65 ./strategies/GenericSubsetScanner.java
   95 ./strategies/HiddenPairScanner.java
  109 ./strategies/HiddenTripleScanner.java
   26 ./strategies/JellyfishScanner.java
   94 ./strategies/LockedCandidateScanner.java
   67 ./strategies/NakedPairScanner.java
   25 ./strategies/NakedQuadScanner.java
   25 ./strategies/NakedQuintScanner.java
   25 ./strategies/NakedTripleScanner.java
    9 ./strategies/Scanner.java
   56 ./strategies/SingleScanner.java
   26 ./strategies/SwordfishScanner.java
   56 ./strategies/tools/CombinationGenerator.java
   41 ./strategies/tools/SudokuVerifier.java
   18 ./strategies/tools/TestCG.java
  197 ./strategies/XColorScanner.java
   26 ./strategies/XWingScanner.java
  110 ./strategies/XYWingScanner.java
  115 ./SudoCruncher.java
  159 ./Sudoku.java
 2083 total


I have to admit that this is a commandline solver, with a GUI the number of lines would be a bit higher. Wink
Back to top
View user's profile Send private message
humble_programmer

Joined: 27 Jun 2006
Posts: 69
:
Location: Colorado Springs, USA

Items
PostPosted: Tue Jul 31, 2007 8:56 pm    Post subject: Reply with quote

The current version of Soo is 2,060 C# SLOC--not including the GUI or Unit Test code--and you can download it from http://www.humble-programmer.com/bb_sudoku.htm.

If you are looking for an open source code metrics tool, try http://csse.usc.edu/research/CODECOUNT/. Beware though, this tool parses and counts "executable statements" (as opposed to "lines of source code") so the numbers will probably be a lot lower than expected!
_________________
Cheers!
Humble Programmer
,,,^..^,,,
www.humble-programmer.com
Back to top
View user's profile Send private message Visit poster's website
whizter

Joined: 19 Jul 2007
Posts: 30
:

Items
PostPosted: Tue Jul 31, 2007 9:57 pm    Post subject: Reply with quote

Thanks. Here's a statistic from that tool:

Code:

The Totals
   Total   Blank |      Comments     |  Compiler  Data    Exec.  |  Number  |          File  SLOC
   Lines   Lines |   Whole  Embedded |  Direct.   Decl.   Instr. | of Files |   SLOC   Type  Definition
------------------------------------------------------------------------------------------------------------------------------------
    2083     340 |     140         3 |       63     375     1165 |     27   |    1603  CODE  Physical
    2083     340 |     140         3 |       63     162      978 |     27   |    1203  CODE  Logical
       0       0 |       0         0 |        0       0        0 |      0   |       0  DATA  Physical

Number of files successfully accessed........................    27 out of 27

Ratio of Physical to Logical SLOC............................     1.33
Back to top
View user's profile Send private message
NewUrbanBlues

Joined: 22 Oct 2006
Posts: 36
:

Items
PostPosted: Sat Sep 01, 2007 1:24 pm    Post subject: Reply with quote

Isanaki 2.0 is a C++ MFC Application

Solver is about 6500 lines of code ... Additional 15000 lines for GUI, file handling, log, ...

Thierry
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Sudoku Programmers Forum Index -> Solving sudoku All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Sudoku Programmers topic RSS feed 


Powered by phpBB © 2001, 2005 phpBB Group

Igloo Theme Version 1.0 :: Created By: Andrew Charron