Page 1 of 1

Soduku

Posted: Thu Jun 18, 2015 4:40 pm
by Realizimo
An old interest since many years, but not finished, any comments?

sorry for the swedish in code.

Code: Select all

EnableExplicit
#metoder=23+6
InitSprite()
InitKeyboard()
InitMouse()

#screenX=800
#screenY=600

 OpenWindow (1, 0, 0, #screenX , #screenY , "",1+#PB_Window_BorderLess   )
 OpenWindowedScreen ( WindowID (1) , 0, 0, #screenX , #screenY , 0, 0, 0 ,1 )
;OpenScreen(#screenX, #screenY, 16, "",#PB_Screen_NoSynchronization)
;SetFrameRate(60)

UseJPEGImageDecoder()
LoadImage(0,"sudoku.jpg")

Global.s data1 , Dim sudokunamn(200) , singletyp,ink
Global.l Dim col(40),Font2 , Dim urt(#metoder),ElapsedTime,looptime
Global.w Dim allsudoku(200, 8, 8),Dim  tal(8, 8), Dim kandidat(8, 8, 9), Dim ur(#metoder)
Global.w size,upl,sizex,sizey,xp=1,yp=1,l_butt
Global.w sudoku,sudoku_l,sudoku_h,flagg1,org,max_sudoku,singles_s
Global.w xx=9,yy,tt,ur,failed,Dim failed(174),upd
Global.w xm,ym
Define.w a,n,y,x,sl


#size =13
Declare loop()
Declare test_if_ok()
Declare byt_soduku(sudok.w)
Declare erasekandidat_all()
Declare erasekandidat1(x.w, y.w)
Declare erasekandidat2(x.w ,y.w ,tal.w ,a.w)
Declare singles_all()
Declare nolla_cand()
Declare test_all()
Declare uppdatera(t)
Declare organize()

Declare kandidatsok_alround(oppen_gomd.w, cell_x_y_hus.w, steg.w)

Declare rad_vs_box_x_a()
Declare rad_vs_box_y_a()
Declare rad_vs_box_x_b()
Declare rad_vs_box_y_b()

Declare X_vinge()
Declare y_vinge()
Declare X3_vinge()
Declare Y3_vinge()

Declare AlertThread1(Parameter)
CreateThread(@AlertThread1(), 0)
;  col(0)=0
;  col(1)=0
col(2)=#Yellow ;cell
col(4)=#Gray  ;hus
col(6)=RGB(128,200,255)  ;x
col(8)=#Green    ;y
col(10)=#Red     ;y

Font2 = LoadFont ( #PB_Any , " Verdana ", 20, #PB_Font_Bold) 
Global.s Dim upd(3)
upd(0)="never"
upd(1)="every sudoku"
upd(2)="every move"
upd(3)="every sudoku & move"

Global.s Dim oppen_gomd(1), Dim par(4) ,Dim cell_x_y_hus(3)
oppen_gomd(0)="Öppen "
oppen_gomd(1)="Gömd "
par(2)="2'a i "
par(3)="3'a i "
par(4)="4'a i "
cell_x_y_hus(1)="X-led "
cell_x_y_hus(2)="Y-led "
cell_x_y_hus(3)="Hus "
;{
Global.s Dim metod(#metoder)
Global.w cand_adv,cand_tot,s_st,s_so,s_left,s_tot
a=0
a+1:metod(a)="Ordinary start"
a+1:metod(a)="Ordinary singel"
a+1:metod(a)="Manual"
a+1:metod(a)="Naked par i x-led"
a+1:metod(a)="Naked par i y-led"
a+1:metod(a)="Naked par i hus"
a+1:metod(a)="Hidden par i x-led"
a+1:metod(a)="Hidden par i y-led"
a+1:metod(a)="Hidden par i hus"
a+1:metod(a)="Naked Triples i x-led"
a+1:metod(a)="Naked Triples i y-led"
a+1:metod(a)="Naked Triples i hus"
a+1:metod(a)="Hidden Triples i x-led"
a+1:metod(a)="Hidden Triples i y-led"
a+1:metod(a)="Hidden Triples i hus"
a+1:metod(a)="x-led vs box v.1"
a+1:metod(a)="y-led vs box v.1"
a+1:metod(a)="x-led vs box v.2"
a+1:metod(a)="y-led vs box v.2"
a+1:metod(a)="X vinge"
a+1:metod(a)="y vinge"
a+1:metod(a)="X3 vinge"
a+1:metod(a)="Y3 vinge"

a+1:metod(a)="Advanced":cand_adv =a
a+1:metod(a)="Total": cand_tot =a

a+1:metod(a)="Singles from Start": s_st  =a
a+1:metod(a)="Singles Solved":     s_so  =a
a+1:metod(a)="Singles Left":       s_left=a
a+1:metod(a)="Singles tot":        s_tot =a
;}

Global.w Dim choose(30)
For a=1 To #metoder-6:choose(a)=1:Next a

;{
Global.w Dim qq1(6, 9)
data1 = "111000000000111000000000111"
For x = 0 To 6 Step 3
    For y = 1 To 9
        n = n + 1
        qq1(x, y) = Val(Mid(data1, n, 1))
    Next y
Next x : n = 0
;}
;{ 
Global.w Dim qq2(9, 2)
data1 = "231312564645897978"
For a = 1 To 18 Step 2
    n = n + 1
    qq2(n, 1) = Val(Mid(data1, a, 1))
    qq2(n, 2) = Val(Mid(data1, a + 1, 1))
Next a : n = 0
;}
;{ 
Global.w Dim qq3(9, 3)
data1 = "147147147417417417714714714"
For a = 1 To 27 Step 3
    n = n + 1
    qq3(n, 1) = Val(Mid(data1, a, 1))
    qq3(n, 2) = Val(Mid(data1, a + 1, 1))
    qq3(n, 3) = Val(Mid(data1, a + 2, 1))
Next a : n = 0
 ;}
;{ 
Global.w  Dim ypos2(3, 9, 9), Dim xpos2(3, 9, 9)
data1 = "000102101112202122030405131415232425060708161718262728303132404142505152333435434445535455363738464748565758606162707172808182636465737475838485666768767778868788"
n = 1
For a = 2 To 3
For y = 1 To 9
For x = 1 To 9
ypos2(1, x, y) = y - 1
xpos2(1, x, y) = x - 1
ypos2(2, x, y) = x - 1
xpos2(2, x, y) = y - 1
If a = 3
ypos2(3, x, y) = Val(Mid(data1, n, 1))
xpos2(3, x, y) = Val(Mid(data1, n + 1, 1))
n = n + 2
EndIf
Next x
Next y
Next a
;}
;{ 
Global.w Dim kpx(9), Dim kpy(9)
data1= "001020011121021222"
For a = 1 To 9
kpx(a) = Val(Mid(data1, a * 2 - 1, 1))
kpy(a) = Val(Mid(data1, a * 2, 1))
Next a
;}
;{ 
Global.w Dim cellposx(8, 8), Dim cellposy(8, 8)
data1= "000000303030606060000000303030606060000000303030606060030303333333636363030303333333636363030303333333636363060606363636666666060606363636666666060606363636666666"
n = 1      
For y = 0 To 8
For x = 0 To 8
;Label1.Text = x
cellposx(x, y) = Val(Mid(data1, n * 2 - 1, 1))
cellposy(x, y) = Val(Mid(data1, n * 2, 1))
n = n + 1
Next x
Next y
 ;}         
;{
If ReadFile(0, "sudokus.txt")   ; if the file could be read, we continue...
    While Eof(0) = 0           ; loop as long the 'end of file' isn't reached         
    data1 = ReadString(0)
    n = 0
    max_sudoku + 1
    For y = 0 To 8
        For x = 0 To 8
            n = n + 1
            allsudoku(max_sudoku, x, y) = Val(Mid(data1, n, 1))
        Next x
    Next y
    sudokunamn(max_sudoku) = Mid(data1, n + 2, Len(data1) - 82)
    Wend
    CloseFile(0)               ; close the previously opened file
  Else
    MessageRequester("Information","Couldn't open the file!")
  EndIf
  ;}
  
sudoku_l=1 :sudoku_h=174;174
loop()

Procedure loop()
  Protected.w sudok=2 ,a,kp=4,xp1,yp1
  Protected.f delv
  upd=0
  byt_soduku(sudok)
  uppdatera(0)
  
  ;ReleaseMouse(0)
  ;ShowCursor_(1)
  
Repeat
;If WindowEvent()=#PB_Event_CloseWindow :End:EndIf
WindowEvent()

ExamineKeyboard()
If KeyboardPushed(#PB_Key_Insert)And sudoku_l<sudoku_h :sudoku_l+1:EndIf
If KeyboardPushed(#PB_Key_Delete)And sudoku_l>1   :sudoku_l-1:EndIf 

If KeyboardPushed(#PB_Key_Home)And sudoku_h<max_sudoku :sudoku_h+1:EndIf
If KeyboardPushed(#PB_Key_End)And sudoku_h>sudoku_l   :sudoku_h-1:EndIf  

If KeyboardPushed(#PB_Key_PageUp)And sudok<max_sudoku:sudok+1:byt_soduku(sudok):EndIf
If KeyboardPushed(#PB_Key_PageDown)And sudok>1 :sudok-1:byt_soduku(sudok):EndIf  

If KeyboardPushed(#PB_Key_Return):byt_soduku(sudok):EndIf 
If KeyboardPushed(#PB_Key_T):test_if_ok():EndIf


; If KeyboardReleased(#PB_Key_K): erasekandidat_all():EndIf
; If KeyboardReleased(#PB_Key_S): singles_all():EndIf
; If KeyboardReleased(#PB_Key_0): nolla_cand():EndIf
If KeyboardPushed(#PB_Key_RightControl):upd+1:upd & 3:EndIf

If KeyboardPushed(#PB_Key_Up)And yp>0 :yp-1:EndIf
If KeyboardPushed(#PB_Key_Down)And yp<26 :yp+1:EndIf
If KeyboardPushed(#PB_Key_Left)And xp>0 :xp-1:EndIf
If KeyboardPushed(#PB_Key_Right)And xp<26 :xp+1:EndIf
If (KeyboardPushed(#PB_Key_K) Or l_butt=1) And choose(3)=1
  
  
  xp1=xp/3: yp1=yp/3 : kp=yp%3*3+xp%3+1
  ur=0:org=3
  If kandidat(xp1,yp1,kp)& 1 ;!=xor
    kandidat(xp1,yp1,kp)=10 : ur=1 : ur(org)+ur : ur(cand_tot)+ur
  Else  
    kandidat(xp1,yp1,kp)=1 : ur=-1 : ur(org)+ur : ur(cand_tot)+ur
  EndIf
  
EndIf
If   l_butt:uppdatera(0):  l_butt=0:delv=15:EndIf
;----------------------
If KeyboardPushed(#PB_Key_M) 
  nolla_cand()
  ur=0
  org=organize()
  ur(org) +ur
  
  If org=2:ur(s_so)+1:EndIf
  ur(s_left)=   81 - ur(s_so) - ur(s_st)
  ur(s_tot)=      ur(s_so) + ur(s_st)
  
  If org>2:ur(cand_adv)+ur:EndIf
  ur(cand_tot)+ur
EndIf
; ---------------------
If KeyboardPushed(#PB_Key_A): test_all():EndIf
If KeyboardPushed(#PB_Key_F): delv=0:EndIf
If KeyboardPushed(#PB_Key_All) :delv *0.80:uppdatera(0):Else: delv=15:EndIf
If KeyboardPushed(#PB_Key_Escape):End:EndIf
For a=1 To delv

  ExamineKeyboard()
  Delay(20)  
  If Not KeyboardPushed(#PB_Key_All): Break:EndIf  
Next a
ForEver
EndProcedure

Procedure test_all()
  Protected.w a,x,y,number,singles,sudok
  failed=0:org=0
  For a=0 To #metoder:urt(a)=0:Next a
  ElapsedTime=0
  sudok=sudoku_l:byt_soduku(sudok):uppdatera(0)
  looptime = ElapsedMilliseconds()
    
  For sudok=sudoku_l To sudoku_h;174      
    If WindowEvent()=#PB_Event_CloseWindow :End:EndIf  

   If upd & 1 :uppdatera(1):Delay(200):EndIf
    byt_soduku(sudok)    
    Repeat
      g:
      ExamineKeyboard()
      If KeyboardPushed(#PB_Key_P) :Delay(20):Goto g:EndIf
      If KeyboardReleased(#PB_Key_Escape) : ProcedureReturn:EndIf
      If upd & 2 :uppdatera(1) : EndIf
      nolla_cand()
      ur=0
      org=organize()
      ur(org) + ur      
      If org=2 : ur(s_so)+1 : EndIf
      ur(s_left)=   81 - ur(s_so) -  ur(s_st)
      ur(s_tot)=      ur(s_so) +  ur(s_st)
      If org>2:ur(cand_adv)+ur:EndIf
      ur(cand_tot)+ur
    Until org=0
    For a=1 To #metoder : urt(a) + ur(a) : Next a
    urt(s_left)=  (sudoku_h-sudoku_l+1)*81 - urt(s_so) -  urt(s_st)
    If ur(s_tot)<81 : failed(failed)=sudok:failed+1 :EndIf
  Next sudok
  
uppdatera(1)
EndProcedure

Procedure uppdatera(t)
Protected.w x,y,number,a,b,rad
ClearScreen(0)
If t :ElapsedTime = ElapsedMilliseconds()-looptime :EndIf
StartDrawing (ScreenOutput())  
  DrawImage(ImageID(0),400,100)
  DrawingMode(#PB_2DDrawing_Transparent)
  
  Box(402+xp*#size, 102+yp*#size, 12, 12,#Green)
 ; Box(xm*#size-1, ym*#size-2, 12, 12,#Blue)
  
  ;Box(xp*39+402+kpx(kp)*#size,yp*39+102+kpy(kp)*#size,12,12,#Green)
  
  DrawText(414,rad,Str(sudoku) + "  "+sudokunamn(sudoku),#Yellow):rad+20
  DrawText(650,rad,"update:  " + upd(upd))
  DrawText(414,rad,"singletyp:  "+singletyp):rad+20
  
  DrawText(414,rad,"kandidat typ:  "+metod(org)):rad+20
  
  DrawText(414,rad,"sudoku start:  "+Str(sudoku_l)):rad+20
  DrawText(414,rad,"sudoku stop :  "+Str(sudoku_h)):rad+450
  

  
  
;   DrawText(500,600,ink+"       "+Str(xp1)+" "+Str(yp1)+" "+Str(kp))
;   DrawText(314,rad,"x :  "+Str(xm)):rad+20
;   DrawText(314,rad,"y :  "+Str(ym))
  
  For a=1 To #metoder
    If choose(a):Box(13*#size, 39+a * #size, 8, 8,#Green):EndIf;HH
    If a=cand_adv :y+1:EndIf
    If a=s_st:y=34:x=400 :EndIf
    y+1
    DrawText(x+190, 34+y*#size, metod(a),RGBA(255, 0, 255, 0),RGBA(0,0,0,0))
    If ur(a):DrawText(x+135, 34+y * #size,Str(ur(a))):EndIf
    If urt(a) And a<>s_st:DrawText(x+50, 34+y*#size,Str(urt(a))):EndIf
  Next a
  If ur: DrawText(105, 34+org*#size,Str(ur),#Yellow):EndIf
  
  DrawText(50,0, Str(failed)+ " failed")
  DrawText(220, 0,StrF(ElapsedTime/1000,3)+" sek")
  For a=0 To failed-1 : DrawText(0,a*#size, Str(failed(a))) : Next a
  
  DrawingFont(FontID(font2))
  For x=0 To 8
    For y=0 To 8
;       DrawingFont(FontID(font2))
;       DrawingMode(#PB_2DDrawing_Transparent )
      
;       
;       If tal(x, y)&16: DrawText(x*39+414, y*39+106, Str(tal(x, y)&15),#Blue)
;         ElseIf tal(x, y)&15: DrawText(x*39+414, y*39+106, Str(tal(x, y)),0) :EndIf
;       
      If tal(x, y)&15: DrawText(x*39+414, y*39+106, Str(tal(x, y)&15),0) :EndIf
      If tal(x, y)&16: DrawText(x*39+414, y*39+106, Str(tal(x, y)&15),#Blue):EndIf
      If tal(x, y)&32: DrawText(x*39+414, y*39+106, Str(tal(x, y)&15),#Yellow):EndIf
      If xx<9:DrawText(xx*39+414, yy*39+106, Str(tal(xx, yy)&15),#Red):EndIf
      
    
    
    For a=1 To 9
          If kandidat(x, y, a) :Circle(x*39+409+kpx(a)*12,y*39+109+kpy(a)*12,3,col(kandidat(x, y, a))):EndIf
        Next a
    Next y
  Next x
  
StopDrawing()
FlipBuffers()
EndProcedure

Procedure organize()
If choose(1):  If flagg1=0 :erasekandidat_all():nolla_cand():ProcedureReturn 1 :EndIf:EndIf
If choose(2):  If singles_all() : erasekandidat1(xx, yy):ProcedureReturn 2: Else : xx=9:EndIf:EndIf
If choose(4):kandidatsok_alround(0, 1, 2):If ur : ProcedureReturn 4:EndIf:EndIf; par x , x-led
If choose(5):kandidatsok_alround(0, 2, 2):If ur : ProcedureReturn 5:EndIf:EndIf; par x , y-led
If choose(6):kandidatsok_alround(0, 3, 2):If ur : ProcedureReturn 6:EndIf:EndIf; par x , hus
If choose(7):kandidatsok_alround(1, 1, 2):If ur : ProcedureReturn 7:EndIf:EndIf; par x , gömd, x-led
If choose(8):kandidatsok_alround(1, 2, 2):If ur : ProcedureReturn 8:EndIf:EndIf; par x , gömd , y-led
If choose(9):kandidatsok_alround(1, 3, 2):If ur : ProcedureReturn 9:EndIf:EndIf; par x , gömd , hus
If choose(10):kandidatsok_alround(0, 1, 3):If ur : ProcedureReturn 10:EndIf:EndIf; trippel x, x-led
If choose(11):kandidatsok_alround(0, 2, 3):If ur : ProcedureReturn 11:EndIf:EndIf; trippel x , y-led
If choose(12):kandidatsok_alround(0, 3, 3):If ur : ProcedureReturn 12:EndIf:EndIf; trippel x , hus
If choose(13):kandidatsok_alround(1, 1, 3):If ur : ProcedureReturn 13:EndIf:EndIf; trippel x , gömd, x-led
If choose(14):kandidatsok_alround(1, 2, 3):If ur : ProcedureReturn 14:EndIf:EndIf; trippel x , gömd , y-led
If choose(15):kandidatsok_alround(1, 3, 3):If ur : ProcedureReturn 15:EndIf:EndIf; trippel x , gömd , hus  
If choose(16):rad_vs_box_x_a():If ur : ProcedureReturn 16:EndIf:EndIf
If choose(17):rad_vs_box_y_a():If ur : ProcedureReturn 17:EndIf:EndIf
If choose(18):rad_vs_box_x_b():If ur : ProcedureReturn 18:EndIf:EndIf
If choose(19):rad_vs_box_y_b():If ur : ProcedureReturn 19:EndIf:EndIf
If choose(20):X_vinge() :If ur : ProcedureReturn 20:EndIf:EndIf
If choose(21):y_vinge() :If ur : ProcedureReturn 21:EndIf:EndIf
If choose(22):X3_vinge():If ur : ProcedureReturn 22:EndIf:EndIf
If choose(23):Y3_vinge():If ur : ProcedureReturn 23:EndIf:EndIf
EndProcedure

Procedure erasekandidat1(x.w, y.w)
  Protected.w a,  newcellposx, newcellposy,number
  number = tal(x,y)&15
;Ta bort kandidater i cell "enkel eleminering" (z-led)        
  For a = 1 To 9:erasekandidat2(x, y, a,6):Next a
;Ta bort kandidater i Hus "enkel eleminering" (x/y led)
  For a = 1 To 9
    newcellposx = cellposx(x, y) + kpx(a)
    newcellposy = cellposy(x, y) + kpy(a)
    erasekandidat2(newcellposx, newcellposy, number,6)
  Next a
;Ta bort kandidater i X-led "enkel eleminering"
  For a = 0 To 8:erasekandidat2(a, y, number,6):Next a
;Ta bort kandidater i Y-led "enkel eleminering" 
  For a = 0 To 8:erasekandidat2(x, a, number,6):Next a
EndProcedure

Procedure erasekandidat2(x.w , y.w , tal.w , a.w)
  If kandidat(x,y,tal)&1
    kandidat(x,y,tal)=a
    ur + 1 
    ProcedureReturn 1
  EndIf
EndProcedure
  
Procedure erasekandidat_all()
  Protected.w number,x,y
    flagg1=1    
    For y = 0 To 8
      For x = 0 To 8
        number = tal(x, y)
        If number : erasekandidat1(x, y):EndIf
      Next x
    Next y
    ;+++++ ="multi"
    ProcedureReturn ur(s_so)
EndProcedure

Procedure test_if_ok()
  Protected.w number_test,x,y,a,b,test
   xx=10
    For y = 0 To 8
      For x = 0 To 8
        number_test = tal(x, y)
        If number_test
          test=0
        For a = 0 To 8
          If tal(a, y)&15=number_test&15:test+1:EndIf          
        If test>1 :tal(x, y)&15+32:uppdatera(0):EndIf
        Next a
         EndIf
      Next x
    Next y
EndProcedure
      

Procedure   byt_soduku(sudok.w)
  sudoku=sudok
  xx=9
  flagg1=0
  singles_s=0
  Protected.w x,y,a
    For y = 0 To 8
      For x = 0 To 8
          tal(x, y) = allsudoku(sudoku, x, y)
          If tal(x, y) :singles_s+1:EndIf
          For a = 1 To 9
            kandidat(x, y, a) = 1
          Next a
      Next x
    Next y

 For a=0 To #metoder:ur(a)=0:Next a
 ur(s_st)=singles_s
EndProcedure
    
Procedure singles_all()
Protected.w x,y,t,raknare
;  xx=9
For y=0 To 8
  For x=0 To 8
    raknare=0
    For t=1 To 9        
      If kandidat(x, y, t)&1 :raknare + 1 
        If raknare > 1 : Break: EndIf  
        xx=x : yy=y : tt=t
      EndIf
    Next t
    If raknare = 1 : tal(xx, yy)=tt|16:singletyp = "cell": ProcedureReturn 1:EndIf
  Next x    
Next y
  
Protected.w x1, y1,x2,y2
For x=0 To 6 Step 3
  For y=0 To 6 Step 3
    For t = 1 To 9
      raknare = 0
      ;   x2 = cellposx(x, y)
      ;   y2 = cellposy(x, y)
      For x1=0 To 2: x2=x+x1
        For y1=0 To 2: y2=y+y1    
          If kandidat(x2, y2, t)&1 :raknare + 1 
            If raknare > 1 : Break 2: EndIf
            xx=x2 : yy=y2 : tt=t
          EndIf    
        Next y1
      Next x1
      If raknare = 1 : tal(xx, yy)=tt|16 : singletyp = "hus" : ProcedureReturn 1:EndIf  
    Next t
  Next y
Next x

For x=0 To 8
  For t = 1 To 9   
    raknare = 0
    For y=0 To 8
      If kandidat(x, y, t)&1 :raknare + 1 
        If raknare > 1 : Break : EndIf
        xx=x : yy=y : tt=t
      EndIf    
    Next y    
    If raknare = 1 : tal(xx, yy)=tt|16 : singletyp = "column" : ProcedureReturn 1 :EndIf    
  Next t
Next x
  
For y=0 To 8
  For t = 1 To 9   
    raknare = 0
    For x=0 To 8
      If kandidat(x, y, t)&1 :raknare + 1 
        If raknare > 1 : Break : EndIf
        xx=x : yy=y : tt=t
      EndIf    
    Next x    
    If raknare = 1 : tal(xx, yy)=tt|16 : singletyp = "rad" : ProcedureReturn 1 :EndIf    
  Next t
Next y
EndProcedure
;           
Procedure nolla_cand()
  singletyp=""
Protected.w x,y,a
  For y = 0 To 8
    For x = 0 To 8    
      For a = 1 To 9
        If kandidat(x, y, a)&1 =0:  kandidat(x, y, a) = 0:EndIf
      Next a
    Next x
  Next y
EndProcedure
 

Procedure kandidat_bort(bitposspara.w ,bitkollspara.w,y.w ,oppen_gomd.w ,cell_x_y_hus.w ,steg.w)
  Protected.w Swaps , a, b 
  If oppen_gomd : Swaps = bitkollspara : bitkollspara = (~ bitposspara) & 511 : bitposspara = Swaps
  Else :bitposspara = (~ bitposspara) & 511 
  EndIf
  For a = 0 To 8 ; rad
   If bitposspara & 1<<a
    For b = 0 To 8 ; siffra
     If bitkollspara & Int(Pow(2 , b))
       If erasekandidat2(xpos2(cell_x_y_hus, a + 1, y), ypos2(cell_x_y_hus, a + 1, y), b + 1,10) 
        ;+++++=oppen_gomd(oppen_gomd)+par(steg)+cell_x_y_hus(cell_x_y_hus)
      EndIf
     EndIf
    Next b
   EndIf
  Next a
  ProcedureReturn  
 EndProcedure

Procedure kandidatsok_alround(oppen_gomd.w, cell_x_y_hus.w, steg.w)
  Protected.w Dim xmax(4), Dim spara(9), a, bitkollspara, bitposspara, bitkollspara_test, b 
  Protected.w Dim bitantal(9), Dim bitkoll(9)
  Protected.w y, x , n ,d
  For y = 1 To 9
   If oppen_gomd = 0
    For x = 1 To 9
     bitkoll(x) = 0 : bitantal(x) = 0
     For a = 1 To 9
      If kandidat(xpos2(cell_x_y_hus, x, y), ypos2(cell_x_y_hus, x, y), a)
        bitkoll(x) = bitkoll(x) | Int(Pow(2 ,a - 1)) : bitantal(x) = bitantal(x) + 1
      EndIf
     Next a
    Next x
   EndIf
   If oppen_gomd = 1 :
    For a = 1 To 9
     bitkoll(a) = 0 : bitantal(a) = 0
     For x = 1 To 9
      If kandidat(xpos2(cell_x_y_hus, x, y), ypos2(cell_x_y_hus, x, y), a)
       bitkoll(a) = bitkoll(a) | 1<<(x - 1) : bitantal(a) = bitantal(a) + 1
      EndIf
     Next x
    Next a
   EndIf
   b = 1
   a = 0
   bitposspara = 0 : bitkollspara = 0
   Repeat
    a = a + 1
    n = 0
    bitkollspara_test = bitkoll(a) | bitkollspara
    If bitantal(a) > 1 And bitantal(a) <= steg :
     For d = 0 To 8
       If bitkollspara_test & 1<<d : n = n + 1 :  EndIf
     Next d
   EndIf
   If n > 1 And n <= steg
     bitposspara = bitposspara | Int(Pow(2 , a - 1)) : bitkollspara = bitkoll(a) | bitkollspara
     If b = steg 
      kandidat_bort(bitposspara, bitkollspara, y, oppen_gomd, cell_x_y_hus, steg) ; subrutin
      If ur - 0 : ProcedureReturn: Else :a = 9 :EndIf
     Else
      spara(b) = a : b = b + 1
     EndIf
    EndIf
    If a = 9 And b <> 1 : b = 1 : a = spara(1) : bitkollspara = 0 : bitposspara = 0 :EndIf
    If a = 9 : Break :EndIf
   ForEver
  Next y
EndProcedure

Procedure rad_vs_box_x_a() ;Rem **** Hitta 'rader versus boxar' i x-led
        Protected.w a,b, c ,y1,x1,y2,x2,x3
        For y1 = 0 To 6 Step 3
            For x1 = 0 To 6 Step 3
                For a = 1 To 9
                    b = 0
                    For y2 = 1 To 3
                        For x2 = 1 To 3
                            b = b + kandidat(x1 + x2 - 1, y1 + y2 - 1, a)
                        Next x2
                    Next y2
                    For y2 = 1 To 3
                        c = 0
                        For x2 = 1 To 3
                            c = c + kandidat(x1 + x2 - 1, y1 + y2 - 1, a)
                        Next x2
                        If c = b And c > 0 :
                            For x3 = 1 To 9
                                If qq1(x1, x3) = 0 :
                                    erasekandidat2(x3 - 1, y1 + y2 - 1, a ,10)
                                EndIf
                              Next x3
                              If ur :ProcedureReturn:EndIf
                        EndIf
                    Next y2
                Next a
            Next x1
        Next y1
    EndProcedure

    Procedure rad_vs_box_y_a()  ;Rem **** Hitta 'rader versus boxar' i Y-led
        Protected a, b, c, x1,y1,x2,y2,y3
        For x1 = 0 To 6 Step 3
            For y1 = 0 To 6 Step 3
                For a = 1 To 9
                    b = 0
                    For x2 = 1 To 3
                        For y2 = 1 To 3
                            b = b + kandidat(x1 + x2 - 1, y1 + y2 - 1, a)
                        Next y2
                    Next x2
                    For x2 = 1 To 3
                        c = 0
                        For y2 = 1 To 3
                            c = c + kandidat(x1 + x2 - 1, y1 + y2 - 1, a)
                        Next y2
                        If c = b And c > 0 :
                            For y3 = 1 To 9
                                If qq1(y1, y3) = 0 :
                                    erasekandidat2(x1 + x2 - 1, y3 - 1, a ,10)
                                EndIf
                              Next y3
                              If ur :ProcedureReturn:EndIf
                        EndIf
                    Next x2
                Next a
            Next y1
        Next x1
    EndProcedure

    Procedure rad_vs_box_x_b()  ;Rem ***** Hitta rader versus boxar' i X-led variant 2
        Protected.w flagga, y1, x1, a, q ,x2 
        For y1 = 1 To 9
            For x1 = 1 To 9
                For a = 1 To 9
                    flagga = 0
                    If kandidat(x1 - 1, y1 - 1, a) :
                        For q = 2 To 3
                            For x2 = qq3(x1, q) To qq3(x1, q) + 2
                                If kandidat(x2 - 1, y1 - 1, a) : flagga = flagga + 1: EndIf
                            Next x2
                        Next q
                        If flagga = 0 :
                            For q = 1 To 2
                                For x2 = qq3(x1, 1) To qq3(x1, 1) + 2
                                    erasekandidat2(x2 - 1, qq2(y1, q) - 1, a,10) 
                                  Next x2
                                  If ur :ProcedureReturn:EndIf
                            Next q
                        EndIf
                    EndIf
                Next a
            Next x1
        Next y1
    EndProcedure

    Procedure rad_vs_box_y_b()  ;Rem ***** Hitta rader versus boxar' i y-led variant 2
      Protected.w flagga, y1, x1, a, q ,y2
        For y1 = 1 To 9
            For x1 = 1 To 9
                For a = 1 To 9
                    flagga = 0
                    If kandidat(x1 - 1, y1 - 1, a) :
                        For q = 2 To 3
                            For y2 = qq3(y1, q) To qq3(y1, q) + 2
                                If kandidat(x1 - 1, y2 - 1, a) : flagga = flagga + 1:EndIf
                            Next y2
                        Next q
                        If flagga = 0 :
                            For q = 1 To 2
                                For y2 = qq3(y1, 1) To qq3(y1, 1) + 2
                                    erasekandidat2(qq2(x1, q) - 1, y2 - 1, a,10) 
                                  Next y2
                                  If ur :ProcedureReturn:EndIf
                            Next q
                        EndIf
                    EndIf
                Next a
            Next x1
        Next y1
    EndProcedure
    
Procedure X_vinge() ;rem **** hitta X-vinge , ta bort kandidater i X-led
Protected Dim bitkoll(25),Dim yy(25), bitkoll_or ,kandidatflagga_old
Protected y, a, x, x1, x2, n ,kandidatflagga
kandidatflagga_old = kandidatflagga
For a = 1 To 9
    For x = 0 To 8
        bitkoll(x) = 0
        For y = 0 To 8
            If kandidat(x, y, a) : bitkoll(x) = bitkoll(x) | Int(Pow(2 ,y )):EndIf
        Next y
    Next x
    For x1 = 0 To 7
    If bitkoll(x1) :
        For x2 = x1 + 1 To 8
        If bitkoll(x2) :
            bitkoll_or = (bitkoll(x1) | bitkoll(x2))
            n = 0
            For y = 0 To 8
            If bitkoll_or & 1<<y : n = n + 1: yy(n) = y :EndIf
            Next y
            If n = 2 :
                For x = 0 To 8
                  If x <> x1 And x <> x2
                    erasekandidat2( x, yy(1), a,10)
                    erasekandidat2( x, yy(2), a,10)
                  EndIf
                Next x
            EndIf
        EndIf
        Next x2
    EndIf
    Next x1
Next a
EndProcedure

Procedure Y_vinge() ;rem **** hitta y-vinge , ta bort kandidater i Y-led
Protected Dim bitkoll(25), Dim xx(25), bitkoll_or ,kandidatflagga_old,kandidatflagga
Protected y, a, x, y1, y2, n 
kandidatflagga_old = kandidatflagga
For a = 1 To 9
    For y = 0 To 8
        bitkoll(y) = 0
        For x = 0 To 8
            If kandidat(x, y, a) : bitkoll(y) = bitkoll(y) | 1<<x :EndIf
        Next x
    Next y
    For y1 = 0 To 7
    If bitkoll(y1) :
        For y2 = y1 + 1 To 8
        If bitkoll(y2) :
            bitkoll_or = (bitkoll(y1) | bitkoll(y2))
            n = 0
            For x = 0 To 8
            If bitkoll_or & 1<<x : n = n + 1: xx(n) = x:EndIf
            Next x
            If n = 2 :
                For y = 0 To 8
                  If y <> y1 And y <> y2
                    erasekandidat2( xx(1), y, a,10)
                    erasekandidat2( xx(2), y, a,10)
                  EndIf                  
                Next y
            EndIf
        EndIf
        Next y2
    EndIf
    Next y1
Next a
EndProcedure

Procedure X3_vinge() ;rem **** hitta x3-vinge , ta bort kandidater i X-led
Protected Dim bitkoll(25), Dim yy(25), bitkoll_or ,kandidatflagga,kandidatflagga_old
Protected y, a, x, x1, x2, x3, n 
kandidatflagga_old = kandidatflagga
For a = 1 To 9
    For x = 0 To 8
        bitkoll(x) = 0
        For y = 0 To 8
            If kandidat(x, y, a) : bitkoll(x) = bitkoll(x) | 1<<y :EndIf
        Next y
    Next x
    For x1 = 0 To 6
    If bitkoll(x1) :
        For x2 = x1 + 1 To 7
        If bitkoll(x2) :
            For x3 = x2 + 1 To 8
            If bitkoll(x3)
                bitkoll_or = bitkoll(x1) | bitkoll(x2) | bitkoll(x3)
                n = 0
                For y = 0 To 8
                If bitkoll_or & 1<<y : n = n + 1: yy(n) = y:EndIf
                Next y
                If n = 3 :
                    For x = 0 To 8
                      If x <> x1 And x <> x2 And x <> x3                
                        erasekandidat2( x, yy(1), a,10)
                        erasekandidat2( x, yy(2), a,10)
                        erasekandidat2( x, yy(3), a,10)
                    EndIf
                    Next x
                EndIf
            EndIf
            Next x3
        EndIf
        Next x2
    EndIf
    Next x1
Next a
EndProcedure

Procedure Y3_vinge() ;rem **** hitta Y3-vinge , ta bort kandidater i y-led
Protected Dim bitkoll(25), Dim xx(25), bitkoll_or ,kandidatflagga_old ,kandidatflagga
Protected y, a, x, y1, y2, y3, n 
kandidatflagga_old = kandidatflagga
For a = 1 To 9
    For y = 0 To 8
        bitkoll(y) = 0
        For x = 0 To 8
            If kandidat(x, y, a) : bitkoll(y) = bitkoll(y) | 1<<x :EndIf
        Next x
    Next y
    For y1 = 0 To 6
    If bitkoll(y1) :
        For y2 = y1 + 1 To 7
        If bitkoll(y2) :
            For y3 = y2 + 1 To 8
            If bitkoll(y3) :               
                bitkoll_or = bitkoll(y1) | bitkoll(y2) | bitkoll(y3)
                n = 0
                For x = 0 To 8
                If bitkoll_or & 1<<x : n = n + 1: xx(n) = x :EndIf
                Next x
                If n = 3 :
                    For y = 0 To 8
                      If y <> y1 And y <> y2 And y <> y3             
                        erasekandidat2( xx(1), y, a,10)
                        erasekandidat2( xx(2), y, a,10)
                        erasekandidat2( xx(3), y, a,10)
                    EndIf
                    Next y
                EndIf
            EndIf
            Next y3
        EndIf
        Next y2
    EndIf
    Next y1
Next a
EndProcedure

Procedure AlertThread1(Parameter)
  Protected.w xm,ym

  Repeat
  xm = (WindowMouseX(1)+2)/13
  ym = (WindowMouseY(1)+2)/13

    If GetAsyncKeyState_(#VK_LBUTTON) & 32768
          
      If ym>7 And ym<35 And xm>30 And xm<58:xp=xm-31:yp=ym-8:l_butt=1 :EndIf
      If ym>3 And ym<27 And xm>11 And xm<23:choose(ym-3)!1:l_butt=2  :EndIf
      Repeat
        Delay(20)
      Until GetAsyncKeyState_(#VK_LBUTTON) & 32768=0
    EndIf

Delay (20)

  ForEver
EndProcedure
an example of dudoku file named "sudokus.txt"

Code: Select all

................................................................................. new
562...189...5.8....1.....4.89.1.7.54.........12.4.9.73.4.....2....2.3...253...718 lätt 1
..49.13....54.37...1.....2.5..396..77.......64..587..3.5.....4...62.48....36.81.. lätt 2
9.5...3.1.7.....8...23.74...961.385...........879.213...32.19...2.....1.4.8...7.2 lätt 3
6.41....21....843..7.93.5...95..264.38..4...1...3..278.2...738..4..8..69...5.1... lätt s3
7.831..464..57....921..8375.7..84.2...4....59.391.57..185.96.....7..12.86...3.5.1 lätt s4
..32.6..9....8.6.2.8..1.34.8..59.17..26..7...5......243..7....82.9.53.6.17.46..35 lätt s5
...1..5.39...5..7...7.98.628.25.4.16.647..8..73....92..892.3..751..6.....76.4..8. lätt s6
9..2......72...8.3..4.9.25656...94724..67.3...2...5.8..1..24.3.835.16...2.9.831.7 lätt s7
.25......97.6..318.3.149...25..17.6374.9562.16...38....8.39..26..27..54...1..2.3. lätt s8
4.......3.857...1463.2485.9.58.........8.3.571..5294.87.9...38..4.1....6.26..5... lätt s9
....9..2..6..3.5.74...86.31893.172.......98.62764......81.4....3....271...5...489 lätt s10
..5..431.3.4...298.7..1.6....64....2.3785..46..1.9.7.....736....4.28.561.92...... lätt s11
56...7.3.21..3.968..9.2..7...621.7......54.....83.9.15.8.56.49.....9..2.7.38.21.. lätt s12
..3.76....26...54.89.1..6.3.4....16..3..8.759..72.9..45.98..4..3..4.58.71....32.. lätt s13
..6.25.49..7.91.6319....85..1896..3.5.94.36...4..78.129..23.4.5.7.1.....2..68.7.. lätt s14
51.2.7.493...6.7...6.9..58......523....376.919..4.....85......4..71.392..2.75..6. lätt s15
.6..5....81.4..72.7..3.8.....861.27.5.7..9..6.4.2..59.29....34....732.....5..4812 lätt s16
..58.2.7.9.467...3......1.6...51..8727139.....6.4.7.9.7.6...5.983...4..21..769.38 lätt s17
2..5.7....13.6.5.24...928..8321....6.7...5..4.....82.9...9..46.52..86..164.7.3.28 lätt s18
26..4...79...8...3.8.1.395..1.2.7.85.4..96.3.3.8.5.2...2.37.5.683.5..1.479..1.... lätt s19
8529714..7..2.6.9..1..8.25.5..4.93.8..813.6.236..........6.27.....5481.36.47....9 lätt s20
..21..6...9....5.17.6.5..482...783.41....52.9.3.....6.5.4.....637..41.5..8..2947. lätt s21
53..48.21.......8782.5796...1....2..9..72..65...8634.92...87.4.176...398..4916... lätt s22
..7.5.4293.82..675.4..9.....1..6.9.2.5.3..78.8.4..516.9.658.23.2....954.4..1.7.9. lätt s23
..53.2.789..46.53.81.....2.197.4.85..2....369......7....613.2..43..5..8....87..9. lätt s24
6..5.3.7919.87.3.....1..62......45..42..1..83.67...9148.5.6...19....2....749..8.. lätt s25
...41....189.2...74....52163...81..2....3496.65..7...4..126937.73........25..3.8. lätt s26
9...14..265..8.1..1.7....8.4..972.5..1......628..36..7.2456..1...67413....18..4.9 lätt s27
9......13..24..89737..8165..21..49.8...5..3..8.3.6.275.5....1.94.92.7..6.683..... lätt s28
.4.16795.7..83.46.896..23....4.7.1.9.....6..33.2...6844.759....6...842...1....7.. lätt s29
7.6.2..8..9..5.2..51....3.7..7.8416.2..73..95.3.6.....48.3.9.52.7..1.8.4..58.6..1 lätt s30
..1.593..25........7.....6...34.1.5..6.528.1..2.9.67...3.....2........47..718.5.. medellätt 1
..7....2.5....6.....4.237.8.15.6......28.71......9.23.9.814.3.....6....1.5....8.. medellätt 2
......1.9...5.8....1.....4.89...7.54.........12.4.9.73.4.....2....2.3...25....71. medelsvår 1
.....6..72..13.8..36.87..2.5...1.2.9.........7.9.6...4.5..49.72..3.81..54..2..... medelsvår 2
.35...69.8.......3..26.48..4...7...9...9.5...5...2...7..68.14..3.......8.48...71. medelsvår 3
..8.41.2..4..6...5..19..7.812..75...49...8......3..16.5.7....39.3.......6..2..4.1 medelsvår s39a
.1...523..6.4...979...87...735..2.8.2...1.......5.34...9.....2..7....5..3.8...1.6 medelsvår s39b
.87..46...1....3...2.....98.958....4....3........62.7.2.498.51..6.....2.8.37..... medelsvår s39c
.6......2.53.7.98...1....3...42...67.....75...9.4.83......51.....8..947..26..31.. medelsvår s39d
8...1.5.6...2847..19......3.6.7..4.9...........5..3.12.428.6...73..5.......9...3. medelsvår s40a
.52.1..8....43..2......9..6.1457.........84.9.63.......9.82..732.6..71..7.86....5 medelsvår s40b
..9.83..42...67.5..1.....7......43...9..5.1...8627..95.35...96....7.9..2..4.1...8 medelsvår s40c
72......1.9.1.68....4..7.3583..6..5.....1.79..1.2.4...............5.862...643...9 medelsvår s40d
3......7..16..2.5...4..98.......5.46..98....3752...1......5.23..6..749...8.1..... medelsvår s41a
9.82....42...316....7..5...6.1.......4.7..35.5....8.92....947........2...3.6...18 medelsvår s41b
..236...9.18..5..4..6..7....39....78.4.1.....6.....5.1.5.68.2..7......3.2...941.. medelsvår s41c
1.4...2.9..89..37...6.8....3...27.1....5.....7....849..29.61....4.3..8..5...4..6. medelsvår s41d
..13....58.5.7..3946.9.5......8.....9.7..1.6....4..523.5..28.1.2....68.7.......5. medelsvår s42a
21....9.6...36....4....85.17.69....8.2....3....91.5..4.5.74..2......6...38..1..7. medelsvår s42b
8......2..19.2.7..6..54...3..4.....93....258.9..6.71.....8.96.4...7.....5..2.3.1. medelsvår s42c
37..8...9..........14...5.2..6.1.75......94.1.2.75.....5.3...7.9..12.6..6..4....8 medelsvår s42d
...1.93..6.78..2..1....5.....4.12.8..5..3......2...796.3..5..6...8..61.49..72.... medelsvår s43a
...6..74.4.281.....3...9..5.6...4.89.17...3......5.2..1.9..26...8.........57.3..1 medelsvår s43b
.9..6..417.34..2.......8.5......4.9...6..7.3..2513......8.4.....4...23.7.1.95...6 medelsvår s43c
...9...4...9...7..5.2...819....7.....4..61.5.3....96216.7..4..5..1.53...8..2..... medelsvår s43d
..9.2..61..857.......4..5.32..16...987.........5..34..1....42.8.6.8.......4.59... medelsvår s44a
..5.1.....83.97...6..3..28..12..4.9...7.6.8.34.......283.5....4........69...2.17. medelsvår s44b
.6......781...9...435....8.1..9..8....83.79.6..3..8..4.5....791...1...237......4. svår 1 chansa?
.7.9.8..6...5.....51..3..84.42..5...............3..14.28..5..17.....6...4..8.7.3. svår 2
.41..5..79.5.....1....36.....92......7.....4......13.....81....2.....4.86..4..15. svår 3
....89....47.....2.6.4.......1..58...75.2...4..86...3.........31..3.46.....578... svår 4
....4....5......47.68.13....9.8........37......2..56.....6...7..15....9.......834 svår s3
.4..7........9.62........3..6.8.....18.4.......2...51.....67..9....8..735.4.....1 svår s4
.48..1........7..615.42.....6..4......9.....8....3.2..9...7....7..8..5.......531. svår s5
..27....4....58.....9....5..8......5.6....4.....9...1.6...17...75...4......3..1.2 svår s6
....4..3....63.....5....1........9.2...2....6.41..5....7.3.....3....9.28....5.4.. svår s7
.8..79.....9....6...5..3...7..4..5..3..7...2..9..3..4.5...6...14...........84..57 svår s8
7.....46..8...5......4.1.....5.89..14......921...3.........89.3.5.......2.7.5.... svår s9
1...9........3..42..4.5...32.18....7.....6...7......1..3....82..6.1.9.........5.. svår s10
7.4.........8.6....2....3.7.......59..3..8.6.8.57.....5...9......9.....1.6.15.... svår s11
48.....1....39.........27.....86.....1.2....5.7.5....6..7....4...3.741..6.2....9. svår s12
.....9.4.32....1.....8...6..36.1.4....9.8.........25..6.....3...4.7...1....95...2 svår s13
...3..8.....54.....96.....2.3..5....92.............4711....4..9......3..3...82... svår s14
....67.3.....9..6..3......4..964.57.8........56.1.....7....38.......845...2...... svår s15
..25......7....1.......2.34....9.418...86...9..42......1.3..........8.2.956...... svår s16
......32..16..4.......51..81..8.2..55.36...........6.98......4.3.....9.2...7..... svår s17
....6..1.8....24..3.7....8.......6...283.....5..7....4.1....8..29..4...7...1....5 svår s32
.....8.575.6.......7......3.3.4.92......37.95........6..2........324.6...8.5..... mycket svår
86......5...8....64..7.........34.981.9...7.........14...2.56...23.7.....9....8.. mycket svår s3
....2..798....6.4.47....3...3.....68.....92....1.5.......5........3....26.2..4..5 mycket svår s4
....42....8.....6..2.........1...9.4...8..7.37....5......31...99.....4.8537...... mycket svår s5
......13.8.....4...5.........2.6...4..4..8.12..67......7..8..9.1...5.........4.2. mycket svår s6 chansa?
.....4....36..5.......6..72......8.6..1.9....7241.....68....9..5..3.........7...8 mycket svår s7
.4...8...5..........2..693..86...2...2....7.6....1.......8.3.5.1.3....6....47.... mycket svår s8
.....9.7.3...6..4.5..4..2...5..7....69......8...8.3......5.4.....7...86..8....9.. mycket svår s9
3.2.8..1..9.4..........1...8.63....7...2.53....4.6.......9.2...1...5.8........4.6 mycket svår s10 chansa?
..7..2........5..8319.....7.9.45....7.....3....6.........6......4..1..52.8.....1. mycket svår s11
.....6...91...23....51...28..39.......954...........31......5...8......2.7.6.8... mycket svår s12
.........9..3.2...71.....9614...5...8.....2...9..4.5........6.13.68...2....7....8 mycket svår s13
1.8..7........58.........31.9.3..2......4.1...52...7..9...6....8.7....4......9.5. mycket svår s14
.....6..7..1.23...89........1...928....5.......2...4...5.74.....7.........6....13 mycket svår s15
...76..8...18..4...9.4.2.....3..1...6......7......3.9.3......5.8.5.....7...2....9 mycket svår s16 chansa?
..9.....8.253.........2...4.5..6.1..9......6.....812...7.............31.4...78... mycket svår s17
3.61.............319...2.4.9..2.1.....86..7.......548..6....9.........1...4.9..5. mycket svår s18
1...8........3.9...58.6..7.........64..9..3.1...5......1.2...8.7.3....5......4... mycket svår s19 chansa?
.....2.....8.....594..3..1.....7..89..1...6...54....7.28.6..7....91......7...42.. mycket svår s20
4......8..7....6......83.12..9.....33...52...1.....9.6...2.94....4........53.78.. mycket svår s21
....8.5..4..5......1..3...237...4......95....1.6....8.......4.3.6....8......67... mycket svår s22 chansa?
72..3......1..5..4.63..7.........2....7...3....56.9.....2...91..8.5........8....6 mycket svår s23
..2...9...7..1....1...9.6.2.....1..8.9..3....6.8...27.7.32.8..........6....5..... mycket svår s24 chansa?
.8...69..3..25.8.....7..5....2.....9.9..1.7..........6.......3.2.31.9.5.4....5... mycket svår s25
..5...41....2...7....63.5........3..21...6...6..92.7...9..84.....7.6...8..1...... mycket svår s26 chansa?
4.58...6........3....371.........7...6...3....97.4....8......4..2...9.5.1..5....6 mycket svår s27
......9..28..4.5..6..98.....5.6.....9..1........4...71.......86471...........32.. mycket svår s28
......5..63...27.......9..4.82....7....35.......7...61......238..7.......5.84.... mycket svår s29
..57.......4....85.3..91....67.........3.5.........26.6....2...1.......7.8....354 mycket svår s30
8......4..1..3......2.4.7.5.2....8.6..92........5...17..67....2.3.......7.8..6... mycket svår s31
...82........9..535.......1.6..1.49.3.4.........5.67....5....1.1..7..92..8....... mycket svår s32
...7.......6.8.21......29......5.....9..1.5.4.....7.68...4....3.72......1..2.3... mycket svår s33
..3.5...8....9.3.....6....4...2.5...167...5..8......1.7.....1.....3.8.6.....62... mycket svår s34
........43.1...9......8.2........4685..4.7.2....1......38.........7.1...4....91.3 mycket svår s35
...9....5..14....9.....7.........9.176...2...8...4.5....5...37...35.....9....6... mycket svår s36
.4....63.8..2.....9.........5.......2...7...1...8....94.3..85....5..1.....2.6.84. mycket svår s37
7243........1..5.61.....3..4...5...1..298...3............8.1....9...4.6..7.....2. mycket svår s38
1..8...2...5.7.1....845..........9..26........1...6..8.........5.....476....38... Mega super svår s50a
6..1..2.......87...1.53....572..9........5..4.6......1943.............6....78.... Mega super svår s50b chansa
.4....3...8.12.....9......56........43...8.1...1.4..9.3....17.....7.35....26..... Mega super svår s50c chansa
65....3.....4..5....49......25......81...4....3.1..89...17......7..2..5...8.3...1 Mega super svår s50d
...7..6..94...2.....3.....7...2.18.4..26............5.6.......8..5.3.7.1....94... Mega super svår s51a
7.....5.....4..8..3..51..6..7.....8..31.8........596.........21.4.2...9.9...6.... Mega super svår s51b
...9..7........84.85.1.........1.....4.....923.75.......6...5.......7...9..2.4.1. Mega super svår s51c
.....4.....61.3...1.5..6..9928............1.3...4.5....8.....2..4.....7....97.... Mega super svår s51d
7...6...29............7...3.8.1..5..1.4..6.......892..6..........3....9....25.8.7 Mega super svår s52a
.5..2....76.3.4.........21.29.4....6....8......5....9.1...6...26......5..4......7 Mega super svår s52b
.6....1..8.9.........5...4.4...2......1...9....3.8..6.75...6..........78....593.. Mega super svår s52c
...2...7.....3..8.85.....41..6.......97..35....1.7........1.2.....3....94..7..8.. Mega super svår s52d
.......4....795.8.7.....2...3.1.....95..8..72.7.....5.14.8........4....3..6.2.... Mega super svår s53a
.....53...81.9...44..7...6...8....9...2...57....14.....3.......9....6.......8.9.2 Mega super svår s53b
8......1..5..69.....31.7..8.7......5..9.7.6..4......2.9..5.61.....79..3..3......2 Mega super svår 1
67...1...3....9.86....8......71..9.3....4....8.5..64......6....94.2....7...7...41 SM2005 1
...91..3..6...27.9.........4.75...1...........9...38.2.........9.38...2..5..46... SM2005 2
...7....5.1....4....6.8.......6..2.7.9.....8.3.5..4.......2.1....4....3.7....9... SM2005 3
..94..3...2.....1.4.8...7.5.5..76......3.9......28..7.7.1...2.8.8.....5...6..31.. SM2005 4
3...1..5..5....1.....24..38..1..2.472.9.8.5.....7......2..5.6..7.36....5..51...74 SM2005 5
...8.5.....7...4...1..3..7...2...1...7..6..3...9...8...3..5..1...8...9.....4.2... SM2005 6
..65..8....9..42..87.....49....8...34..1.3..26...5....35.....98..49..1....1..53.. SM2005 7
4.5.2..6..7...8....6..7...9..7..65....3...9....98..1..7...1..4....5...9..5..4.7.2 SM2005 8
.8..1.......2....64..5.728.8..1.3.2..29...36..6.8.9..4.714.2..96....5.......3..4. java prog1 svår
.2...46...1.....356...8....8..6.9.....3...2.....8.7..3....5...649.....1...51...7. java prog2 svår
...7..6....71...82264......8..2...1...3...7...2...5..9......35139...62....8..2... tidning svår
46.5.3.....17...6...962.....1...235....1.4....543...8.....356...8...19.....2.7.35 chansa 1
...4.9......2.3.19.346..2.5.7....5...9.7.5.2...5....4.2.6..419.51.3.2......1.8... chansa 2
.....69..1793..8..4.6.2....2.7.93....9.....3....57.1.9....6.4.3..3..9271..81..... chansa 3
..47...89...9.42.1....12..76....7.1.8.......5.4.6....34..17....2.74.5...95...84.. chansa 4
....857..4.1..75.35..4..2........316.4.....2.163........7..4..96.97..4.2..496.... chansa 5
..4.......6...1.452.84..6...7..24..69..5.8..44..67..1...1..34.974.8...5.......8.. chansa 6
.3..98.......27.....45316..5718493..2..163547..3275819..63542.....98.......71..5. x-ving
.4....9..9.5..32..78.9.164...8.9...45.9.3...72.4.6...9.972...363518.6.92.263.9.5. Svärdfisk
97.3.4.65.2.5.6.8............58.29....2.4.3....87.51............6.2.8.3.84.1.9.27 Easiest
.985..2..1.......4.5.....3...26431.....9.8.....71526...7.....8.2.......7..6..152. Gentle
3.2.7.5.4...........6254....9....6....89651....5....2....1978...........5.7.8.2.6 Moderate
..54.16......6.....94..7.2.37..2..4.....1.....1..4..56.5.8..26.....9......23.69.. Tough
..1..38...4.....6.7..9.65.16..5....2.........8....7..93.61.8..4.9.....8...87..2.. Diabolical
....41....6....2...........32.6.........5..417...........2..3...48......5.1...... Easy 17 Clue
..2.9.3..8.5......1.........9..6..4........58........1.7....2..3..5........1..... Hard 17 Clue
.8...4.6...2.....976.....12...8.6...8.......3...1.7...67...5.411.....7...5.9...2. Naked Triples
.........82.6.1.741..3.4..651.....63....5....94.....252..8.9..163.1.2.59......... Hidden Triple
.5.8.7.3...29.65......5.....45....7..79.2.46..2....35.....9......15.47...9.1.3.8. Pointing Pairs
...9.4...79.....248..2....1.8.451.3...........7.369.4.2....7..341.....62...5.6... Line/Box Reduction
.4398.25.6..425...2....1.949....4.7.3..6.8...41.2.9..382.5.........4...553489.71. x-wing example
..6397...3..128...98.564.37795231468243689571168475392.3.716.2.....53...6...427.3 Simple Colouring T1
.56.7.92..7.2.9.6592.536.8.6.97.5.32.3..9..5.5....3.91.6.357.19.954.8.7.7.39..54. Simple Colouring T2
.51.7.9..928156347..398.5..297465..3536.1.479814739625..952.736.62.97.54..564.29. y-wing example
.6.....535...3.6.1..36.52....25.91..9..17.8.2.173285....14.732.7...9.415.4.....6. SwordFish         
.87.3.964964.781.....49687..4.9.7.5669.35.748.7.6.4.194..8.36978.97654..7.6.4958. Jelly-Fish
3.7..9..6.....7...82....1...5..6...1...354...7...9..6...5....12...9.....4..2..3.7 Sue-de-Coq
.6.8.9.1.42..1..8.1.......23.7...2.....4.5.....4...5.62.......9.8..7..21.4.2.3.6. Multi-Colouring
....1......4..37.1.5.4..6.....3....631.....859....2.....3..7.1.7.12..9......6.... Grouped AIC Example
9..1....4..4.3.8...53....9....7.8..1.1.....3.8..6.3....2.....7...9.4.5..5....6..3 Bowman's Example
......6.5...3...9..8...4..1.4..2.97...........31.8..6.9..6...2..1...7...5.4...... Riddle of Sho
.7.3.2.8...3...1..5..4.1..31.......5.3.2.5.1.2.......96..5.9..7..9...5...5.7.4.2. Box/Line example
.3.1.2.85....3....5...6..37.582..361.1..8..4..92.1.5781...5.7.4....71.5..75924.1. Unique Rectangle eg