Let's Make Robots!

MyRobotLab Plays Chess with Patrick?

Hi,

This is a blog post for PM and anyone else interested.  I have been doing many updates to mrl, and have begun working on some tutorial videos.  Patrick Mccabe and I spoke a couple times regarding hooking up his great chess robot to mrl for a game engine.  

Well, he beat me to it and found one to interface with Apple Script - but I still thought it would be fun to try.  It did not take me more than 30 mins to find, download, and wrap a chess game engine and gui with mrl.

Once the chessgame is a Service it can be loaded through the gui and integrated with other services.  In the video I show how to start it up and have it send a command string to the serial port and gui/logger.

The mrl GUI can be put into an applet so it can be played over the inter tubes too..

GroG

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Do you know if it was a single move?

No I do not

I'd probably pump the makeMove messages to a logger then go through a game which the engine does a castle. I'd think you could tell then...  I can't update at the moment... since I've taken a massive update from OpenCV & JavaCV (moved from 2.1 to 2.2 ... added 64 bit stuff - my Eclipse editor is blinking errors like a Christmas tree)

You could check out and see if you wanted to tweak anything....

I think this is something I can take care of on the arduino side. Simply if it is the first reference to the E8 in the game then it must be moving the king, and if it is moving the king more than 1 square then it is castling and I can figure out how to make the move form there. Becuase from what I could tell, it was a single move.

Great, sounds like a good plan Patrick...

In the interim, since you are mrl's second most experienced user .... what would be the best improvement for it? Or what is the most aggravating thing?

Like I said, I do not know how the code works but it sure would be nice to be able to save configurations... Might be asking too much. Besides that, I can set it up pretty quickly.

How about this?

 
  private String cleanMove(String t)
  {
    LOG.info("cleanMove " + t);
 
    // remove piece descriptor
    if (t.length() 5)
    {
      char check = t.charAt(t.length()-1);
      if (Character.isDigit(check))
      {
        t = t.substring(1);
      else {
        t = t.substring(0, t.length()-2);
      }
    }

    // remove -
    if (t.contains("-"))
    {
      t = (t.substring(0,2+ t.substring(3));
    }
    
    t = t.toLowerCase()
        
    LOG.info("cleanedMove " + t);
    return t;
  }
    

It must be creating some weird index for something in check, I think.....

Need more info...

you can either load it up in eclipse and step through the debugger....

Or you can connect both makeMove and inputMove to the Logger

Or you can send me the log.txt (I think it has debug logging info.. don't remember at the moment...)

Stopped working... Not check mate either

 

Exception in thread "Thread-30" java.lang.ArrayIndexOutOfBoundsException: 6

at org.myrobotlab.chess.Board.attack(Unknown Source)

at org.myrobotlab.chess.Board.inCheck(Unknown Source)

at org.myrobotlab.chess.Board.makeMove(Unknown Source)

at org.myrobotlab.control.ChessGameGUI$Thinker.run(Unknown Source)

Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 6

at org.myrobotlab.chess.Board.gen(Unknown Source)

at org.myrobotlab.control.ChessGameGUI.youGotToMoveItMoveIt(Unknown Source)

at org.myrobotlab.control.ChessGameGUI.vetoableChange(Unknown Source)

at java.beans.VetoableChangeSupport.fireVetoableChange(VetoableChangeSupport.java:335)

at java.beans.VetoableChangeSupport.fireVetoableChange(VetoableChangeSupport.java:252)

at javax.swing.JComponent.fireVetoableChange(JComponent.java:4483)

at org.op.chess.ChessBoard.selected(ChessBoard.java:210)

at org.op.chess.Square$SquareMouseListener.mouseClicked(Square.java:68)

at java.awt.Component.processMouseEvent(Component.java:6377)

at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)

at java.awt.Component.processEvent(Component.java:6139)

at java.awt.Container.processEvent(Container.java:2085)

at java.awt.Component.dispatchEventImpl(Component.java:4736)

at java.awt.Container.dispatchEventImpl(Container.java:2143)

at java.awt.Component.dispatchEvent(Component.java:4566)

at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4621)

at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4291)

at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4212)

at java.awt.Container.dispatchEventImpl(Container.java:2129)

at java.awt.Window.dispatchEventImpl(Window.java:2478)

at java.awt.Component.dispatchEvent(Component.java:4566)

at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:680)

at java.awt.EventQueue.access$000(EventQueue.java:86)

at java.awt.EventQueue$1.run(EventQueue.java:639)

at java.awt.EventQueue$1.run(EventQueue.java:637)

at java.security.AccessController.doPrivileged(Native Method)

at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)

at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)

at java.awt.EventQueue$2.run(EventQueue.java:653)

at java.awt.EventQueue$2.run(EventQueue.java:651)

at java.security.AccessController.doPrivileged(Native Method)

at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)

at java.awt.EventQueue.dispatchEvent(EventQueue.java:650)

at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)

at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)

at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)

at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)

at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)

at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

java.lang.InterruptedException

at java.lang.Object.wait(Native Method)

at java.lang.Object.wait(Object.java:485)

at org.myrobotlab.framework.Inbox.getMsg(Unknown Source)

at org.myrobotlab.framework.Service.getMsg(Unknown Source)

at org.myrobotlab.service.Logging.run(Unknown Source)

at java.lang.Thread.run(Thread.java:680)

java.lang.InterruptedException

at java.lang.Object.wait(Native Method)

at java.lang.Object.wait(Object.java:485)

at org.myrobotlab.framework.Inbox.getMsg(Unknown Source)

at org.myrobotlab.framework.Service.getMsg(Unknown Source)

at org.myrobotlab.service.GUIService.run(Unknown Source)

at java.lang.Thread.run(Thread.java:680)