December 4, 2015

Computer Go Game


This post is to gather some information on Go game (wikipedia) for myself and anyone who is interested in Go (Baduk) game.

Go game is a serious challenge for computer scientists as traditional algorithms will not work well for it.  It's because Go has very little rules but vast amount of possible games.  Brute force just will not work.  -- Chess has 10^120 possible games, Go has 10^761.  See above Wikipedia page.

Computer already has won human in Chess in 1997, but not yet for Go (as of Dec 2015).  Google and Facebook are working on this problem and Google's researcher Demis Hassabis hinted that his AI might win. (See [1], [2], [3], [4])

There has been a lot of effort in developing algorithms to play Go better than human, and there are many great Go game programs already that can beat amateur players.  I've been looking into this on and off for a while, and I know it's not a trivial problem.  But just trying and learn it, or just playing Go itself is fun.  I've gathered some information and put on this page for myself and for others who might be interested.

Try It Online

If you are completely new to this game, here is my suggestion:
  1. Read about it -- simple explanation here, more detailed information on Wikipedia.
  2. Learn it online.
  3. Practice playing against computer. (Requires Flash)
  4. Play against other people online. (Registration is not required)

Play Offline On Your Computer

If you want to play offline against computer, GNU Go is pretty good program.  Just like GNU Chess, GNU GO itself is a text based program, using GTP (Go Text Protocol). You will need GUI application to have nice user interface.

For Windows: get this GNU go binary, and GUI (Drago).  I tried a couple of other GUI, and I like this one best.  There are many GUI for Linux, and probably you can get both using package manager.  For OSX, I haven't tried yet -- I'll update it here when I actually try.

There are many Go programs for smart phones -- iOS, Android, and Windows Phone.  It's fun to play it while commuting on public transit.  See bottom of this posting for suggested S/W or you can just search app market for your device.

Go Algorithms

There are many books, web sites and YouTube videos for learning the game play and strategies.  I'm  interested in how Go algorithms are implemented.  There are also a lot of articles on algorithms, game engines, and source codes on the web -- see the links below.

