A colorful tale

Discussion of chess software programming and technical issues.

Moderator: Ras

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

A colorful tale

Post by sje »

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: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: A colorful tale

Post by bob »

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 7:43 pm

Re: A colorful tale

Post by sje »

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 7:43 pm

Re: A colorful tale

Post by sje »

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 »

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: 5320
Joined: Thu Mar 09, 2006 9:40 am
Full name: Vincent Lejeune

Re: A colorful tale

Post by Vinvin »

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 »

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: 932
Joined: Tue Mar 09, 2010 3:46 pm
Location: New York
Full name: Álvaro Begué (RuyDos)

Re: A colorful tale

Post by AlvaroBegue »

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: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: A colorful tale

Post by bob »

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: 13447
Joined: Wed Mar 08, 2006 9:02 pm
Location: Dallas, Texas
Full name: Matthew Hull

Re: A colorful tale

Post by mhull »

AlvaroBegue wrote:What I use is

Code: Select all

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