Sudoku with fwh

Re: Sudoku with fwh

Postby Silvio.Falconi » Thu Jan 22, 2015 11:36 am

GOOD
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6786
Joined: Thu Oct 18, 2012 7:17 pm

Re: Sudoku with fwh

Postby Silvio.Falconi » Thu Jan 22, 2015 11:52 am

my cent

first the numbers are Red (readonly) the number are generate by app
but when the user insert a number the cell must be yellow
then when the resolve procedure solve the sudoku
it must see the aOriginal array ( a clone of asudoku)
if the number of cell is the same or space or wrong the cell must be red, it the number is right it must be green
justa an idea
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6786
Joined: Thu Oct 18, 2012 7:17 pm

Re: Sudoku with fwh

Postby Silvio.Falconi » Thu Jan 22, 2015 11:54 am

Uwe,
How I can make to have the number of block,the number of column and the number of row when I move the mouse on a cell ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6786
Joined: Thu Oct 18, 2012 7:17 pm

Re: Sudoku with fwh

Postby ukoenig » Thu Jan 22, 2015 12:17 pm

Silvio,

is this the number-logic You mean ?

Image

best regards
Uwe :?:
Last edited by ukoenig on Thu Jan 22, 2015 4:34 pm, edited 1 time in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Sudoku with fwh

Postby Silvio.Falconi » Thu Jan 22, 2015 12:31 pm

yes I need the number of a block

the cell you selected is block 5 column 4 line 5
Last edited by Silvio.Falconi on Thu Jan 22, 2015 12:47 pm, edited 2 times in total.
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6786
Joined: Thu Oct 18, 2012 7:17 pm

Re: Sudoku with fwh

Postby Silvio.Falconi » Thu Jan 22, 2015 12:43 pm

perhaps ...

osquare:MouseRowPos( nRow )
osquare:MouseColPos( nCol )
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6786
Joined: Thu Oct 18, 2012 7:17 pm

Re: Sudoku with fwh

Postby ukoenig » Thu Jan 22, 2015 4:35 pm

Silvio,

the working block-matrix-calculation,
calculated from the xbrowse click-position ( row / col ) :
( maybe it can be done with using a formular )

Image

Code: Select all  Expand view

FUNCTION C_ACTION(aSudoku, nRPos, nCPos, nNumber)
LOCAL nBlock := 0, nPos := 0

IF EMPTY( aSudoku[nRPos][nCPos] )
    aSudoku[nRPos][nCPos] := nNumber // nNumber = selected number
       
    // MsgAlert( "Row : " + ALLTRIM(STR(nRPos)) + CRLF + ;
        //                   "Col : " + ALLTRIM(STR(nCPos)), "Position" )

    IF  nRPos < 4 // BLOCK 1- 3
        IF nCPos < 3
            nBlock := 1
            nPos := GET_POS( nRPos, nCPos, 1, 1 )  // Row, Col
        ELSEIF nCPos > 3 .and. nCPos < 7
            nBlock := 2
            nPos := GET_POS( nRPos, nCPos, 1, 4 )
        ELSEIF nCPos > 6
            nBlock := 3
            nPos := GET_POS( nRPos, nCPos, 1, 7 )
        ENDIF
    ELSEIF nRPos > 3 .and. nRPos < 7 // BLOCK 4- 6
        IF nCPos < 3
            nBlock := 4
            nPos := GET_POS( nRPos, nCPos, 4, 1 )
        ELSEIF nCPos > 3 .and. nCPos < 7
            nBlock := 5
            nPos := GET_POS( nRPos, nCPos, 4, 4 )
        ELSEIF nCPos > 6
            nBlock := 6
            nPos := GET_POS( nRPos, nCPos, 4, 7 )
        ENDIF
    ELSEIF nRPos > 6 // BLOCK 7- 9
        IF nCPos < 3
            nBlock := 7
            nPos := GET_POS( nRPos, nCPos, 7, 1 )
        ELSEIF nCPos > 3 .and. nCPos < 7
            nBlock := 8
            nPos := GET_POS( nRPos, nCPos, 7, 4 )
        ELSEIF nCPos > 6
            nBlock := 9
            nPos := GET_POS( nRPos, nCPos, 7, 7 )
        ENDIF
    ENDIF
    //MsgAlert( "Block : " + ALLTRIM(STR(nBlock)) + CRLF + ;
        //                   "Pos : " + ALLTRIM(STR(nPos)), "Position" )
