Eschecs FreeBASIC (UCI chess GUI)

User projects written in or related to FreeBASIC.
Post Reply
Roland Chastain
Posts: 993
Joined: Nov 24, 2011 19:49
Location: France
Contact:

Re: Title of the discussion

Post by Roland Chastain »

fxm wrote:
Roland Chastain wrote:Would it be possible to change the title of the discussion ?
The author of a topic can change the title editing his first post (field: 'Subject').
Thank you, fxm. I didn't know.
Roland Chastain
Posts: 993
Joined: Nov 24, 2011 19:49
Location: France
Contact:

Re: Eschecs

Post by Roland Chastain »

Hello gentlemen !

I would like to present my new program.
Please notice that it is not a strong chess program. As you will see, the computer plays some very bad moves, and it is easy to beat.
So it has to be considered as a code example, a simple programmation exercise.
Many thanks to frisian and to other users who suggested to me important improvements.
This version uses a new pieces set. Many thanks to BasicCoder2, who authorized me to use his pieces.

Image

Download
Last edited by Roland Chastain on May 19, 2012 11:23, edited 1 time in total.
VANYA
Posts: 1834
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: Eschecs

Post by VANYA »

Roland!

I go as an Bishop in this situation:

Image

Next move your computer:

Image

Where did my Bishop ? :)
Roland Chastain
Posts: 993
Joined: Nov 24, 2011 19:49
Location: France
Contact:

Re: Eschecs

Post by Roland Chastain »

Thanks, Vanya.

Indeed I forgot to test the rook's square (1). I will correct it at once and change download if I get connection.

But, in one sense, it's a very good move. :-)


Corrected version :

Eschecs 0.8.0

(1) More exactly, I hadn't noticed that I had to change the value of the castling availability, not only when a rook moves, but also when a rook is taken on its square. Good, Vanya !
Last edited by Roland Chastain on Apr 22, 2012 11:08, edited 1 time in total.
Roland Chastain
Posts: 993
Joined: Nov 24, 2011 19:49
Location: France
Contact:

Re: Eschecs

Post by Roland Chastain »

Hello gentlemen !

Here the beginning of the program I am writing.

It calculates all the possible four halfmoves combinations from the starting position and store it in a text file.

It makes (?) 205 662 possibilities. In a previous essay I got 196 404. I would be glad if I could know the right number ! :-)

I believe it should be possible to write a strong enough engine on this basis. I will try to add a simple material evaluation to see how it behaves. I will also look for a way to select lines instead of calculating all the possibilities.

Suggestions welcome !


EDIT (28/04/2012)

New code. 192 011 combinations found. Now the file "Variantes.txt" contains a note for each line calculated.

Code: Select all

'*******************************************************************************

#Define Vide 0
#Define Pion 1
#Define Cavalier 2
#Define Fou 3
#Define Tour 4
#Define Dame 5
#Define Roi 6

#Define Noir -1
#Define Blanc 1

#Define Vrai -1
#Define Faux  0

#Define e8c8 0
#Define e8g8 1
#Define e1c1 2
#Define e1g1 3

'*******************************************************************************

Type Coup
  x1 as Byte
  y1 as Byte
  x2 as Byte
  y2 as Byte
End Type

Function CoupStr(c as Coup) as String
  
  Return Chr(c.x1+97)+Chr(c.y1+49)+Chr(c.x2+97)+Chr(c.y2+49)
  
End Function

Sub StrCoup(s as String, byref c as Coup)
  c.x1=s[0]-97
  c.y1=s[1]-49
  c.x2=s[2]-97
  c.y2=s[3]-49
End Sub

'*******************************************************************************

Type Position
  Damier(7,7) as Byte
  Trait       as Byte
  Roque(3)    as Byte
  Passant     as Byte
  DemiCoups   as Byte
  Pli         as Short
  Valeur      as Short
End Type

'*******************************************************************************

Data -4,-2,-3,-5,-6,-3,-2,-4
Data -1,-1,-1,-1,-1,-1,-1,-1
Data  0, 0, 0, 0, 0, 0, 0, 0
Data  0, 0, 0, 0, 0, 0, 0, 0
Data  0, 0, 0, 0, 0, 0, 0, 0
Data  0, 0, 0, 0, 0, 0, 0, 0
Data  1, 1, 1, 1, 1, 1, 1, 1
Data  4, 2, 3, 5, 6, 3, 2, 4

