A colorful tale

Discussion of chess software programming and technical issues.

Moderators: hgm, Harvey Williamson, bob

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
User avatar
sje
Posts: 4675
Joined: Mon Mar 13, 2006 6:43 pm

A colorful tale

Post by sje » Tue May 19, 2015 8:14 am

Symbolic has always had a logging facility. I have recently modified the log file output to include ANSI color escape sequences.

Black: timestamps and directional indicators
Red: Standard input
Green: Standard output
Blue: Log output

See: https://dl.dropboxusercontent.com/u/31633927/logfile

You have to download the file; viewing it in your browser will likely strip the color.

Get the file, and then from your Unix terminal emulator program enter:

Code: Select all

more -R logfile

bob
Posts: 20342
Joined: Mon Feb 27, 2006 6:30 pm
Location: Birmingham, AL

Re: A colorful tale

Post by bob » Tue May 19, 2015 5:45 pm

sje wrote:Symbolic has always had a logging facility. I have recently modified the log file output to include ANSI color escape sequences.

Black: timestamps and directional indicators
Red: Standard input
Green: Standard output
Blue: Log output

See: https://dl.dropboxusercontent.com/u/31633927/logfile

You have to download the file; viewing it in your browser will likely strip the color.

Get the file, and then from your Unix terminal emulator program enter:

Code: Select all

more -R logfile
I did this a long time ago. And even used reverse video and such in the console window so I would be able to quickly pick out Crafty's move choice from all the other stuff displayed. But there is a major flaw. Not all systems will display it correctly. Ssh in through multiple hosts, and some will just display the "garbage characters" as they see them which makes everything hard to see. I added a command to make this colorization and such controllable, which helped. Then when it wasn't working right, I could disable it.

User avatar
sje
Posts: 4675
Joined: Mon Mar 13, 2006 6:43 pm

Re: A colorful tale

Post by sje » Tue May 19, 2015 9:14 pm

bob wrote:I did this a long time ago. And even used reverse video and such in the console window so I would be able to quickly pick out Crafty's move choice from all the other stuff displayed. But there is a major flaw. Not all systems will display it correctly. Ssh in through multiple hosts, and some will just display the "garbage characters" as they see them which makes everything hard to see. I added a command to make this colorization and such controllable, which helped. Then when it wasn't working right, I could disable it.
Symbolic does have a run time switch selecting mono vs color board display. Mono display is useful only when doing copy-n-paste from a terminal window into a text editor as character attributes are generally not copied.

Oscar uses ANSI sequences for both color and cursor control when the program generates an ASCII movie file.

I can't say much about recent developments in non-Unix platforms, but I have done what I could to make sure that Symbolic uses only true ANSI standard escape sequences for the best hope of portability.

I'm not much interested in making a Windows version; my only Windows machine is a cheap HP notebook which lost booting ability about a month after its one year warranty expired. This is a bit of a pain because I needed that notebook for helping to test my DGT piece recognition board.

User avatar
sje
Posts: 4675
Joined: Mon Mar 13, 2006 6:43 pm

Re: A colorful tale

Post by sje » Tue May 19, 2015 9:29 pm

I forgot to mention that for handling ANSI color escape sequences

Code: Select all

more -R logfile
might not work on Linux although it does work on OpenBSD (Mac OS/X). On Linux, just use:

Code: Select all

more logfile
If you don't need pagination, then

Code: Select all

cat logfile
works on both Linux and OpenBSD.

flok

Re: A colorful tale

Post by flok » Wed May 20, 2015 12:09 pm

What I always do:
- have an IO base class
- then for xboard, uci, test, console, console_ansi I have subclasses
- the user can then select the io-mode
That way I can very easily colorify or use xboard mode or whatever without changing zilions of lines all throughout the sourcecode.

Vinvin
Posts: 4024
Joined: Thu Mar 09, 2006 8:40 am

Re: A colorful tale

Post by Vinvin » Wed May 20, 2015 12:46 pm

sje wrote:You have to download the file; viewing it in your browser will likely strip the color.[/code]
Try HTML, it's more standard now ;-)

<font color="red">This is some text!</font>

http://www.w3schools.com/tags/att_font_color.asp

flok

Re: A colorful tale

Post by flok » Wed May 20, 2015 1:43 pm

Vinvin wrote:
sje wrote:You have to download the file; viewing it in your browser will likely strip the color.[/code]
Try HTML, it's more standard now ;-)

<font color="red">This is some text!</font>

http://www.w3schools.com/tags/att_font_color.asp
Well, yeah, well that way is a bit deprecated.
You should use <div> etc and css-files that select the right color etc

AlvaroBegue
Posts: 884
Joined: Tue Mar 09, 2010 2:46 pm
Location: New York

Re: A colorful tale

Post by AlvaroBegue » Wed May 20, 2015 1:46 pm

sje wrote:I forgot to mention that for handling ANSI color escape sequences

Code: Select all

more -R logfile
might not work on Linux although it does work on OpenBSD (Mac OS/X). On Linux, just use:

Code: Select all

more logfile
What I use is

Code: Select all

less -Sr logfile

bob
Posts: 20342
Joined: Mon Feb 27, 2006 6:30 pm
Location: Birmingham, AL

Re: A colorful tale

Post by bob » Wed May 20, 2015 6:17 pm

sje wrote:
bob wrote:I did this a long time ago. And even used reverse video and such in the console window so I would be able to quickly pick out Crafty's move choice from all the other stuff displayed. But there is a major flaw. Not all systems will display it correctly. Ssh in through multiple hosts, and some will just display the "garbage characters" as they see them which makes everything hard to see. I added a command to make this colorization and such controllable, which helped. Then when it wasn't working right, I could disable it.
Symbolic does have a run time switch selecting mono vs color board display. Mono display is useful only when doing copy-n-paste from a terminal window into a text editor as character attributes are generally not copied.

Oscar uses ANSI sequences for both color and cursor control when the program generates an ASCII movie file.

I can't say much about recent developments in non-Unix platforms, but I have done what I could to make sure that Symbolic uses only true ANSI standard escape sequences for the best hope of portability.

I'm not much interested in making a Windows version; my only Windows machine is a cheap HP notebook which lost booting ability about a month after its one year warranty expired. This is a bit of a pain because I needed that notebook for helping to test my DGT piece recognition board.
I wrote a simple DGT driver for my linux box, but I have not used the DGT board in several years now, so I have not kept it current. Main problem today is that not many machines come with a serial port any longer. Sort of dark ages computing.

User avatar
mhull
Posts: 11276
Joined: Wed Mar 08, 2006 8:02 pm
Location: Dallas, Texas
Full name: Matthew Hull

Re: A colorful tale

Post by mhull » Wed May 20, 2015 6:58 pm

AlvaroBegue wrote:What I use is

Code: Select all

less -Sr logfile
Because less is more. ;)
Matthew Hull

Post Reply