Simplifying code

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
mvanthoor
Posts: 1784
Joined: Wed Jul 03, 2019 4:42 pm
Location: Netherlands
Full name: Marcel Vanthoor

Re: Simplifying code

Post by mvanthoor »

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.
Author of Rustic, an engine written in Rust.
Releases | Code | Docs | Progress | CCRL
Henk
Posts: 7216
Joined: Mon May 27, 2013 10:31 am

Re: Simplifying code

Post by Henk »

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: 4052
Joined: Thu May 15, 2008 9:57 pm
Location: Berlin, Germany
Full name: Sven Schüle

Re: Simplifying code

Post by Sven »

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: 7216
Joined: Mon May 27, 2013 10:31 am

Re: Simplifying code

Post by Henk »

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: 1784
Joined: Wed Jul 03, 2019 4:42 pm
Location: Netherlands
Full name: Marcel Vanthoor

Re: Simplifying code

Post by mvanthoor »

Sven wrote: Sat Nov 07, 2020 5: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.
Author of Rustic, an engine written in Rust.
Releases | Code | Docs | Progress | CCRL
User avatar
hgm
Posts: 27788
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Simplifying code

Post by hgm »

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.
User avatar
hgm
Posts: 27788
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Simplifying code

Post by hgm »

Henk wrote: Sat Nov 07, 2020 5: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.
Daniel Anulliero
Posts: 759
Joined: Fri Jan 04, 2013 4:55 pm
Location: Nice

Re: Simplifying code

Post by Daniel Anulliero »

hgm wrote: Sun Nov 08, 2020 9:52 am
Henk wrote: Sat Nov 07, 2020 5: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 😉
Isa download :
Henk
Posts: 7216
Joined: Mon May 27, 2013 10:31 am

Re: Simplifying code

Post by Henk »

Daniel Anulliero wrote: Sun Nov 08, 2020 10:00 am
hgm wrote: Sun Nov 08, 2020 9:52 am
Henk wrote: Sat Nov 07, 2020 5: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: 7216
Joined: Mon May 27, 2013 10:31 am

Re: Simplifying code

Post by Henk »

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.