Page 1 of 1

Hello to local Chess Programmers

Posted: Sat Jun 13, 2009 5:09 pm
by Octopus
Hi, maybe you already know my 8x8 and 10x8 multivariant chess project SMIRF at http://www.chessbox.de/Compu/schachsmirf_e.html.

For this moment I am waiting for to receive an unrestricted working actual PureBasic program package (updating from dtp PB 4) for to become able to test its current abilities (without debugging) e.g. multithreading, which fails within the 3D Game Developer version.

I am interested to create a multi-OS GUI supporting 8x8 and 10x8 chess UCI related engines, maybe using PB, if it shows up to be sufficiently stable.

Re: Hello to local Chess Programmers

Posted: Sat Jun 13, 2009 8:37 pm
by Michael Vogel
Octopus wrote:Hi, maybe you already know my 8x8 and 10x8 multivariant chess project SMIRF at http://www.chessbox.de/Compu/schachsmirf_e.html.
[...]
Welcome on board, Octopus!

I would say, that PureBasic is able to handle projects in a very stable manner. The (small) team around Fred is doing a fine job since years!

Michael

PS I still use an old version (1.4 or so) which has been called FEN-Editor :)
The simple reason for that is, that I want to have only portable programs (on my USB-stick) to be able to use them everywhere :wink:

Re: Hello to local Chess Programmers

Posted: Sat Jun 13, 2009 11:13 pm
by Octopus
Michael Vogel wrote:Welcome on board, Octopus!
Thank you!
Michael Vogel wrote:I would say, that PureBasic is able to handle projects in a very stable manner. The (small) team around Fred is doing a fine job since years! ...
Well, I am experimenting and comparing my full PB v4.00 version to the new restricted v4.31 version currently at Windows. Unfortunatedly there is a bad behavior in the v4.00 version, which is not executing following thread test program using a two core CPU, what makes me unsure about a choice of PB:

Code: Select all

#limit = 100000
#size = 5
Dim prim.l(1) 
mutex.l = CreateMutex();
balken$ = RSet("", #size, "-")

Procedure printout()
  Shared prim.l(), balken$
  If prim(0)
    Print(RSet(Str(prim(0)), #size))
    prim(0) = 0
  Else : Print(balken$) : EndIf
  Print(" ")
  If prim(1)
    PrintN(RSet(Str(prim(1)), #size))
    prim(1) = 0
  Else : PrintN(balken$) : EndIf
EndProcedure

Procedure CalcPrim(isBig.l)
  Shared mutex
  Shared prim.l()
  
  For i.l = 2 To #limit
    If (i % 3) < 2 XOr isBig : Continue : EndIf
    For d.l = 2 To #limit
      If (i / d) < d 
        LockMutex(mutex)
        If prim(isBig)
          printout()
        EndIf
        prim(isBig) = i
        UnlockMutex(mutex)
        Break
      EndIf 
      If i % d = 0 : Break : EndIf
    Next d
  Next i
EndProcedure

If OpenConsole() 
  prim(0) = 0
  prim(1) = 0
  Tr1.l = CreateThread(@CalcPrim(), 0)
  Tr2.l = CreateThread(@CalcPrim(), 1)
  WaitThread(Tr1)
  WaitThread(Tr2)
  printout()
  Input()
EndIf
Michael Vogel wrote:PS I still use an old version (1.4 or so) which has been called FEN-Editor :) ...
So, that relict is still alive ... ;-) But the free SMIRF GUI might be able to do a lot of more things.

Regards, R.S., thinking about a SMIRF relaunch as Octopus engine.

Posted: Tue Jun 30, 2009 6:49 am
by bloria
What is a good process for studying and learning chess openings? I'm an intermediate club level player, but I've never taken much time to learn a lot of chess openings. I know general opening principles (develop quickly, control the center, etc.), and recognize a decent number of openings during play. But I think it's time to buckle down and start studying specific openings and their variations.
______________
keyword research ~ keyword tool ~ keyword tracking ~ affiliate elite

Posted: Tue Jun 30, 2009 4:44 pm
by Octopus
bloria wrote:What is a good process for studying and learning chess openings? I'm an intermediate club level player, but I've never taken much time to learn a lot of chess openings. I know general opening principles (develop quickly, control the center, etc.), and recognize a decent number of openings during play. But I think it's time to buckle down and start studying specific openings and their variations.
It might be a good idea to contact a serious chess club like: http://www.chesstigers.com/index.php?rubrik=2

Nevertheless I myself refute to make chess to be handled as a mainly reproducing game. Thus creative playing from the beginning seems to be the better goal. So Chess960 (Fischer Random Chess) might be the better choice. I wrote a German language book on this idea, see at: http://www.chessbox.de/Compu/fullchess1_e.html

Posted: Tue Jun 30, 2009 5:40 pm
by rsts
The posted code executes to completion and last number was 99989 (then 99991 on another run) under PB4.31

If you have a full PB 4 you should be able to login to your PB account and download the newer 4.31.

cheers

Posted: Tue Jun 30, 2009 8:59 pm
by Octopus
rsts wrote:The posted code executes to completion and last number was 99989 (then 99991 on another run) under PB4.31

If you have a full PB 4 you should be able to login to your PB account and download the newer 4.31. ...
Actuallly the code has been slightly modified to split into 12 threads.

Code: Select all

#limit = 1000
#size = 5
; als tmax hier nur Primzahl-2 nehmen
#tmax = 11
Dim prim.l(#tmax) 
Dim tnr.l(#tmax)
mutex.l = CreateMutex();
balken$ = RSet("", #size, "-")

Procedure Printout()
  Shared prim.l(), balken$
  Static lineNr.l = 0
  lineNr + 1
  Print(RSet(Str(LineNr), 3) + ": ")
  For k.l = 0 To #tmax
    If prim(k)
      Print(RSet(Str(prim(k)), #size))
      prim(k) = 0
    Else : Print(balken$) : EndIf
    If k < #tmax
      Print(" ")
    Else : PrintN("") : EndIf
  Next
EndProcedure

Procedure CalcPrim(tnr.l)
  Shared prim.l(), mutex
  For i.l = 2 To #limit
    Define rest.l
    If i = #tmax+2
      rest = 0
    Else 
      rest = i % (#tmax+2) - 1
    EndIf
    If rest <> tnr : Continue : EndIf
    For d.l = 2 To #limit
      If i / d < d 
        LockMutex(mutex)
        If prim(tnr)
          Printout()
        EndIf
        prim(tnr) = i
        UnlockMutex(mutex)
        Break
      EndIf 
      If i % d = 0 : Break : EndIf
    Next d
  Next i
EndProcedure

If OpenConsole() 
  Define.l k
  For k = 0 To #tmax
    prim(k) = 0
  Next
  For k = 0 To #tmax
    tnr(k) = CreateThread(@CalcPrim(), k)
  Next
  For k = 0 To #tmax
    If tnr(k) <> 0
      WaitThread(tnr(k))
    EndIf
  Next
  Printout()
  Input()
EndIf
Under Windows XP (at Parallels and 2 kernels) it runs fine resulting in:

Code: Select all

  1:    13 ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
  2:    53     2     3    17     5    19     7    47    61 ----- ----- -----
  3: -----    41    29    43    31    71    59    73   113 ----- ----- -----
  4: ----- -----   107   173    83    97   137   151   139 ----- ----- -----
  5: -----    67   211   199   109   149   163   229   191 ----- ----- -----
  6: -----   197   263   251   239   227   241   281   269 ----- ----- -----
  7: -----   223   367   277   317   331   293   307   347 ----- ----- -----
  8: -----   353   419   433   421   383   397   359   373 ----- ----- -----
  9: -----   379   523   563   499   409   449   463   503 ----- ----- -----
 10: -----   431   601   641   577   461   631   541   607 ----- ----- -----
 11: -----   457   653   719   733   487   683   593 ----- ----- ----- -----
 12: -----   509   757   797   811   617   709   619 ----- ----- ----- -----
 13: -----   587   809   823   863   643   761   827 ----- ----- ----- -----
 14: -----   613   887   953   941   773   787   853 ----- ----- ----- -----
 15: -----   691   991 -----   967   877   839   983 ----- ----- ----- -----
 16: -----   743 ----- ----- -----   929 ----- ----- ----- ----- ----- -----
 17:    79   769 ----- ----- ----- ----- ----- -----   659    23    11 -----
 18:   131 ----- ----- ----- ----- ----- ----- -----   919   101    37 -----
 19:   157 ----- ----- ----- ----- ----- ----- -----   971   127    89 -----
 20: ----- ----- ----- ----- ----- ----- ----- -----   997   179   167 -----
 21: ----- ----- ----- ----- ----- ----- ----- ----- -----   257   193 -----
 22:   313 ----- ----- ----- ----- ----- ----- ----- -----   283   271 -----
 23:   443 ----- ----- ----- ----- ----- ----- ----- -----   439   349 -----
 24:   521 ----- ----- ----- ----- ----- ----- ----- -----   491 ----- -----
 25:   547 ----- ----- ----- ----- ----- ----- ----- -----   569 ----- -----
 26:   599 ----- ----- ----- ----- ----- ----- ----- -----   647   401 -----
 27:   677 ----- ----- ----- ----- ----- ----- ----- -----   673   479 -----
 28:   859 ----- ----- ----- ----- ----- ----- ----- ----- -----   557 -----
 29:   911 ----- ----- ----- ----- ----- ----- ----- ----- -----   661 -----
 30:   937 ----- ----- ----- ----- ----- ----- ----- -----   751   739 -----
 31: ----- ----- ----- ----- ----- ----- ----- ----- -----   829 ----- -----
 32: -----   821 ----- ----- ----- ----- ----- ----- -----   881   947   103
 33: -----   977 ----- ----- ----- ----- ----- ----- ----- ----- -----   181
 34: ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----   233
 35: ----- ----- ----- ----- ----- ----- ----- ----- -----   907 -----   311
 36: ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----   337
 37: ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----   389
 38: ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----   467
 39: ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----   571
 40: ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----   701
 41: ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----   727
 42: ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----   857
 43: ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----   883
But under Mac OS X (2 kernels) it merely produces:

Code: Select all

  1:    13 ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
  2:    53     2 ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
  3:    79    41     3 ----- ----- ----- ----- ----- ----- ----- ----- -----
  4:   131    67    29 ----- ----- ----- ----- ----- ----- ----- ----- -----
  5:   157   197   107 ----- ----- ----- ----- ----- ----- ----- ----- -----
  6:   313   223   211 ----- ----- ----- ----- ----- ----- ----- ----- -----
  7:   443   353   263 ----- ----- ----- ----- ----- ----- ----- ----- -----
  8:   521   379   367 ----- ----- ----- ----- ----- ----- ----- ----- -----
  9:   547   431   419 ----- ----- ----- ----- ----- ----- ----- ----- -----
 10:   599   457   523 ----- ----- ----- ----- ----- ----- ----- ----- -----
 11:   677   509   601 ----- ----- ----- ----- ----- ----- ----- ----- -----
 12:   859   587   653 ----- ----- ----- ----- ----- ----- ----- ----- -----
 13:   911   613   757 ----- ----- ----- ----- ----- ----- ----- ----- -----
 14:   937   691   809 ----- ----- ----- ----- ----- ----- ----- ----- -----
 15: -----   743   887 ----- ----- ----- ----- ----- ----- ----- ----- -----
 16: -----   769   991 ----- ----- ----- ----- ----- ----- ----- ----- -----
 17: -----   821 ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
This are neither sufficient threads nor complete results (in second thread line last result is missing), thus it seems to end in a deadlock or anything else internal blocking.

P.S.: sometimes it runs longer ending in:

Code: Select all

  1: -----     2 ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
  2: -----    41     3 ----- ----- ----- ----- ----- ----- ----- ----- -----
  3: -----    67    29 ----- ----- ----- ----- ----- ----- ----- ----- -----
  4:    13   197   107 ----- ----- ----- ----- ----- ----- ----- ----- -----
  5:    53   223   211    17     5    19     7    47    61    23    11   103
  6:    79   353   263    43    31    71    59    73   113   101    37   181
  7:   131   379   367   173    83    97   137   151   139   127    89   233
  8:   157   431   419   199   109   149   163   229   191   179   167   311
  9:   313   457   523   251   239   227   241   281   269   257   193   337
 10:   443   509   601   277   317   331   293   307   347   283   271   389
 11:   521   587   653   433   421   383   397   359   373   439   349   467
 12:   547   613   757   563   499   409   449   463   503   491   401   571
 13:   599   691   809   641   577   461   631   541   607   569   479   701
 14:   677   743   887   719   733   487   683   593   659   647   557   727
 15:   859   769   991   797   811   617   709   619   919   673   661   857
 16:   911   821 -----   823   863   643   761   827   971   751   739   883
 17:   937Segmentation fault