'*******************************************************************************

Dim shared Courante as Position

'*******************************************************************************

Sub Initialise
  
  Restore
  
  For y as Byte=7 to 0 step -1
    For x as Byte=0 to 7
      Read Courante.Damier(x,y)
    Next x
  Next y
  
  Courante.Trait=Blanc
  
  Courante.Roque(e8c8)=Vrai
  Courante.Roque(e8g8)=Vrai
  Courante.Roque(e1c1)=Vrai
  Courante.Roque(e1g1)=Vrai
  
  Courante.Passant=8
  
  Courante.DemiCoups=0
  Courante.Pli=1
  
End Sub

'*******************************************************************************

Function Passage(c as const Coup, p as const Position) as Byte
  
  Dim x as Byte=c.x1
  Dim y as Byte=c.y1
  Dim vx as Byte=Sgn(c.x2-c.x1)
  Dim vy as Byte=Sgn(c.y2-c.y1)
  Dim Obstacle as Byte=Faux
  Dim Arrivee as Byte=Faux
  
  Do
    x+=vx
    y+=vy
    
    If not(p.Damier(x,y)=Vide) then Obstacle=Vrai
    
    If (x=c.x2) and (y=c.y2) then Arrivee=Vrai
    
  Loop until (Obstacle or Arrivee)
  
  Return Arrivee
  
End Function

'*******************************************************************************

Function Geometrie(c as const Coup, p as const Position) as Byte
  
  
  If (c.x1=c.x2) andalso (c.y1=c.y2) then Return Faux
  
  If Sgn(p.Damier(c.x2,c.y2))=Sgn(p.Damier(c.x1,c.y1)) then Return Faux
  
  Select Case as const Abs(p.Damier(c.x1,c.y1))
  
  Case Pion
    
    If Sgn(c.y2-c.y1)=p.Damier(c.x1,c.y1) then

      If (Abs(c.x2-c.x1)=1) andalso (c.y2-c.y1=p.Damier(c.x1,c.y1)) then
        
        If p.Damier(c.x2,c.y2)=Vide then
          
          If p.Passant=8 then
            Return Faux
          Else
            If c.x2=p.Passant then

              If (p.Damier(c.x1,c.y1)=Blanc) and (c.y1=4) then Return Vrai

              If (p.Damier(c.x1,c.y1)=Noir) and (c.y1=3) then Return Vrai
            End If
          End If
        
        Else
          Return Vrai
        End If
        
      End If
      
      If (c.x2=c.x1) andalso (p.Damier(c.x2,c.y2)=Vide) then
        
        If (c.y2-c.y1=p.Damier(c.x1,c.y1)) then Return Vrai
        
        If (c.y2-c.y1=2*p.Damier(c.x1,c.y1)) then
          
          If p.Damier(c.x1,c.y1+p.Damier(c.x1,c.y1))=Vide then
            
            If (p.Damier(c.x1,c.y1)=Blanc) andalso (c.y1=1) then Return Vrai

            If (p.Damier(c.x1,c.y1)=Noir) andalso (c.y1=6) then Return Vrai
            
          End If
          
        End If
        
      End If
      
    End if
    
  Case Cavalier
    
    If (c.x2-c.x1)*(c.x2-c.x1)+(c.y2-c.y1)*(c.y2-c.y1)=5 then Return Vrai
    
  Case Fou
    
    If (c.x2-c.x1)*(c.x2-c.x1)=(c.y2-c.y1)*(c.y2-c.y1) then
      If Passage(c,p) then Return Vrai
    End If
    
  
  Case Tour
    
    If (c.x2-c.x1)*(c.x2-c.x1)*(c.y2-c.y1)*(c.y2-c.y1)=0 then
      If Passage(c,p) then Return Vrai
    End If
    
  Case Dame
    
    If (c.x2-c.x1)*(c.x2-c.x1)=(c.y2-c.y1)*(c.y2-c.y1) then
      If Passage(c,p) then Return Vrai
    End If
    
    If (c.x2-c.x1)*(c.x2-c.x1)*(c.y2-c.y1)*(c.y2-c.y1)=0 then
      If Passage(c,p) then Return Vrai
    End If
    
  Case Roi
    
    If (c.x2-c.x1)*(c.x2-c.x1)+(c.y2-c.y1)*(c.y2-c.y1)<=2 then Return Vrai
    
    If (c.y2=c.y1) and (Abs(c.x2-c.x1)=2) then
      
      If c.x2=2 then
        
        If p.Damier(1,c.y1)=Vide then
          If p.Damier(2,c.y1)=Vide then
            If p.Damier(3,c.y1)=Vide then
              
              If (p.Damier(c.x1,c.y1)=Roi*Blanc) and p.Roque(e1c1) then Return Vrai
              If (p.Damier(c.x1,c.y1)=Roi*Noir) and p.Roque(e8c8) then Return Vrai
              
            End If
          End If
        End If
        
      End If
      
      If c.x2=6 then
        
        If p.Damier(5,c.y1)=Vide then
          If p.Damier(6,c.y1)=Vide then
            
            If (p.Damier(c.x1,c.y1)=Roi*Blanc) and p.Roque(e1g1) then Return Vrai
            If (p.Damier(c.x1,c.y1)=Roi*Noir) and p.Roque(e8g8) then Return Vrai
            
          End If
        End If
        
      End If
      
    End If
    
  End Select
  
  Return Faux
  
