Recent

Author Topic: Clericus/Hopeless (chess program)  (Read 453 times)

Roland57

  • Jr. Member
  • **
  • Posts: 78
Clericus/Hopeless (chess program)
« on: July 31, 2020, 12:35:52 pm »
Hello!

I would like to present Clericus, a chess program by Pawel Koziol.

It is a Delphi project that I updated and converted to Lazarus.

You can download it here:
https://gitlab.com/rchastain/hopeless-lazarus

The project has two build modes. With the "Default" mode, it is a graphical application. With the "XBoard" mode, it is a console application, to be used with XBoard or WinBoard or another sofware using the CECP protocol.

The name of the XBoard engine is Hopeless.

I develop and test the application under Linux. For now the XBoard engine doesn't work perfectly. I don't know if this comes from the conversion from Delphi to Lazarus, or from the difference between Windows and Linux. I will say more in another message.

All comments and contributions welcome.

Thank you for your attention.

Roland

Roland57

  • Jr. Member
  • **
  • Posts: 78
Re: Clericus/Hopeless (chess program)
« Reply #1 on: July 31, 2020, 12:46:33 pm »
There was no problem with the Delphi/Windows version. I didn't try the Lazarus program under Windows, because I no longer have a Windows system.

Sometimes the application sends this warning:
Quote
Gtk-WARNING **: 07:17:01.353: Invalid text buffer iterator: either the iterator is uninitialized, or the characters/pixbufs/widgets in the buffer have been modified since the iterator was created. You must use marks, character numbers, or line numbers to preserve a position across buffer modifications. You can apply tags and insert marks without invalidating your iterators, but any mutation that affects 'indexable' buffer contents (contents that can be referred to by character offset) will invalidate all outstanding iterators.

And also this one:
Quote
GLib-GObject-CRITICAL **: 07:34:03.746: g_object_ref: assertion 'old_val > 0' failed
GLib-GObject-CRITICAL **: 07:34:03.746: g_object_unref: assertion 'G_IS_OBJECT (object)' failed

But there is no line number so I don't know where to search. If someone has a suggestion...

But, as far as I know, the problem appears only with the XBoard engine. The graphical application seems to work well.

P. S. Yet another error message:
Quote
Gtk:ERROR:gtktextlayout.c:2349:IA__gtk_text_layout_get_line_display: code should not be reached
« Last Edit: August 01, 2020, 03:43:55 pm by Roland57 »

Blaazen

  • Hero Member
  • *****
  • Posts: 2901
  • POKE 54296,15
    • Eye-Candy Controls
Re: Clericus/Hopeless (chess program)
« Reply #2 on: July 31, 2020, 02:27:36 pm »
So I made it compile flawlessly in Linux+Qt trunk (Lazarus 2.1.0 r63671M FPC 3.3.1 x86_64-linux-qt). Some notes:

1) Game cannot be resized. I can make a form larger but game area and all outputs remain same.

2) Settings are saved explicitly when I click Settings-> Save Settings. I would expect it will save settings when I exit the program.

