A referee is a instance in sports game which evaluates the behavior of the players. The referee isn't part of the game but his task is to judge about how well the player performs in the game. A typical situation is, that the referee decides if the ball has entered the goal.
The limit of a referee is, that his role is static. A referee for soccer is judging with a different ruleset, than the referee for basketball. In one of the game it is allowed to touch the ball with the hand while in the other not. In a more flexible general game, the referee is allowed to modify the rules during the game. In such a hypothetical game the referee is allowed to change the game. He can advice the same players to behave like soccer players, basketball participent or any other sports game.
Such flexible role switch doesn't make sense for real sports game but it might be interesting in the robotics domain. The idea is, that a robot isn't playin a certain game, but the robot has to obey to the referee. And the referee can say that the ball should kicked in the left goal or into the right goal. And which action is correct doesn't depend on the game but on the decision of the referee.
In such a use case, the referee has much more power than in a normal sports game. So it is no longer a classical sports game with fixed rules, but it is some sort of training game in which the coach imagines the rules and the player has to fulfill them.
From a technical perspective such interaction can be modeled with a parametric cost map. The objective for the critic is to provide a cost map which can be adapted while the objective for the actor is to minimize the costs in that map. The natural commands formulated by the coach are translated into a grounded cost map and the cost map judges if the actions of the player are right or wrong. Such universal game is only limited by the ability to imagine a cost map. And the ability of the actor to parse the cost map.
The term actor critic was introduced already and it describes very well the division of tasks. One instance imagines what the cost map is, while the other instance has to provide concrete actions. It is important to know that both instances are needed so the artificial Intelligence can't be realized with a single module but at least two different modules are needed. The easier to realize module is for sure the actor instance. A computer program which gets a cost map as input is a normal numerical solver. The objective function is provided as input and the task is to search for a node in the game tree which minimizes the costs. A concrete algorithm would be a depth first search algorithm which is described in most entry level computer science text books.
The more complicated problem is located in the coach instance. The critic has to invent a cost function in a way, that a computer can understand it. For example a command like "kick the ball into a goal" is too vaque. The average computer doesn't know what kick, ball and goal is about. So a more precise constraints formulation is needed.
September 27, 2022
From a referee based evaluation to parametric cost maps
Programming in C# on a Linux desktop
September 20, 2022
How to solve AI problem with a computer?
September 18, 2022
Creating GUI apps in Linux
A common question for programmer newbies is to ask which of the existing GUI frameworks is the most widespread used, or the easiest one to learn. Other users may ask which programming language might fits well for writing large scale GUI apps. The surprising situation is, that none of the existing libraries like Qt, tkinter or WXwidget can be recommended and all the mainstream languages like Python, Java and C++ are an antipattern to develop a GUI app.
With this forward it might be interesting to know what the preferred choice is in writing a GUI app. The working hypothesis is, that not a certain programming language is important but a certain GUI builder software. A gui builder is a WYSIWYG program which allows to drag and drop a GUI interface similar to painting an image, and then the code is generated by the program.
Let us take a closer look what very different software tools like MS-Access, Borland C++ Builder, code:blocks and WXglade have in common. In all these environments, the user isn't asked to write a single line of code, but he has menu with widgets like a button, a textfield and a combo box and then the tool knows how to write the code.
The reason why a gui builder is not optional but mandatory is because a GUI framework like Qt or any other one is a large scale library which contains of thousands of classes. It is not possible to use a small gui library. Even so called lightweight GUI libraries like FLTK will occupy around 4 MB on the hard drive and provides endless amount of options and parameters. The only way to master all the widget is an extra tool which is not working with sourcecode but with a graphical interface.
Let us take a closer look into a smaller but very powerful GUI builder which is wxglade. The amount of features is very low. The user sees in the left pane the list of widget and is asked to drag and drop them into the right pane. The interesting situation is, that in setting menu for the entire application it is possible to specify a concrete programming language:
The menu looks not very impressive,, it is only a dialogue box with the option for C++, python, Perl and Lisp. The interesting situation is, that at least the wxglade software knows how to convert a GUI window into runnable sourcecode.
Let us investigate what will happen after activating the "C++" option. The wxglade software is producing the .cpp and the .h files. Also it is written in the preface in the comment section how to compile the .cpp code into a binary file. The user has to enter the command into the terminal and gets the application. A simple example Hello world windows contains of a text widget and a button occupies around 164 kb in total and can be executed with "./MyApp". It is a normal C++ program written by a machine.
After creating the code, the human programmer is asked to improve the generated code. He can add some events or program the database backend by itself. The interesting situation is, that such a workflow is much easier than writing the app from scratch. The assumption is, that 100% of the C++ GUI apps are written in this programming style. In all the cases, the beginning is always a GUI Builder which produces some code, and this code is improved more or less by a human programmer into an application.
This pipeline makes sense because a simple form which contains of only 3 buttons and some widgets will result into a long class which has 200 lines of code. It is not possible or very complicated to write the code by hand only with a printed manual. This is only possible if the programmer knows already what a concrete programming language and a concrete GUI framework has to offer.
Perhaps it should be mentioned, that all the generated code from Wxglade is using the Wxwidget. Somebody may argue that wxwidget is not the best framework and this assumption is correct. But, suppose a different gui builder will use a different framework, for example Qt. Then the pipeline is the same. At first the programmer starts a GUI builder, the code is generated by the software and then the programmer improves the code a bit or more. So we can say the focus is always on a gui builder which stands in the center and a concrete programming language or a concrete GUI library is less important.
In case of GUI programming the question is not if C++ or Python is the better choice. And the question is not if Wxwidget or Qt makes sense. But the more serious question is, if Visual studio, wxglade or Eclipse is a here to stay. GUIs are developed with a certain GUI builder, the gui builder defines how the sourcecode will look like.
There is some sort of TIOBE Index for gui builder tools. Popular tools are visual studio, eclipse and android studio These programs are not used because of syntax highlighting or other text editor capabilities but the dominant reason why programmers are using Visual studio is because of the GUI builder functionality. It allows them to draw an application similar to draw a picture with a graphics program.
GUI builders
The most interesting feature of a GUI Builder is, that it interprets the world from a certain perspective. There is no need to decide for or against a programming language. For a gui builder the difference between C++ and is low, even both languages are very different from each other. The reason is that a gui builder doesn't asks the user to type in sourcecode, but the user has drag & drop widgets and press the "generate" button.
The reason why most GUI apps are developed for Windows is because the visual studio software is a mature one which is over 20 years old and its core component is the mentioned gui builder. Alternative tools like wxglade have less features and are less well documented.
The interesting situation with visual studio is that the software can be used to create C++ and C# code as well. So the question is not which of the languages is the better one, but the GUI builder works fine with both.
Even if GUI builders are highly important in software development they are seldom discussed in the literature. The assumption in the past was that it depends on the individual choice of a programmer if and which gui builder he prefers. Also the tools are nearly invisible in the final sourcecode, because what is available as sourcecode is written in a certain programming like C++ or java. So the assumption was, to focus on the language or maybe on the GUI library but not on the tool which is responsible for the code.
[1] https://visualstudiomagazine.com/articles/2017/08/15/ide-ranking.aspx
C++ is a great programming language
Modern application development works with the attempt to create web applications and use prototyping techniques. Both is supported very well by the C++ programming language. C++ is a scripting language and it was designed for the Internet. C++ runs great in the browser as a GUI Frontend and on a webserver as a database backend.
But c++ has many other features which makes it unique from potential alternatives. C++ doesn't require the user of pointers which are known as a complicated programming tool which even aren't understood by experts. Also it doesn't have header files which are known as error prone in the C language.
IN the sum, C++ is the language of the future which is recommneded for most purposes. It is a beginner friendly prototyping language which fits very well to the needs of newbies.
September 06, 2022
Creating a minimal outliner in Linux
September 04, 2022
Review of the new Version of the Zim wiki
September 02, 2022
Writing GUI apps for Linux