End Function

'*******************************************************************************

Function Echec(p as const Position) as Byte
  
  Dim as Byte x1,y1,x2,y2
  
  y2=7
  x2=0
  
  While not(p.Damier(x2,y2)=Roi*p.Trait)
    x2+=1
    If x2=8 then
      x2=0
      y2-=1
    End If
  Wend
  
  Dim c as Coup
  
  c.x2=x2
  c.y2=y2
  
  For x1=0 to 7
    For y1=0 to 7
      
      If Sgn(p.Damier(x1,y1))=-1*p.Trait then
        
        c.x1=x1
        c.y1=y1
        
        If Geometrie(c,p) then Return Vrai
        
      End If
      
    Next y1
  Next x1
  
  Return Faux
  
End Function

'*******************************************************************************

Function Empechement(p as Position, r as Byte) as Byte
  
  Dim as Byte x1,y1,x2,y2
  Dim as Byte a,b
  
  Select Case as const r
  Case e8c8
    y2=7
    a=0
    b=4
  Case e8g8
    y2=7
    a=4
    b=7
  Case e1c1
    y2=0
    a=0
    b=4
  Case e1g1
    y2=0
    a=4
    b=7
  End Select
  
  Dim c as Coup
  
  c.y2=y2
  
  For x2=a to b
    
    c.x2=x2
    
    For x1=0 to 7
      For y1=0 to 7
        
        If Sgn(p.Damier(x1,y1))=-1*p.Trait then
          
          c.x1=x1
          c.y1=y1
          
          If Geometrie(c,p) then Return Vrai
          
        End If

      Next y1
    Next x1
    
  Next x2
  
  Return Faux
  
End Function

'*******************************************************************************

