sronco / mame-chessengine

MAME Chess UCI/XBoard Interface plugin
10 stars 6 forks source link

Support for Computers with special Level-Modus #10

Open HartmutHering opened 5 years ago

HartmutHering commented 5 years ago

Hi Sronco. I like your lua-scripts for the dedicated chess-computers. But I have a problem with some machines who have special ways to define a time control. One of many examples is Mephisto Almeria or Mephisto Berlin. It is possible to say e.g.: "Normal 01". But how can I define that I want to play with Tournament Modus and for example 40 moves in 2 hours? I can say: Use Tournament Modus (TOURN 01) but there is no way to define 40 Moves in 2 Hours without doing it manually. That problem exists in many drivers (not only mephisto drivers)

Vegetatio commented 5 years ago

Hello S.Ronco,

many thanks to your great work.

I have changed the UCI area in the plugin so that the time control is taken over by the plugin. Also, moves can now be taken back, as well as a move sequence can be specified. To do this, the interfaces need to be expanded.

My question is, can I publish my changes? Do you want to use them?

by the way, how kein i read the display of the tasc and the corona, because convert to example bishop is not possible and with corona the conversion to a queen does not work properly

regards Guido

MESS
sronco commented 5 years ago

Hi,

@HartmutHering Some chess computers have many configuration parameters and some require you to navigate through menus to change them, you can expose these settings to the uci interface, but it requires a lot of work. If you know a bit of LUA you should be able to modify the interfaces to change these settings, however I will try to see if I can do this at least for the Mephisto drivers.

@Vegetatio This plugin is licensed under 3-Clause BSD, so you can publish your changes wherever you want, but any help to develop/maintain the plugin is welcome, so if you want to share your changes you can create a pull request in this repo. In order to read the corona display it is necessary to read the individual pixels and combine them into a value that can be compared with the required pattern.

HartmutHering commented 5 years ago

Hi Sandro I am not very familar with LUA but I know a lot about Visual Basic. As much as I have seen, there are a lot of similarities. If you could do that with the Mephisto-drivers and add a few comments what the different functions are doing, I'd be able to get used to them and write such code for other drivers too

@Vegetatio It qould be great if you would publish your code. The output reminds me a little on the very few old versions of some engines that one could download from the Rebel-Homepage a few years ago. To have something like that for some more engines would be really fantastic.

Vegetatio commented 5 years ago

@sronco i had almost guessed that this wouldn't be easy with the display of the Corona and Tasc. I just don't know how to read the data. I need a little start-up help. At the Risc, you had implemented the promotion. Therefore, I could work with the line 'local ddram = emu.item(machine.devices[':maincpu']:owner().items['0/m_vram']):read_block(0x00, 0x100)' and can now read the numbers 0-9 and thus set the level. I now also need this line for the Tasc and Corona.

for your help I would be very grateful.

@HartmutHering Most of the work will be to expand the interfaces if you want to see everything. In order to implement only the time control there only has to put where stop unequal go is on the interfaces and to set the level of the device to the highest level

Vegetatio commented 5 years ago

Hello Sandro Ronco,

I have started a pull-request, but I am not sure I have done everything right. I uploaded init.lua and sexpert.lua

Thank you!

sronco commented 5 years ago

You can read the tasct30 display RAM in this way

    local dram = machine.devices[':lcd:lcdc'].spaces['display']
    local byte = dram:read_u8(0x0000)    -- offset from 0x0000 to 0x1fff

but the lcd controller used in this machine is more complex than the one in risc and can have both text and graphic layers, if you need more info you can read the T6963C datasheet.

The value of the first line of the corona 7x7 dmd can be obtained with this

    local l0 = (machine:outputs():get_value("lcd3.11.2") << 6) |
               (machine:outputs():get_value("lcd3.11.1") << 5) |
               (machine:outputs():get_value("lcd3.11.3") << 4) |
               (machine:outputs():get_value("lcd3.0.3") << 3) |
               (machine:outputs():get_value("lcd3.0.0") << 2) |
               (machine:outputs():get_value("lcd3.0.1") << 1) |
               (machine:outputs():get_value("lcd3.0.2") << 0)

you can get the pixel tag for the other 6 lines in the corona layout at line 519

Hope this helps

Vegetatio commented 5 years ago

Thank you S. Ronco, will try to read me there,

@H.Hering have a look https://www.miclangschach.de/forum/viewtopic.php?f=10&t=355

Vegetatio commented 5 years ago

Hello S.Ronco,

I uploaded the tascr30. It should now also be underpromoted.

The Corona is special. If the opponent wants to underpromote, he has to get the pawn, then press the button for the pieces (Right of the board) and then select the target field. I can see correctly that I have to integrate a new function call in Ini.lua in the function 'make move' there?

Such as. if interface.select_piece then if not piece_get then interface.select_piece(from.x, from.y, "get" .. reason) emu.wait(0.5) End if board[to.y][to.x] interface.select_piece(to.x, to.y, "capture") End interface.promote_special -- <- nee function for corona ? interface.select_piece(to.x, to.y, put .. reason) End

Greetings Guido

Vegetatio commented 5 years ago

it works:

if interface.select_piece then if not piece_get then interface.select_piece(from.x, from.y, "get" .. reason) emu.wait(0.5) end if (move:len() >= 5) then if ply~=my_color and interface.promote_special then interface.promote_special(move:sub(move:len())) -- some engine need at promotion the piece between from and to end end if board[to.y][to.x] ~= 0 then interface.select_piece(to.x, to.y, "capture") end interface.select_piece(to.x, to.y, "put" .. reason) end

and in Stratos.lua

function interface.promote_special(piece) if piece=="r" then send_input(":IN.2", 0x01, 1) elseif piece=="b" then send_input(":IN.2", 0x04, 1) elseif piece=="n" then send_input(":IN.3", 0x02, 1) end end

HartmutHering commented 5 years ago

Hm... Nearly Two months ago. Doesn't seem to be that easy to solve the problem...

Hi,

@HartmutHering Some chess computers have many configuration parameters and some require you to navigate through menus to change them, you can expose these settings to the uci interface, but it requires a lot of work. If you know a bit of LUA you should be able to modify the interfaces to change these settings, however I will try to see if I can do this at least for the Mephisto drivers.