Giter Site home page Giter Site logo

leelawatcher's People

Contributors

barrybecker4 avatar felixbrendel avatar fsparv avatar ihavnoid avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

leelawatcher's Issues

Occasional Swing Exceptions

Though I didn't capture one at the time, a couple times I saw swing exceptions (usually relating to the scroll pane) probably caused by my modifications of the UI from a non-swing thread.

Allow "resign" move

From what I can see, leela-zero could always output "resign" as a move. But looking at Pattern MOVE, that was never understood as a legal move by LeelaWatcher.
Probably, the earlier networks were not prone to resigning, but now they are, which leads to:

255 (resign) Move:resign
oh noes!!!
java.lang.RuntimeException: BAD MOVE: resign
at leelawatcher.parser.AutoGtpOutputParser.parseMove(AutoGtpOutputParser.java:129)
at leelawatcher.parser.AutoGtpOutputParser.lambda$start$0(AutoGtpOutputParser.java:90)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

LeelaWatcher reports illegal moves on legal ones (reason for #9 pinpointed, and is unrelated to fixes suggested)

It seems there are still holes in game logic. I think the problems reported in #4 and #9 were closed too soon (assuming because of the fix suggested in #5 and thus writing this here again) as I have managed to pinpoint the source of #9:

LeelaWatcher doesn't even get to capture logic in the problem mentioned there, which is why the fix won't affect it.

The problem is that isLegalMove() returns false on moves which are legal in all rule systems, before any such logic is reached.

Example cases found:
(To stick to the issue and not get sidetracked, I have constrained myself to look ONLY at the first occurrence of the problem encountered in a game, as further strange artifacts encountered with illegal moves could be an entirely different issue)

example 1:
WatcherOutput1.zip
2nd-262-2017-11-29T13_59_20.908Z.sgf.zip

Move 261 is Black's A10. The next move received, as is seen in WatcherOutput1, is white's S12, which is, while a horrible move, legal in any rule system.

example2:
WatcherOutput2.zip
1st-419-2017-11-29T13_54_19.179Z.sgf.zip

Move 418 is white's Q16, and the next move received is black's m1, which isLegalMove() says is illegal, and therefore is skipped, despite it being a perfectly legal move.

I do realize the very next move placed by LeelaWatcher in the SGF betrays another potential bug, but it's not healthy to consider multiple issues in 1 place...

Not only does the code never get to capture logic at all, but, as example 1 shows, it sometimes isn't even related to it. I will try to pinpoint it further by testing those exact positions on the legality functions when I have the time.

Dissapearing SGF files

Recently I ran into a case where I only seemed to be able to create one SGF file at a time. Multiple processes appeared to overwrite the same file with a new name. This of course is impossible and much head scratching ensued. Eventually I realized that autogtp is gratuitously doing the equivalent of rm -f *.sgf after it sends every file to clear out the file it creates for sending to the server, which also clears out the files previously written by LeelaWatcher. So in case others stumble onto the same perplexing situation I'll document here that the "fix" is to not run LeelaWatcher from the autogtp directory.

run with autogtp 11?

I can run autogtp 11 with leelawatcher, but the moves don't show, same as #19

BTW this works: C:\Users...\Downloads\LeelaZero>java -jar ../LeelaWatcher-1.0.2.jar . autogtp.exe , but somehow this fails, why?

C:\Users...\Downloads>java -jar LeelaWatcher-1.0.2.jar C:\Users...\Downl
oads\leelazero autogtp.exe

java.io.IOException: Cannot run program "autogtp.exe" (in directory "C:\Users...\Downloads\leelazero"): CreateProcess error=2, The system cannot find the fi
le specified
at java.lang.ProcessBuilder.start(Unknown Source)
at leelawatcher.gui.LeelaWatcher.lambda$main$1(LeelaWatcher.java:70)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$500(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionP
rivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find th
e file specified
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.(Unknown Source)
at java.lang.ProcessImpl.start(Unknown Source)
... 16 more

support for the next branch?

Although LeelaWatcher can run with autogtp_next, no stones are displayed on the board as moves are generated.

Refactor Move into subclasses

There is a comment in the Move class that reads:

This class is due for a refactoring, it does too much. It * should be divided into a MoveNode, a SetupNode and a RootNode which inherit * from an AbstractNode. This will also bring the object model in closer * correspondence with the structure of an SGF file.

There will also be a need to write a GameInfo class and provide a place

  • to attach it to the first distinguishing move in a tree of games beginning
  • with the move sequence. This will not be necessary until either loading of
  • ANY SGF file is supported, or the creation of multi-game trees is supported.

close the gui, the leelaz still run in background

I run the program with following command
D:\leelaz5>type run.bat
@echo off
autogtp -k sga
D:\leelaz5>start javaw -jar LeelaWatcher-1.0.jar . run.bat
or
D:\leelaz5>javaw -jar LeelaWatcher-1.0.jar . run.bat

If I close the gui by click the [x] button, then the leelaz still run in background, I have to finish the process with taskmgr

LeelaWatcher not showing moves when used with leela-zero v 0.17

I can see games when running

java -jar LeelaWatcher-1.1.0.jar . autogtp.exe

with version 0.16 of leela-zero, but it does not work when using 0.17 of leela-zero.
It's possible that the format of the moves has changed again. I recall a similar problem with an earlier release.

simplify SGFFileFilter

9 lines can be replaced with 1 using toUppercase instead of all the permutations. I'll make a PR.

Games shown by LeelaWatcher aren't correct!

I found a surprisingly commonly occurring problem when using LeelaWatcher.
Many moves that the watcher correctly read from autogtp/Leela zero (and shown it read them) are completely skipped in the SGF, creating a completely false representation of the game.

An example:

Here's the SGF Leela was showing and writing during play:
http://eidogo.com/#1cWKYlvGj

Suspicious-game-2017-11-27T20_58_38.724Z.sgf.zip

Here's the program's output:
Suspicious game.zip

Initially I thought it was a problem with legal/Illegal moves, as near the end of the game MANY illegal moves were skipped; However, going over the game from move 1, the first omission, on move 326 in the program's output, shows a completely legal move (actually 4 in a row) not being added to the SGF.

Looking ahead, it seems it happened dozens of times during the game, often with an odd number of moves, so eventually a black move was placed as a white move etc.
This turned more of the moves later in the game to illegal ones.

Stones that were captured by white in the actual moves Leela was giving were connected by black in this
sgf/LeelaWatcher view, and later Leela tried to play in the open spaces created where the captured stones were, which was, of course, illegal, etc.

The problem doesn't seem to be a rare one and I have noticed it in several games.

Unable to run

I cant find the .jar file and dont know what your talking about when you ask to change the binary file name to the one supplied. when i try to enter in the supplied command into my command line after changing to the proper directory it only tells me that the associated jar file cannot be run.

TL/DR: I need a "for dummies" explanation of how to get this to run properly on windows.

also, as a side note; a more user friendly version overall of this program may do wonders for getting people to contribute to the Leela Zero project. Perhaps a version that runs as a simple screen saver.

Go board logic bug

The UI suddenly stopped but the game kept going, later comparing the sgf with the stuck game I found out that something along the way had gone wrong because the game was never in a state the UI suggested. I attached them so you can debug what went wrong.

bugged replay and scrrenshot.zip

Some (probably low hanging fruits) improvements

These are just some features that would make watching a lot more enjoyable.
(In addition to board coordinates and last played indicators from #2)

  • Higher resolution go board image
  • Textures for the go stones
  • Have a title for the window
  • Display the seconds per game (the output of autogtp) in the Title
  • Option to play a small sound when a game finished (when I am
    working and have it in the background I will feel reminded that I am
    helping to train an amazing AI)
  • Option to not save sgfs

I will look through your code and try to make a PR, but I also wanted to write down the list first, so others can help as well.

What do you think?

Some deprecation warnings when building with gradlew

This is minor, but I noticed a couple of deprecation warnings when I built using "./gradlew build".

A problem was found with the configuration of task ':shadowJar'. Registering invalid inputs and outputs via TaskInputs and TaskOutputs methods has been deprecated and is scheduled to be removed in Gradle 5.0.
 - No value has been specified for property 'mainClassName'.
The SimpleWorkResult type has been deprecated and is scheduled to be removed in Gradle 5.0. Please use WorkResults.didWork() instead.
:startShadowScripts
Using TaskInputs.file() with something that doesn't resolve to a File object has been deprecated and is scheduled to be removed in Gradle 5.0. Use TaskInputs.files() instead.

Memory Leak

In other entirely NOT shocking news, the code I wrote 15 years ago when I was first learning java seems to have a memory leak...

 51 (A3) 	Move:A3
OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x000000079b500000, 572522496, 0) failed; error='Cannot allocate memory' (errno=12)
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 572522496 bytes for committing reserved memory.
# An error report file with more information is saved as:
# /home/gus/leelaz/leela-zero/hs_err_pid89296.log

save game to local error

error message is following.
Game data 28f32483346bf8881e99eebc9fdcf122a334486f5053dfdd3300521e7b98fa70 stored in database
3 game(s) played in 1127 minutes = 22552 seconds/game, last game took 53497 seconds.
Best network hash: 1ac2638de9d4d3f9eef43f2afb6b1b4c090a7c350fde4d2d77e00e39eba6fde0
Required client version: 2 (OK)
Already downloaded network.
Engine has started.
Infinite thinking time set.Couldn't save game:java.io.IOException: Incorrect filename, directory name, or volume。

1 (L9)
New Game Started!

    Move:L9

the sgf format is diff

the version 1.0.1 can automatic save sgf now.
but I found the format is diff that of leela zero.
for example here the pass step is wroted to W[ ],not W[tt]

remove unused code

There seems to be quite a bit of code that might have been added for some other project, but it not needed for LeelaWatcher. I plan to remove it to simplify what is there.

It would be nice to fix some of the warnings and add some tests as well.

Cleanup MarkablePosition and add tests

There are a few things about the MarkablePosition class that I think can be improved. Some are very minor.

  • I don't think there should be blank lines between methods and their javadoc
  • It's unclear to me why the private marks variable needs a leading _
  • There is some code duplication in the getGroupSet method that could be avoided.
  • Why does class javadoc have @Version $Revision$? It seems like git already has all the info you need about the version of a file.
  • Why are there revision logs at the bottom? I think they should be removed. Git takes care of history.
  • Can we remove the @SuppressWarnings("unused") annotation. It is used, and there is no warning when I remove it.
  • It would be nice to have unit tests for this class.

I'll make the changes in a PR and you can decide if you want to merge them.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.