Sub Mouvement(c as const Coup, byref p as Position)
  
  If (Abs(p.Damier(c.x1,c.y1))=Pion) and ((c.y2=7) or (c.y2=0)) then
    
    p.Damier(c.x1,c.y1)*=Dame
    
  End If
  
  If (Abs(p.Damier(c.x1,c.y1))=Roi) and (Abs(c.x2-c.x1)=2) then
    
    If c.x2=2 then
      p.Damier(3,c.y1)=p.Damier(0,c.y1)
      p.Damier(0,c.y1)=Vide
    Else
      p.Damier(5,c.y1)=p.Damier(7,c.y1)
      p.Damier(7,c.y1)=Vide
    End If
    
  End If
  
  If (Abs(p.Damier(c.x1,c.y1))=Pion) andalso (Abs(c.x2-c.x1)=1) then
    If p.Damier(c.x2,c.y2)=Vide then
      
      p.Damier(c.x1,c.y2)=Vide
      
    End If
  End If
  
  If (Abs(p.Damier(c.x1,c.y1))=Roi) then
    
    If p.Trait=Blanc then
      p.Roque(e1c1)=Faux
      p.Roque(e1g1)=Faux
    Else
      p.Roque(e8c8)=Faux
      p.Roque(e8g8)=Faux
    End If
    
  End If
  
  If (Abs(p.Damier(c.x1,c.y1))=Tour) then
    
    If (c.x1=0) andalso (c.y1=7) then p.Roque(e8c8)=Faux
    If (c.x1=7) andalso (c.y1=7) then p.Roque(e8g8)=Faux
    If (c.x1=0) andalso (c.y1=0) then p.Roque(e1c1)=Faux
    If (c.x1=7) andalso (c.y1=0) then p.Roque(e1g1)=Faux
    
  End If
  
  If (Abs(p.Damier(c.x2,c.y2))=Tour) then
    
    If (c.x2=0) andalso (c.y2=7) then p.Roque(e8c8)=Faux
    If (c.x2=7) andalso (c.y2=7) then p.Roque(e8g8)=Faux
    If (c.x2=0) andalso (c.y2=0) then p.Roque(e1c1)=Faux
    If (c.x2=7) andalso (c.y2=0) then p.Roque(e1g1)=Faux
    
  End If
  
  If (Abs(p.Damier(c.x1,c.y1))=Pion) and (Abs(c.y2-c.y1)=2) then
    p.Passant=c.x1
  Else
    p.Passant=8
  End If
  
  If (Abs(p.Damier(c.x1,c.y1))=Pion) or (p.Damier(c.x2,c.y2)<>Vide) then
    p.DemiCoups=0
  Else
    p.DemiCoups+=1
  End If
  
  If p.Trait=Noir then p.Pli+=1
  
  p.Damier(c.x2,c.y2)=p.Damier(c.x1,c.y1)
  p.Damier(c.x1,c.y1)=Vide
  
  p.Trait*=-1
  
End Sub

'*******************************************************************************

Function Possibles(p as Position) as String
  
  Dim s as String=""
  Dim as Byte x1,y1,x2,y2
  Dim c as Coup
  Dim cs as String
  Dim fictive as Position
  
  For x1=0 to 7
    c.x1=x1
    For y1=0 to 7
      c.y1=y1
      If Sgn(p.Damier(x1,y1))=p.Trait then
        
        For x2=0 to 7
          c.x2=x2
          For y2=0 to 7
            c.y2=y2
            
            If Geometrie(c,p) then
              
              cs=CoupStr(c)
              
              fictive=p
              Mouvement(c,fictive)
              fictive.Trait*=-1
              If Echec(fictive) then cs=""
              
              If Abs(p.Damier(x1,y1))=Roi then
                
                If Abs(c.x2-c.x1)=2 then
                  
                  Select Case cs
                  Case "e8c8"
                    If not(Empechement(p,e8c8)) then
                      s+=cs
                    End If
                  Case "e8g8"
                    If not(Empechement(p,e8c8)) then
                      s+=cs
                    End If
                  Case "e1c1"
                    If not(Empechement(p,e8c8)) then
                      s+=cs
                    End If
                  Case "e1g1"
                    If not(Empechement(p,e8c8)) then
                      s+=cs
                    End If
                  End Select
                  
                End If
                
              Else
                s+=cs
              End If
              
            End If
            
          Next y2
        Next x2
        
      End If
    Next y1
  Next x1
  
  Possibles=s
  
End Function

'*******************************************************************************

Dim shared Prix (Roi*Noir to Roi*Blanc) as Byte

Prix(Roi*Noir)       =   0
Prix(Dame*Noir)      = -80
Prix(Tour*Noir)      = -50
Prix(Fou*Noir)       = -30
Prix(Cavalier*Noir)  = -30
Prix(Pion*Noir)      = -10
Prix(Vide)           =   0
Prix(Pion*Blanc)     =  10
Prix(Cavalier*Blanc) =  30
Prix(Fou*Blanc)      =  30
Prix(Tour*Blanc)     =  50
Prix(Dame*Blanc)     =  80
Prix(Roi*Blanc)      =   0

'*******************************************************************************

Sub Evaluation(byref p as Position)
  
  Dim as Byte x,y
  
  p.Valeur=0
  
  For x=0 to 7
    For y=0 to 7
      
      p.Valeur+=Prix(p.Damier(x,y))*p.Trait
      
    Next y
  Next x
  
