Simplifying code

Discussion of chess software programming and technical issues.

Moderators: Harvey Williamson, Dann Corbit, hgm

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
User avatar
mvanthoor
Posts: 560
Joined: Wed Jul 03, 2019 2:42 pm
Full name: Marcel Vanthoor

Re: Simplifying code

Post by mvanthoor » Sat Nov 07, 2020 2:32 pm

If your code contains a lot of cruft you don't know what to do with, wouldn't it just be better to scrap the engine and start from scratch, doing it differently this time?

If I hadn't rewritten parts of my current code so often during development (as in: it works like this, just leave it like that), I wouldn't have been able to make heads or tails of my engine right now. As soon as I write something that works, the next step *immediately* is to split that code off into its own functions/modules (whatever is most appropriate), and fix naming conventions and that sort of stuff.

Henk
Posts: 6657
Joined: Mon May 27, 2013 8:31 am

Re: Simplifying code

Post by Henk » Sat Nov 07, 2020 2:45 pm

Don't know. Starting from scratch is a lot of work and I usually end up making same mistakes for I forget.

By the way for user interface i am still using ASP.NET MVC while they have Blazor now. Don't know what would be advantage of Blazor.
Also thought about using F# instead of C#. But don't think Blazor supports F#. Or maybe write engine in F# and user interface in Blazor.
Hardly anybody using F# so it is bad for integration.

Sven
Posts: 3884
Joined: Thu May 15, 2008 7:57 pm
Location: Berlin, Germany
Full name: Sven Schüle
Contact:

Re: Simplifying code

Post by Sven » Sat Nov 07, 2020 4:14 pm

Why do you bother with a user interface for your chess engine? There are enough GUIs around so you only need to provide a working UCI or WB protocol support so that you can focus on the chess engine itself ...
Sven Schüle (engine author: Jumbo, KnockOut, Surprise)

Henk
Posts: 6657
Joined: Mon May 27, 2013 8:31 am

Re: Simplifying code

Post by Henk » Sat Nov 07, 2020 4:25 pm

Sometimes I want to display idiotic information next to a visualized position and zero probability an existing user interface supports that.
Quickly going from one table to the next.

User avatar
mvanthoor
Posts: 560
Joined: Wed Jul 03, 2019 2:42 pm
Full name: Marcel Vanthoor

Re: Simplifying code

Post by mvanthoor » Sat Nov 07, 2020 5:48 pm

Sven wrote:
Sat Nov 07, 2020 4:14 pm
Why do you bother with a user interface for your chess engine? There are enough GUIs around so you only need to provide a working UCI or WB protocol support so that you can focus on the chess engine itself ...
Because some (if not most) GUI's sorely need updating to work on newer high resolution displays.

Personally, after my engine reaches a strength somewhere in the 2500's, I fully intend to start writing a new GUI (probably based on Electron for the front-end so I can use HTML/CSS to style it, and a Rust backend). I'm making this chess engine/GUI writing stuff my personal programming projects so in the end, I have my very own chess engine and GUI to precisely use as I intend. Somewhere far down the line, I also intend to try and create a replacement for Picochess. Great project, but it's written in Python... and I detest that language.

So in the future, I hope to have not only my own chess engine, but also my own GUI, and my own linux-based chess computer to tinker with; hopefully for the rest of my life.

User avatar
hgm
Posts: 25424
Joined: Fri Mar 10, 2006 9:06 am
Location: Amsterdam
Full name: H G Muller
Contact:

Re: Simplifying code

Post by hgm » Sun Nov 08, 2020 8:50 am

Well, be forewarned that writing a GUI is typically about 100 times as much work as writing an engine.

I am not sure what exactly you mean by 'high-resolution display'. WinBoard has always supported square sizes up to 129x129 pixels to cater to the higher resolutions, and allowing even larger square sizes would be a trivial modification. XBoard now uses SVG images for the pieces, which can be scaled to arbitrary size without loss of quality.
Get rid of the shit: vote for SHID!

User avatar
hgm
Posts: 25424
Joined: Fri Mar 10, 2006 9:06 am
Location: Amsterdam
Full name: H G Muller
Contact:

Re: Simplifying code

Post by hgm » Sun Nov 08, 2020 8:52 am

Henk wrote:
Sat Nov 07, 2020 4:25 pm
Sometimes I want to display idiotic information next to a visualized position and zero probability an existing user interface supports that.
Quickly going from one table to the next.
WinBoard/XBoard supports printing arbitrary text in the engine-output window.
Get rid of the shit: vote for SHID!

Daniel Anulliero
Posts: 724
Joined: Fri Jan 04, 2013 3:55 pm
Location: Nice

Re: Simplifying code

Post by Daniel Anulliero » Sun Nov 08, 2020 9:00 am

hgm wrote:
Sun Nov 08, 2020 8:52 am
Henk wrote:
Sat Nov 07, 2020 4:25 pm
Sometimes I want to display idiotic information next to a visualized position and zero probability an existing user interface supports that.
Quickly going from one table to the next.
WinBoard/XBoard supports printing arbitrary text in the engine-output window.
Of course
And Arena too can display any informations you want , in the log window 😉

Henk
Posts: 6657
Joined: Mon May 27, 2013 8:31 am

Re: Simplifying code

Post by Henk » Sun Nov 08, 2020 9:38 am

Daniel Anulliero wrote:
Sun Nov 08, 2020 9:00 am
hgm wrote:
Sun Nov 08, 2020 8:52 am
Henk wrote:
Sat Nov 07, 2020 4:25 pm
Sometimes I want to display idiotic information next to a visualized position and zero probability an existing user interface supports that.
Quickly going from one table to the next.
WinBoard/XBoard supports printing arbitrary text in the engine-output window.
Of course
And Arena too can display any informations you want , in the log window 😉
Might be WinBoard/XBoard does not exist in the future like CTF. Same may hold for Arena.
I even remember that I accidentally deleted or moved Winboard on my computer.

Henk
Posts: 6657
Joined: Mon May 27, 2013 8:31 am

Re: Simplifying code

Post by Henk » Sun Nov 08, 2020 11:03 am

One advantage of Blazor is that you don't need to program in javascript. Although in my current ASP.NET MVC (core) solution I hardly use javascript.

Post Reply