xkapastel has quit [Quit: Connection closed for inactivity]
orivej has joined #picolisp
razzy has joined #picolisp
<razzy>
i like title "programming from first principles"
<Regenaxer>
Good morning razzy
<razzy>
Good sunday morning to all :]
orivej has quit [Ping timeout: 272 seconds]
alexshendi has joined #picolisp
orivej has joined #picolisp
alexshendi has quit [Read error: No route to host]
alexshendi has joined #picolisp
* razzy
spend 2 days meditating about how pico-chess engine making moves. (move) function seem to use only class and ending field. ("WhiteNight" . d5) . Razzy is still not sure how engine ensure that pick right starting piece.
* razzy
remembered that he somehow solved the issue few moths back and forgotten about it.
ubLIX has joined #picolisp
_whitelogger has joined #picolisp
orivej has quit [Ping timeout: 240 seconds]
orivej has joined #picolisp
xkapastel has joined #picolisp
_whitelogger has joined #picolisp
alexshendi has quit [Ping timeout: 252 seconds]
ubLIX has quit [Quit: ubLIX]
alexshendi has joined #picolisp
alexshendi has quit [Read error: Connection reset by peer]
alexshendi has joined #picolisp
<Regenaxer>
razzy: "WhiteNight" is a symbol
<Regenaxer>
a transient symbol, in this case an object (a piece)
<Regenaxer>
: (show 'a1)
<Regenaxer>
a1 ((NIL . b1) NIL . a2)
<Regenaxer>
piece "WhiteRook"
<Regenaxer>
whAtt ("WhiteQueen")
<Regenaxer>
color
<Regenaxer>
y 1
<Regenaxer>
x 1
<Regenaxer>
-> a1
<Regenaxer>
: (show @ 'piece)
<Regenaxer>
"WhiteRook" (+White +Rook)
<Regenaxer>
field a1
<Regenaxer>
attacks (b1 c1 d1 a2)
<Regenaxer>
cnt 0
<Regenaxer>
ahead ((This) (: 0 -1 -1))
<Regenaxer>
*Dbg ((1 . "pos.l"))
<Regenaxer>
-> "WhiteRook"
<Regenaxer>
The moves are made by manipulating field and piece objects
alexshendi has quit [Read error: Connection reset by peer]
alexshendi has joined #picolisp
<razzy>
Regenaxer: thx for time. i get what you said. i have problem if i have 2 Rooks which can move to a2 for example. (go a1 a2) evals (move ("WhiteRook" . a2) at some point. I do not get how (move) function knows that you mean to move Rook from a1 not h1. where i propably have problem is using messages between methods which i do not understand.
<Regenaxer>
I see!
<Regenaxer>
"WhiteRook" is a *symbol*
<Regenaxer>
not a string
<Regenaxer>
It is the object
<Regenaxer>
"WhiteRook" is just the name of that symbol
<Regenaxer>
And yes, there are two symbols with the name "WhiteRook"
<razzy>
whaaaaaaat?
<Regenaxer>
but still they are separate objects
<razzy>
mindblown :D,
<Regenaxer>
You really should try to understand symbols
<razzy>
still, how does picolisp know which "WhiteRook" i mean?
<Regenaxer>
It would work even if the objects had no names at all
<Regenaxer>
The names are just for debugging
<Regenaxer>
They are not used
<Regenaxer>
Then all objects (fields and pieces) would look like $354776073567
<Regenaxer>
The names of symbols are irrelevant, except if you operate on the name withe 'chop' or 'print', i.e. when you use them as "strings"
<razzy>
Regenaxer: it is not very helpfull for debugging if you have two symbols with same name and you cannot ask repl what is inside :]
<Regenaxer>
You can ask of course
<Regenaxer>
: (show 'a1 'piece)
<Regenaxer>
"WhiteRook" (+White +Rook)
<Regenaxer>
field a1
<Regenaxer>
attacks (b1 c1 d1 a2)
<Regenaxer>
cnt 0
<Regenaxer>
ahead ((This) (: 0 -1 -1))
<Regenaxer>
*Dbg ((1 . "pos.l"))
<Regenaxer>
-> "WhiteRook"
<Regenaxer>
: (show 'h1 'piece)
<Regenaxer>
"WhiteRook" (+White +Rook)
<Regenaxer>
field h1
<Regenaxer>
attacks (g1 h2)
<Regenaxer>
cnt 0
<Regenaxer>
ahead ((This) (: 0 -1 -1))
<Regenaxer>
*Dbg ((1 . "pos.l"))
<Regenaxer>
-> "WhiteRook"
<Regenaxer>
: (== @ @@)
<Regenaxer>
-> NIL
<Regenaxer>
Two different objects
<Regenaxer>
just accidentally both with the name "WhiteRook" ;)
<razzy>
Regenaxer: than my tries to save history with just saving *Undo are destined to failure
<razzy>
because i safe only names :]
<razzy>
now i know
<Regenaxer>
OK, but *Undo stores the objects, so it schould be fine
<Regenaxer>
pushes the whole move
<Regenaxer>
Ah, you mean saving to a file?
<razzy>
yop
<Regenaxer>
Right, this is not useful
<razzy>
phew, that is one goal done.
<Regenaxer>
:)
<Regenaxer>
You could modify the 'piece' function
<Regenaxer>
To put more into the name, eg "WhiteRook1""
<Regenaxer>
But still there is much more, the whole state of the piece and the board
<Regenaxer>
Not simple to save
<razzy>
btw, does not seem to obide "what you see that you get" picolisp rule
<Regenaxer>
This is valid only for s-expressions
<Regenaxer>
not the state of a whole system
<razzy>
ah, i would like most of the system that way
<razzy>
not sure how
ubLIX has joined #picolisp
<Regenaxer>
You can always do, needs to serialize all objects
<Regenaxer>
Just as the DB does
<Regenaxer>
If you put pieces and fields as DB objects, you are done ;)
<razzy>
i will save starting board and move *Undo to *Redo collum :] and that should do :]
<Regenaxer>
The 'ppos' function does only a simple save of the chess position
<razzy>
i know :]
<Regenaxer>
What if you call 'ppos' after each move?
<razzy>
to same file?
<razzy>
to new file?
<razzy>
i want history
<razzy>
for replays :]
<Regenaxer>
yes, appending, or a new file each time
<Regenaxer>
file1, file2 ...
<razzy>
that does not do replays
<Regenaxer>
I think it does. Load one file after the other
<razzy>
i want to analyse each position
<razzy>
your proposal do not fill undo redo stacks
<Regenaxer>
I forgot how to load a position saved by 'ppos'
<Regenaxer>
correct
<razzy>
simple eval insides
<Regenaxer>
yes, just 'load'
<Regenaxer>
So you undo by loading the previous file
<razzy>
i had strong emotions about those symbols.
<Regenaxer>
Which kind of emotions?
<Regenaxer>
I think you could experiment with *internal* symbols to achieve what you want
<Regenaxer>
You give uniqe names to the pieces, and intern them
<Regenaxer>
Just like the fields, a1 b1 ...
<Regenaxer>
The fields are also internal symbols
<razzy>
impossible "WhiteRook" symbol :D. i tried all emotions. than settled on emptiness
<Regenaxer>
You could change the function which creates the pieces: