Saturday 27 May 2017

Accessing and communicating with javascript programm with node.js

I've been working on a Connect Four AI for a Raspberry Pi robot project and so far everything seems to be working. The programm creates a "Game" object that contains all the relevant functions like "placeCoin" or "aiMove" etc.

I now however face the problem of how to access this programm from "outside". I would like it to work on a Raspberry Pi with a Linux OS installed. For this purpose I have set it up for node.js. Using the Windows command prompt, I can execute the entire program with "node connect-four.js".

This is not what I need though. For my purposes, I need to start the programm by creating the "Game" object and then keep it "open" so to speak. I then want to be able to externally call the needed functions within my programm like "aimove" and then receive a returned value to further communicate with the actual robot. During this time, I would like the programm to wait.

How would I go about setting up this kind of communication?

Thanks in advance for your help!



via Kaza123

No comments:

Post a Comment