3) I played to a stalemate (which is a wonder since I'm poor player) and then I moved my king. It raised Range Check Error at search.pas, line 733:
Code: Pascal  [Select][+][-]
  1. WriteHash( HNo, HTemp, BestMove.SqFr, BestMove.SqTo, Depth, Best, InitialAlfa, Beta );
Here's a full Call Stack:
Code: Pascal  [Select][+][-]
  1. #0 SYSTEM_$$_HANDLEERRORADDRFRAME$LONGINT$POINTER$POINTER at :0
  2. #1 SYSTEM_$$_HANDLEERRORADDRFRAMEIND$LONGINT$POINTER$POINTER at :0
  3. #2 SEARCH(0x7f00ffff7408, -17056, 4799107, 4434766, -30001, 5, 207) at search.pas:733
  4. #3 SEARCH(0x7ffff7f9f9d0, 1, 1, -30001, -30000, 0, false) at search.pas:733
  5. #4 ROOTSEARCH(0x7ffff7f9f9d0, 0, 2, -30001, 30001) at root.pas:114
  6. #5 ITERATE(0x7ffff7f9f9d0, 7) at iterate.pas:64
  7. #6 DOTHINKING at main.pas:774
  8. #7 ACTIVATEPROGRAM at main.pas:837
  9. #8 SGBOARDMOUSEUP(0x7ffff7f9de50, 0x7ffff7f96490, MBLEFT, [], 239, 179) at main.pas:1088
  10. #9 MOUSEUP(0x7ffff7f96490, MBLEFT, [], 239, 179) at include/control.inc:4489
  11. #10 MOUSEUP(0x7ffff7f96490, MBLEFT, [], 239, 179) at grids.pas:6914
  12. #11 DOMOUSEUP(0x7ffff7f96490, {MSG = 514, KEYS = 0, XPOS = 239, YPOS = 179, POS = {X = 239, Y = 179}, DUMMY = 11731183, RESULT = 0}, MBLEFT) at include/control.inc:2300
  13. #12 WMLBUTTONUP(0x7ffff7f96490, {MSG = 514, KEYS = 0, XPOS = 239, YPOS = 179, POS = {X = 239, Y = 179}, DUMMY = 11731183, RESULT = 0}) at include/control.inc:2782
  14. #13 SYSTEM$_$TOBJECT_$__$$_DISPATCH$formal at :0
  15. #14 ?? at :0
  16. #15 ?? at :0
  17. #16 ?? at :0
  18. #17 ?? at :0
  19. #18 .Ld251 at :0
  20. #19 ?? at :0
  21. #20 ?? at :0
  22. #21 ?? at :0
  23. #22 ?? at :0
  24. #23 VMT_$GRIDS_$$_TSTRINGGRIDSTRINGS$indirect at :0
  25. #24 ?? at :0
  26. #25 WNDPROC(0x7ffff7f96490, {MSG = 514, UNUSEDMSG = 0, WPARAM = 0, LPARAM = 11731183, RESULT = 0}) at include/control.inc:2240
  27. #26 WNDPROC(0x7ffff7f96490, {MSG = 514, UNUSEDMSG = 0, WPARAM = 0, LPARAM = 11731183, RESULT = 0}) at include/wincontrol.inc:5429
  28. #27 WNDPROC(0x7ffff7f96490, {MSG = 514, UNUSEDMSG = 0, WPARAM = 0, LPARAM = 11731183, RESULT = 0}) at grids.pas:4947
  29. #28 DELIVERMESSAGE(0x7fffea92a200, 0, true) at qt/qtwidgets.pas:5646
  30. #29 SLOTMOUSE(0x7fffea92a200, 0x5651040, 0x7fffffffdd00) at qt/qtwidgets.pas:3720
  31. #30 EVENTFILTER(0x7fffea92a200, 0x5651040, 0x7fffffffdd00) at qt/qtwidgets.pas:2622
  32. #31 EVENTFILTER(0x7fffea92a200, 0x5651040, 0x7fffffffdd00) at qt/qtwidgets.pas:16878
  33. #32 VIEWPORTEVENTFILTER(0x7fffea9325e0, 0x7fffffffdd00, 0x7fffffffd947) at qt/qtwidgets.pas:17392
  34. #33 QLCLAbstractScrollArea::viewportEvent(QEvent*) at :0
  35. #34 QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) at :0
  36. #35 QApplicationPrivate::notify_helper(QObject*, QEvent*) at :0
  37. #36 QApplication::notify(QObject*, QEvent*) at :0
  38. #37 QCoreApplication::notifyInternal(QObject*, QEvent*) at :0
  39. #38 QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) at :0
  40. #39 ?? at :0
  41. #40 QApplication::x11ProcessEvent(_XEvent*) at :0
  42. #41 ?? at :0
  43. #42 g_main_context_dispatch at :0
  44. #43 ?? at :0
  45. #44 g_main_context_iteration at :0
  46. #45 QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) at :0
  47. #46 ?? at :0
  48. #47 QCoreApplication::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) at :0
  49. #48 QCoreApplication_processEvents at :0
  50. #49 APPWAITMESSAGE(0x7ffff7f8ef90) at qt/qtobject.inc:344
  51. #50 IDLE(0x7ffff7f8eb50, true) at include/application.inc:397
  52. #51 HANDLEMESSAGE(0x7ffff7f8eb50) at include/application.inc:1209
  53. #52 RUNLOOP(0x7ffff7f8eb50) at include/application.inc:1327
  54. #53 APPRUN(0x7ffff7f8ef90, {Proc = {procedure (POINTER)} 0x7fffffffe580, Self = 0x7ffff7f8eb50}) at qt/qtobject.inc:326
  55. #54 RUN(0x7ffff7f8eb50) at include/application.inc:1315
  56. #55 main at clericus.lpr:26
  57.  
Lazarus 2.1.0 r63881 FPC 3.3.1 r40507 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

Roland57

  • Jr. Member
  • **
  • Posts: 78
Re: Clericus/Hopeless (chess program)
« Reply #3 on: July 31, 2020, 02:38:39 pm »
@Blaazen

Thank you for the feedback. I will try to understand what happens in case of stalemate, and also will see what I can do about game area and settings.

Regards.

Roland

Roland57

  • Jr. Member
  • **
  • Posts: 78
Re: Clericus/Hopeless (chess program)
« Reply #4 on: July 31, 2020, 10:02:43 pm »
The problem of user move when the game is over is solved.

Code: Pascal  [Select][+][-]
  1. procedure TForm1.sgBoardMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
  2. begin
  3.   if GameOver then
  4.     Exit;

The repository has been updated.

It's funny, when you write a program, you always forget (maybe I should say I always forget) that the user could try to make forbidden things.  :)

@Blaazen

Thanks again for the bug report. Now I will think of what you said about settings.

Roland57

  • Jr. Member
  • **
  • Posts: 78
Re: Clericus/Hopeless (chess program)
« Reply #5 on: August 01, 2020, 06:43:01 pm »
I found the bug which was preventing the XBoard engine from working.  :)

I also removed the "Save settings" menu item. Now the settings are automatically saved, as long as you close the application by clicking on the "Quit" menu item.

The GitLab repository has been updated.

 

TinyPortal © 2005-2018