ENDIF

RETURN(NIL)

// -------

FUNCTION GET_POS( nRPos, nCPos, nRow, nCol )
LOCAL nPos := 0 // calculated position inside the block-matrix 3x3

//MsgAlert( "Click Row : " + ALLTRIM(STR(nRPos)) + CRLF + ;
//                  "Click Col : " + ALLTRIM(STR(nCPos)) + CRLF + ;
//                  "Top Block Row : " + ALLTRIM(STR(nRow)) + CRLF + ;
//                  "Left Block Col : " + ALLTRIM(STR(nCol)), "Click Position" )

IF      nRPos = nRow .and. nCPos = nCol
    nPos := 1
ELSEIF  nRPos = nRow .and. nCPos = nCol + 1 
    nPos := 2
ELSEIF  nRPos = nRow .and. nCPos = nCol + 2    
    nPos := 3
ELSEIF  nRPos = nRow + 1 .and. nCPos = nCol
    nPos := 4
ELSEIF  nRPos = nRow + 1 .and. nCPos = nCol + 1
    nPos := 5
ELSEIF  nRPos = nRow + 1 .and. nCPos = nCol + 2
    nPos := 6
ELSEIF  nRPos = nRow + 2 .and. nCPos = nCol
    nPos := 7
ELSEIF  nRPos = nRow + 2 .and. nCPos = nCol + 1
    nPos := 8
ELSEIF  nRPos = nRow + 2 .and. nCPos = nCol + 2
    nPos := 9
ENDIF
// MsgAlert( nPos, "Block Position" )

RETURN nPos
 


best regards
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Sudoku with fwh

Postby Silvio.Falconi » Thu Jan 22, 2015 6:02 pm

Uwe how you call caction ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6786
Joined: Thu Oct 18, 2012 7:17 pm

Re: Sudoku with fwh

Postby ukoenig » Thu Jan 22, 2015 6:36 pm

Silvio,

on xBrowse-cellclick :

oSquare:bLClicked := { | nRow, nCol | oText:GoTop(), oText:GoDown( oSquare:KeyNo() -1 ), oSquare:Refresh(), ;
C_ACTION( aSudoku, oSquare:KeyNo(), oSquare:SelectedCol():nCreationOrder, nNumber) }

best regards
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Sudoku with fwh

Postby Silvio.Falconi » Fri Jan 23, 2015 12:26 pm

nNumber ? I not have this variable
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6786
Joined: Thu Oct 18, 2012 7:17 pm

Re: Sudoku with fwh

Postby ukoenig » Fri Jan 23, 2015 12:52 pm

Silvio,

Local nNumber := 0

...
FOR n := 1 TO LEN(oSquare:aCols)
...
// makes it possible, to pick a number < 1 - 9 > from the header ( right mouseclick ) without a needed celledit
oSquare:aCols[ n ]:bRClickHeader := {|r,c,f,o| nNumber :=o:cHeader }
...
NEXT

// The clicked cell will display the selected number from header :

oSquare:bLClicked := { | nRow, nCol | oText:GoTop(), oText:GoDown( oSquare:KeyNo() -1 ), ;
oSquare:Refresh(), C_ACTION( aSudoku, oSquare:KeyNo(), oSquare:SelectedCol():nCreationOrder, nNumber) }


best regards
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Sudoku with fwh

Postby Marcelo Via Giglio » Fri Jan 23, 2015 1:02 pm

Holo,

many years ago (2006) I started to do a Sudoko game, to solve and generate, it can be resized, and accept right mouse click to mark possible solution, you can fill all without use the keyboard (using the numbers in the bar).... it is a early version maybe you can use it and improve

https://app.box.com/s/7j5584ob8fgvfek25a2is9krnsso9zpo

saludos

Marcelo
Marcelo Via Giglio
 
Posts: 1050
Joined: Fri Oct 07, 2005 3:33 pm
Location: Cochabamba - Bolivia

Re: Sudoku with fwh

Postby ukoenig » Fri Jan 23, 2015 8:15 pm

Marcelo,

thank You very much.
I think it is very usefull, getting some new ideas like creating new templates
and saving them to a new file.

Many new functions are included, but there is still a lot to do.
I don't use any extra buttons. Functions are selected from the 2. xBrowse.
The numbers are selected, clicking on the xBrowse-header ( no keyboard is needed ).
I still want to change the font / color, clickking on a empty cell.

Image

best regards
Uwe :)
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Sudoku with fwh

Postby Silvio.Falconi » Fri Jan 23, 2015 11:24 pm

Marcelo Via Giglio wrote:Holo,

many years ago (2006) I started to do a Sudoko game, to solve and generate, it can be resized, and accept right mouse click to mark possible solution, you can fill all without use the keyboard (using the numbers in the bar).... it is a early version maybe you can use it and improve

https://app.box.com/s/7j5584ob8fgvfek25a2is9krnsso9zpo

saludos

Marcelo



thanks Marcelo ,
I made a sudoku on dos and I'm trying to converte it on win
your sudoku app is great!!!
A question How load a new sudoku into ?
I have a file test ... type

001700509573024106800501002700295018009400305652800007465080071000159004908007053
029650178705180600100900500257800309600219005900007046573400021800020453010395000
008203500009670408346050702430010059967005001000496203280034067703500904004107020
800005216045862007670009500769204030020001765001670009004096800907400601306107940
700020548052008000430957106900061700041030695307509001083075469200080350074306000
705002030230100056090536720406081205809004000300095648040053180523000069001429003
740680900060100080012054736307800120008401570490720060209500040500069308106047205
460020905920145680005300004008964302200500800356200490090070003630850710017609208
437205610082060050000301028091807000703950186040006207200798045004003072379002060
002905047507023006036010950610204008005800004048590213200300701870002039069147020
920870605084036079006001008510709020300012087402300960007253100005048702231000804
062100950908035006040029170250000084400502600890463205020357000070006502685004731
001700905305098024690015007908350012400900536032046000089003040203801650050029073
203070016100026704706480030001800490094710062320094080600003005902157048405060903
486051230002070004005840109000568090904000700368094512009130028003085970817600040
902500607003840090014760302601005000000100264237684509306420900000006023429071806
571390240300850009080010035043205001260041750005600820004123500152008096007009410
806047003901083547300900600680090300012376084009800706290760031003502060108400270
508900216090168045406200000360500801829017530000039600705486120040050360680001007
056120400100030906308760105700000000084371692061095078870903204000607800613040709
396050200000369547054001030003600800605003024402895016047030108209108053001570090
204601780100020946806504000307150004460080270010406308639208510000005460540063009
100900300900002001328741659080103004509204800740009216070000003030826075295017068
370069120009415006051000089280100037003257064046900050008301502032604018190080003
903760012760185930010000060600050301035041090401076025209503086150098273008007000
625038970009200005040095302987020030150067009000019587498601053000083640016002090
000048007475030082320709106504820670060170050780060210907012068100380005850090320
080640019120007060096105804001960072067080051230701040910478230072009480300006007
802504600001083975503700800109070000040860291280901507600430059004650320935020060
007008009020056401615970038401792850502001000900005142094580006050023010206040785
601700080048650310007804506400970003739200004020503798562007900910026075000105042
040017809067320040509080320658004913072103408000890000085040632324650790000730000
840605100700002405302049806030407008960081043401006907693504001504010009000903254
030065180120800070850201904090730018201048703308900060709054000003109807510600349



the zero are the number to play
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6786
Joined: Thu Oct 18, 2012 7:17 pm

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 11 guests