End Sub

'*******************************************************************************

Sub Variantes
  
  Dim as Ubyte ff=freefile
  Dim erreur as Integer=Open("Variantes.txt" for output as #ff)
  
  Dim as String pss0,pss1,pss2,pss3
  Dim as Coup c0,c1,c2,c3
  Dim as String*4 cs0,cs1,cs2,cs3
  Dim as Position Fictive,F1,F2,F3
  Dim as Byte i,j,k,l
  
  pss0=Possibles(Courante)
  
  For i=1 to len(pss0)\4
    
    cs0=Mid(pss0,4*i-3,4)
    StrCoup(cs0,c0)
    Fictive=Courante
    Mouvement(c0,Fictive)
    pss1=Possibles(Fictive)
    
    For j=1 to len(pss1)\4
      
      cs1=Mid(pss1,4*j-3,4)
      StrCoup(cs1,c1)
      F1=Fictive
      Mouvement(c1,F1)
      pss2=Possibles(F1)
      
      For k=1 to len(pss2)\4
        
        cs2=Mid(pss2,4*k-3,4)
        StrCoup(cs2,c2)
        F2=F1
        Mouvement(c2,F2)
        pss3=Possibles(F2)
        
        For l=1 to len(pss3)\4
          
          cs3=Mid(pss3,4*l-3,4)
          StrCoup(cs3,c3)
          F3=F2
          Mouvement(c3,F3)
          
          Evaluation(F3)
          
          Print #ff,cs0+cs1+cs2+cs3+String(1,32)+Str(F3.Valeur)
          
        Next l
        
      Next k
      
    Next j
    
  Next i
  
  Close #ff
  
End Sub

'*******************************************************************************

' PROGRAMME PRINCIPAL

Initialise
Variantes

' FIN DU PROGRAMME PRINCIPAL

'*******************************************************************************

Roland Chastain
Posts: 993
Joined: Nov 24, 2011 19:49
Location: France
Contact:

Eschecs 0.8.1

Post by Roland Chastain »

Hello gentlemen !

Here is the current state of my program. It isn't really finished, but maybe someone will be interested in it.

You play only with keyboard : "e2e4", "E2E4", "exit".

Image

Download
Roland Chastain
Posts: 993
Joined: Nov 24, 2011 19:49
Location: France
Contact:

Re: Eschecs

Post by Roland Chastain »

Mouse control is done, with a nice Clickmap made by Muttonhead.

To change the language, please open "Language.ini" and replace "de" with "en" or "fr".

Eschecs 0.8.2

Image
TESLACOIL
Posts: 1769
Joined: Jun 20, 2010 16:04
Location: UK
Contact:

Re: Eschecs

Post by TESLACOIL »

looks quite neat and tidy...do have a go at balancing the brightness and colours tone wise so its easier on the eye

Fast paced arcade games like pacman or space invaders have high brightness high contrast graphics on a plain background to help the eye detect and track objects and movement.

Chess is exactly the opposite, its a slow game which requires deep concentration, thus even minor visual noise is to be avoided. The chess board and interface should be as bland as wallpaper. This allows the minds eye to explore patterns without distraction.

The zebra a herd animal too big to hide in the grass, the zebra uses jazzy stripes to make it hard to select an individual as a target, the lion uses soft colors to blend into the background. Thus a chessboard, which is viewed close up should use the colours of the lion and not the zebra.
Roland Chastain
Posts: 993
Joined: Nov 24, 2011 19:49
Location: France
Contact:

Re: Eschecs

Post by Roland Chastain »

Hello TESLACOIL !

Thanks for your interest in my program, and for these useful observations and thoughts.

Yes, I think I still have to do something for the colors. The current version colors come from a code example. It was a way for me to save time. I had in mind to change it later : that's why I gathered all the color values in a same file, in order to change it easily.

Code: Select all

'Colors.bas

BackgroundColor  = &H9F9F8F
TextColor        = &H000088
GadgetColor      = &H4F8F3F 
GadgetTextColor  = &HFFDF00 
CursorColor      = GadgetColor
MenuColor        = &HD0D0D0
MenuTextColor    = black
MenuHiliteColor  = &H80D0FF
MenuGhostedColor = &H808080

const customWhite as uInteger = rgb(248, 252, 248)
const customGray as uInteger = rgb(200, 200, 184)
const customBlack as uInteger = rgb(24, 28, 8)

const chessBoardForeground as uInteger = &H000088
const chessBoardBackground as uInteger = customWhite
So I could even have several palettes. Contributions welcome !
TESLACOIL
Posts: 1769
Joined: Jun 20, 2010 16:04
Location: UK
Contact:

Re: Eschecs

Post by TESLACOIL »

maybe add a .ini file that reads in the colour theme

this would give enduser/beta tester a chance to experiment with colors without having to edit and compile


Tip, hit google images for chess board themes, take a screen shot of a couple you like and then extract the pixel colour from the bitmap to import into your game.

Once you have found 3 or 4 pleasant colour schemes (go for common ones) add a toggle colour button. Chess players tend to have a strong preference for one of the top dozen colour schemes, a choice of 3 or 4 will give them a chance to select one they can live with. Graphics in chess isn't that demanding as such but it does need a fair bit of attention to detail in order to get it right. A toggle thru 4 way button would suffice, 4 clicks and im back to the start colour.

The order of the other buttons also needs to be instinctive.

Final note, the buttons need to be a bit taller hightwise, you can make them slight narrower...imagine playing a game where the task was to click those buttons as fast as you can, the catchment area for the mouse needs to be big enough to inspire and allow 100% accuracy, the buttons are a tiny bit to short for this at present.


try button height = 66% the height of a chess square with 33% the height of a chess square being the gap between the buttons while keeping the buttons 3 chess squares wide...this looks more balanced and is more clickable + gives room for the text to breathe height-wise.

or even better 5 button heights = 3 chess square heights 5:3 ratio (ignoring spaces ) , as in current button height x 125% ish



Important
Button size is dictated by mouse click catchment, this is dependent on the screen resolution the user is running the program in. Small buttons will be fine full screen but will be fiddly to use in a small window. When using a chess program the chess board is between 4 inches and 8 inches across. Smaller inches = hard to see, larger inches just not needed as the board starts to get in your face, too big....thus picking buttons that work at 4 to 8 inch chessboard size is what you need to aim for.

If im actually playing a chess game on a computer i will use a board that's around 6 inches wide as this is around the right size to easily move the pieces by mouse. 4 inches = lean forward on a sub 20in monitor , 8 inches = lean back experience on a 20in+ monitor


ps i tried to compile your code Eschecs 0.8.2 but got zillions of errors everywhere, at some point you will need to write an installer / zip that includes all the files, i think several dependent files where missing from that zip



final thoughts

as your chess engine is gonna suck compared to the competition at least have a clean and simple or cute n sexy and fun to use interface...by getting the interface right you will raise your chess program head and shoulders above the ocean of other solo efforts (most of which leave you visually and physically impaired after prolonged use, lol )...the idea is to try and avoid end user ' instal, ugh !, uninstall' moments

a good source of free engines and free gui's
http://freechess.50webs.com/index.html

...you could at some stage add some code to either export your chess engine into fritz/arena GUI or import a top chess engine into your GUI...there is little need or demand for standalone chess games these days, casual and serious players like to play off chess engines against each other in automated matches, or on occasion play against a top engine to try and improve their game, they sure as heck aint gonna win vs a 3000elo chess engine....annoyingly fritz does not allow network play (at least not without much hassle)

...computer programmers will often write stand alone chess games, but the reality is that no one ever really uses them in the real world. Way back in the 80s and 90s there was genuine interest and widespread use but in 2012 every chess player has easy access to the top chess engines and top 10 chess gui's ...this has also pretty much killed of dedicated console type chess machines as a top engine running on a clunky P4 will just rip them apart...weak engines are very unsatisfying for humans to play against, one minute they are playing fine then they will make total bright moves and you realize you just wasted 40mins of your life
Last edited by TESLACOIL on Jul 24, 2012 15:53, edited 1 time in total.
Roland Chastain
Posts: 993
Joined: Nov 24, 2011 19:49
Location: France
Contact:

Re: Eschecs

Post by Roland Chastain »

TESLACOIL wrote:ps i tried to compile your code Eschecs 0.8.2 but got zillions of errors everywhere, at some point you will need to write an installer / zip that includes all the files, i think several dependent files where missing from that zip
Thanks for all your suggestions, TESLACOIL. I have just tried to download and compile my program. All the files are in it. The file to compile is "Main.bas".
TESLACOIL
Posts: 1769
Joined: Jun 20, 2010 16:04
Location: UK
Contact:

Re: Eschecs

Post by TESLACOIL »

just had an idea

while its a lot of work getting your software to work with standard chess software it should be fairly easy to export moves between two versions of your chess program, just spit out the moves to a file that can be read by the other chess exe (this avoids memory/pipe/hassles)

this would allow you to have Eschecs v8 play vs Eschecs v8+something and allow you to run automated matches, this will rapidly improve the strength of your prog and allow you to tune up time controls for any given move/position...ie if position = complex+many threats then time+time+n cycles...and also if position is not improving after n cycles then just move now, these two overwatch functions will greatly improve the intrinsic strength by managing time better, chess programs are by and large about managing time as chess is not solvable via brute force.

dumb search+time overwatch will get you to a decent base level when the prog is run on a fast machine, you have about 2 billion short lines of code a second that can execute on a modern quad core/hex core if you can encourage all cores to be used...one method is to have 4 chess engines all with different settings, after x time they compare results and vote on the move

Example

Eschecs main, launches 4 exes

Eschecs attacker
Eschecs drawer
Eschecs dumb brute force
Eschecs strategic/tactical

depending on the metrics you use to measure the current position ( Eschecs strategic/tactical ) this will add or subtract weight from the votes the other 3 engines make. 4 exes will ensure 4 cores are utilized and not just one, this will significantly improve the strength of your engine for very little code effort...no point in having 1+ cores sitting idle...pretty soon everyone will have quad core+ computers
Roland Chastain
Posts: 993
Joined: Nov 24, 2011 19:49
Location: France
Contact:

Re: Eschecs

Post by Roland Chastain »

Thanks for your suggestions, TESLACOIL.

Here is Eschecs 0.8.3.

Image

I made a little color names library and I used it to compose several simple palettes. Unfortunately you have to edit the code to change the colors option :

Code: Select all

'Colors.bas
Couleurs = 0
TESLACOIL
Posts: 1769
Joined: Jun 20, 2010 16:04
Location: UK
Contact:

Re: Eschecs

Post by TESLACOIL »

The colours in the pic above are much better. 7/10 not perfect but playable.


Black bishop stray pixels on the base,not like whites

Don't play button =??? , stop ? pause ? end game ? resign ?

With chess software you have to be a bit bland and boring because that's what the end user expects, wants & actually needs





Eschecssettings.exe
Many programs , even professional made games have a separate exe to set things like graphics and key bindings etc so you could write a small separate Eschecssettings.exe , this would create Eschecs.txt , a text file which contains the pallet switch. Your main Eschecs.exe look to see if Eschecs.txt exists and if it does it then loads in the pallete switch. If it doesn't find that Eschecs.txt file it simply loads the default pallete

as your main program is probably getting quite hard to edit, having a separate exe to change settings or load in game positions ( future update ?) helps break the code up into readable chunks

just some ideas to help you out, when you are coding on your own its easy to paint yourself in a corner code wise or run out of steam



One of my favorite games , Redalert had a text file called rules.ini, this allowed you to change 100s of settings of the game. The makers didn't bother to remove the 'default look up' so countless 1000s of people had endless fun tweaking the rules.ini file. At first people used to edit and guess by hand, it was a huge text file but readable, later on someone on the net made a special exe just to read and edit the rules.ini file (once they figured out what did and didn't crash the game :-p)....by not tying up the loose ends prior to release the developers of red alert actually gave the game an extended lease of life

type rules.ini into google today and you will see the legend still lives on
Roland Chastain
Posts: 993
Joined: Nov 24, 2011 19:49
Location: France
Contact:

Re: Eschecs

Post by Roland Chastain »

Hello !

Here is Eschecs 0.8.4.

Includes Settings.exe :

Image
Last edited by Roland Chastain on Aug 13, 2012 18:40, edited 1 time in total.
Post Reply