Here is Wikipedia page on computer Go.  It has a wealth of information on algorithms and link to some programs.  These days, almost all late Go programs use Monte Carlo algorithm. (see Monte Carlo method, and this news article.  See also GNU Go's option.)  A recent computer Go winner developer interviewed and commented that Monte Carlo has improved Go AI significantly but unless someone come up with new algorithm, it'd not possible to level up its AI any further.  (May be Demis Hassabis found a breakthrough algorithm.)

To learn more about the algorithms, visit these pages after reading the Wikipedia page:

SGF, UGF

There are records of Go game plays that you can re-play to learn or may be even train your AI.  SGF (Smart Game Format) is one format for this. (See also Wikipedia page

There is another format called UGF but SGF seems to be more popular.

Current Computer Go Level

GNU Go or any other programs using GTP would be easier to develop your own algorithm and play against them.  But if you want really strong programs, check below.


[Disclaimer: I am not affiliated with any of the software companies nor I ever purchased/used any of them.]


. . . .


This should be a good starting point to get into Go game and learning the algorithms.  I'm really excited about what Demis Hassabis will announce.



November 26, 2015

Windows PATH too long


Windows has this PATH environment variable length limit.  Having many applications, SDKs will fill up to the limit very quickly.  I was hoping that Windows 10 would fix this, but seems like it's still there.

One workaround is to use short name for directories.  For example, "C:\Program Files" can be "C:\Progra~1", and "C:\Program Files (x86)" can be "C:\Progra~1".  You can get the short name by issuing DOS command "dir /x".

Another difficulty is that it is not easy to edit the variable -- the dialog box's text field is way too small:

I've been using this utility called "Path Editor" and found it extremely useful:



Use this utility with DOS command "dir /x" to change the path with short names will reduce the PATH variable length.


November 24, 2015

Run Ubuntu without GUI

Edit grub file:
$ sudo vi /etc/default/grub

change this line:
GRUB_CMDLINE_LINUX_DEFAULT=

Values:
for GUI, GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
for Text mode, GRUB_CMDLINE_LINUX_DEFAULT="text"

Then run
$ sudo update-grub


And restart the machine.


September 11, 2015

Fiddle with Firebug

For light javascript programming/testing, JSFiddle is a good online tool.  It can be used with firebug also.
  1. Go to http://jsfiddle.com
  2. Add "https://getfirebug.com/firebug-lite-debug.js" to External Resources
 Or, use this link -- FireBug is already added, http://jsfiddle.net/keithkim/m0e8515u/

January 10, 2015

Kibana, ElasticSearch, logstash issue

*** UPDATE-Jan 23, 2018 *** THIS INFO IS OUTDATED.
Please see the version info, date and links on any of my posting.  If it's too old, don't follow the direction.



Kibana is ElasticSearch's logs and time-stamped data visualization tool.

For development environment, I have installed XAMPP on Win7.  I tried Kibana 3.1.2 uner XAMPP's Apache, but somehow it didn't work -- just a blank page.  I switched to Kibana 4 beta 3 (standalone).

Environment: Win7 64bit, Java 1.8.0_25-b18 64bit, ElasticSearch 1.4.2, Kibana 4 beta 3, logstash 1.4.2.

Installing Kibana 4 beta 3 is straight forward, just uncompress it and run .bat file.  But Kibana shows this error message (http://localhost:5601) - Kibana: This version of Kibana requires Elasticsearch 1.4.0 or higher on all nodes. I found the following incompatible nodes in your cluster :


After some googling, found this:
https://github.com/elasticsearch/kibana/issues/1629

In summary:
You have a logstash that uses ES version 1.1.1, and it reports as a node via node status of ES API, and therefore Kibana gives this error message.

Check your nodes, http://localhost:9200/_nodes -- it'll show logstash and ES version 1.1.1.

Shut down the node (using ES Head plugin, or issue this command), and refresh Kibana page.  It doesn't give the error message any more:






To use logstash, get ES (1.4 or later) jar file, and replace it in logstash -- Sidr found this workaround:
  1. Stop logstash.
  2. Get ElasticSearch zip, http://www.elasticsearch.org/overview/elkdownloads/
  3. Uncompress it and put it in <logstash home>\vendor\jar\ directory.
  4. Remove elasticsearch-1.1.1 directory from logstash.  
  5. Start logstash.
 After step #3, it should look like this:


And Kibana can be configured as a Windows service using nssm:



Now all seems to be good:



January 9, 2015

logstash on Windows

*** UPDATE-Jan 23, 2018 *** THIS INFO IS OUTDATED.
Please see the version info, date and links on any of my posting.  If it's too old, don't follow the direction. Note however, that http://nssm.cc/ is still good utility to use.



It's easier for me to use Linux for development, but often times I find myself in the situation to run popular tools on Windows.

logstash is a popular tool for logs and event managing. 


To install logstash on Windows, modify and save this configuration file.  Below is just an example to be used with a local elasticsearch.  Make sure it's in ANSI encoding, not UTF-8.  I saved it as C:\opt\logstash-1.4.2\logstash.conf  Please note that below configuration is just an example.  Please read logstash documents:


input { stdin { } }
output {
  elasticsearch { host => localhost }
  stdout { codec => rubydebug }
} 

For Windows event logs, use this:

input {
  eventlog {
    type => 'Win32-EventLog'
    logfile => 'System'
  }
}

Run it:

C:\> cd \opt\logstash-1.4.2\
C:\opt\logstash-1.4.2>bin\logstash.bat agent -f logstash.conf

To make this as a Windows service, there are some utilities, mainly I found these are the easiest to use:
I like nssm's approach is more Windows-like and simpler.  See NSSM usage page: http://nssm.cc/usage  Run it by issuing this command: nssm install
GUI window will appear, and configure it as following:


 

Just configure Application and Environment tabs.  Check services:








 

IE11 and JSON page (e.g. ElasticSearch)


I'm more familar with Linux with FireFox, but trying to use more of Windows and its native programs, such as IE.  I also use three different browsers at the same time -- FF(FireFox), IE, Opera, for example, for testing and other reasons.

When I tried open ElasticSearch page (http://localhost:9200) using IE11, I was surprised to find that IE tries to download JSON, instead of showing it like FireFox. 

Example:


Environment: Win7 64-bit.


Tried to view http://localhost:9200 on IE11 and got this:

Three solutions to this:
  1. Use JSON viewer, http://jsonviewer.codeplex.com/
  2. Registry change, http://www.codeproject.com/Tips/216175/View-JSON-in-Internet-Explorer
  3. Just click "Open", and select a text editor.  And next time, it'll open it with the editor instead.
I went with #3 solution - it's the simplest, and I don't like changing registry.  #1 is nice, but don't need it for now.