Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Share Your Creations
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Share Your Creations Show your developed application to Basic4ppc community. Please include source code if possible.

Sudoku, another one

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-06-2010, 02:08 PM
klaus's Avatar
Basic4ppc Expert
 
Join Date: Oct 2007
Location: Fully, Switzerland
Posts: 3,827
Awards Showcase
Forum Contributer Beta Tester Competition Winner 
Total Awards: 3
Default Sudoku, another one

Here is my Sudoku program.

There are already 2 of them in the forum, but I did miss some functions so I wrote my own.

What the program does:
- generate grids with 4 levels of difficuties
- show the small numbers
- edit user grids (no solver yet)
- htc look
- program texts in english, french and german (italian, spanish and portuguese can be added in translating existing files and save them with I for italian, S for spanish and P for portuguese as the last character in the text file names (EX. GTextI.txt and SudokuI.txt.
- supports 240*320 and 240*400 screen sizes

Bug reports and improvement suggestions are welcome.

Have fun and Best regards.

EDIT 2010.02.06 : You must also copy the lng directory on the device in the same directory as the program.

EDIT 2010.02.07 Version 1.1 : Fixed problem with unassigned/unused variables.

EDIT 2010.02.08 Version1.2 : Fixed problem when leaving the program.

EDIT 2010.02.11 Version1.3 :
- Added solver, not the best one yet, misses solutions for difficult puzzles
- Added background coloring
- Added background color for 1 and 2 small number cadidates
- Added saving and loading of puzzles

EDIT 2010.02.19 Version 1.5:
- Added editing small numbers
- Added filtering on a small number
Attached Files
File Type: zip Sudoku_V1_5.zip (53.4 KB, 64 views)
__________________
Klaus
Switzerland

Last edited by klaus : 02-19-2010 at 06:30 PM.
Reply With Quote
  #2 (permalink)  
Old 02-06-2010, 02:26 PM
Basic4ppc Expert
 
Join Date: May 2008
Location: Italy
Posts: 541
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Klaus,

I just downloaded your application. I compiled it and ran it on my HTC HD2.

When lauching it on my HTC HD2, I got some initial errors. I just said "continue" and then a I started a new game. So far it seems to work very well. There are some minor problems - for instance, when exiting the application I can't see the message in the msgbox - only Yes or No.

I will test your application better when I have some free time and get back to you soonest with a more precise report.
__________________
rgds,
moster67
Reply With Quote
  #3 (permalink)  
Old 02-06-2010, 02:30 PM
klaus's Avatar
Basic4ppc Expert
 
Join Date: Oct 2007
Location: Fully, Switzerland
Posts: 3,827
Awards Showcase
Forum Contributer Beta Tester Competition Winner 
Total Awards: 3
Default

Did you copy the lng directory to the device, in the same directory as the program ?

That's probably the problem, I forgot to metion this in my post, will add it.

Best reagrds.
__________________
Klaus
Switzerland

Last edited by klaus : 02-06-2010 at 02:33 PM.
Reply With Quote
  #4 (permalink)  
Old 02-06-2010, 02:44 PM
Basic4ppc Expert
 
Join Date: May 2008
Location: Italy
Posts: 541
Awards Showcase
Beta Tester 
Total Awards: 1
Default

No, I didn't.

I now copied it to the device and everything is now working fine!

I will try it more in the next days.

Thanks for the program.


Quote:
Originally Posted by klaus View Post
Did you copy the lng directory to the device, in the same directory as the program ?
__________________
rgds,
moster67
Reply With Quote
  #5 (permalink)  
Old 02-07-2010, 07:13 AM
Senior Member
 
Join Date: Apr 2007
Location: Arlington, Washington USA
Posts: 176
Default

Hi Klaus, nice job on the Sudoku program! For some time now I have had it in mind to write my own version for exactly the reasons you wrote yours. Now I don't have to as you have come very close to what I desired. My favorite desktop version is Simple Sudoku, and your implementation is very similar.

In order to get your program to run, I had to turn off error checking. With error checking on I got numereous errors. Here is a list, in case it helps (error message is followed by the offending line of code):

Variable main.lblcofigtooltip in sub main.app_start is never used
145 lblConfigTooltip=35
146 lblConfigTooltip=1
Variable main.cole in sub main.btndispgrid_click is never used
720 cole = cRed
Variable main.g_resolu is used before it is assigned any value
1467 If g_Resolu Then Return
Variable main.g_resolu in sub main.resout is never used
1473 g_Resolu = True
Variable main.ecolonne is used before it is assigned any value
1603 Groupe = EColonne
Variable main.ecarre is used before it is assigned any value
1606 Else if k = ECarre Then
Variable main.eligne is used before it is assigned any value
1610 Else if k = ELgine Then
Variable main.ecarre is used before it is assigned any value
1615 Groupe = ECarre
Variable main.groupe is used before it is assigned any value
1647 Select Groupe
Variable main.groupe is used before it is assigned any value
1670 Select Groupe

Most of these are in the "Solve Grid" section which you do not have working yet. The first three errors (lines 145, 146, and 720) probably need fixing.

Also, when closing the program (running from desktop IDE) the IDE crashes.

This is a complex program - Lots of work!

Last edited by dlfallen : 02-07-2010 at 07:42 AM. Reason: Add Info
Reply With Quote
  #6 (permalink)  
Old 02-07-2010, 08:55 AM
klaus's Avatar
Basic4ppc Expert
 
Join Date: Oct 2007
Location: Fully, Switzerland
Posts: 3,827
Awards Showcase
Forum Contributer Beta Tester Competition Winner 
Total Awards: 3
Default

Thank's for the bug report.

Unfortunately once in the past I unselected the 'Check for unassingned / unused variables' option and forgot to select it again.

If you find that there are some functionalities missing please let me know.

New version in the first post.

Best regards.
__________________
Klaus
Switzerland
Reply With Quote
  #7 (permalink)  
Old 02-08-2010, 06:01 AM
Senior Member
 
Join Date: Apr 2007
Location: Arlington, Washington USA
Posts: 176
Default

Klaus, your program still has a serious bug, at least on my desktop machine. The AppClose command in the following sub causes a crash regardless of exit method:

Sub frmMain_Close
AppClose
End Sub

Sub frmMain_Close is called from Sub btnExit_Click. If you replace the call to frmMain_Close with AppClose in that Sub, the problem disappears (and, of course, the Sub frmMain_Close Sub becomes unnecessary).

Notice also that if you end the program by clicking btnExit, the following code is executed:
SaveInit
Setup.SetupSave
but this code is bypassed if you terminate by clicking "X" in the upper-righthand corner. One simple fix would be to put the two save commands in the frmMain_Close Sub, with AppClose being the last line in the btnExit Sub.

As far as functionality goes, the two things I miss are
(1) filtering on pairs - that is, cells with only two candidates. Simple Sudoku does this by changing the background color of the selected cell. I'm not sure if it is worth trying to implement in your program, it is only a minor convenience. A more important function is
(2) Color tagging (or what ever you call it). There is an advanced solving method that involves the user coloring certain cells in different colors. Once in a while it is a big help in cracking a very difficult puzzle.

Neither functionality is a deal breaker, however. Your program is quite good just the way it is.

Are you pursuing the solver engine? I found some VB code that solves Sudoku puzzles. Be glad to send it to you if you could use it.

-Dave
Reply With Quote
  #8 (permalink)  
Old 02-08-2010, 01:40 PM
klaus's Avatar
Basic4ppc Expert
 
Join Date: Oct 2007
Location: Fully, Switzerland
Posts: 3,827
Awards Showcase
Forum Contributer Beta Tester Competition Winner 
Total Awards: 3
Default

Hi Dave,

Thank you for the bug report, I hadn't trouble with that but I have changed it now.

Quote:
(1) filtering on pairs - that is, cells with only two candidates. Simple Sudoku does this by changing the background color of the selected cell. I'm not sure if it is worth trying to implement in your program, it is only a minor convenience. A more important function is
Should this be always or only in conjunction with the display of the small numbers? Wouldn't be that complicated.

Quote:
(2) Color tagging (or what ever you call it). There is an advanced solving method that involves the user coloring certain cells in different colors. Once in a while it is a big help in cracking a very difficult puzzle.
Does this only mean to have a function allowing to change a cell's background color? Selecting a color and pointing onto a cell would change it's color ?

Quote:
Are you pursuing the solver engine? I found some VB code that solves Sudoku puzzles. Be glad to send it to you if you could use it.
Yes I'm looking forward to add the solver, I would be pleased if you could send me the VB code,

Best regards.
__________________
Klaus
Switzerland
Reply With Quote
  #9 (permalink)  
Old 02-08-2010, 05:43 PM
Senior Member
 
Join Date: Apr 2007
Location: Arlington, Washington USA
Posts: 176
Default

Hi Klaus:

Filtering on pairs does refer only to candidate pairs. When activated, any cell containing exactly two small numbers would be highlighted (cell background color would change).

Color tagging: You understand it correctly.

One functionality I overlooked is the ability to manually edit the candidates (small numbers). This can be crucial in solving difficult problems.

I'll try to send you the solver VB code in a PM.

-Dave
Reply With Quote
  #10 (permalink)  
Old 02-11-2010, 10:03 PM
klaus's Avatar
Basic4ppc Expert
 
Join Date: Oct 2007
Location: Fully, Switzerland
Posts: 3,827
Awards Showcase
Forum Contributer Beta Tester Competition Winner 
Total Awards: 3
Default

There is a new version 1.3 in the first post.
- Added solver, not the best one yet, misses solutions for difficult puzzles
- Added background coloring
- Added background color for 1 and 2 small number cadidates
- Added saving and loading of puzzles

@dlfallen.
I haven't added the editing of small numbers. Is this necessary, becaus the small numbers can be displayed automatically.
I have translated the source code of the solver, you sent me, from VB to B4PPC. Unfortunately it is nor able to find solutions for difficult grids. I will look for an other one.

Best regards.
__________________
Klaus
Switzerland
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Blakodo Sudoku Obelix Share Your Creations 3 04-17-2009 04:32 PM


All times are GMT. The time now is 01:20 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0