Skip to content

Latest commit

 

History

History

client-sim

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Client Simulation

The scripts in this folder can be run to simulate a client.

NOTE: The success of a script depends on the game state. For example, an attempt to set ship positions when the game is in the "active" state will fail. The game state can be modified using the Admin HQ.

Usage

Run them using Node.js. A description of each script follows.

# install node modules if you haven't already done so
npm install

# execute the script
node $THE_SCRIPT

Connect Script

This will connect and receive a new player configuration.

Ship Positions

Runs the connect script, then attempts to lock ship positions.

NOTE: This will receive an error response if the game state is not set to "lobby" via Admin HQ.

Attack Script

Runs the ship positions script, then attempts to send an attack. Will only send an attack when match.ready=true. Run the wss.connect.js script in a second terminal if this condition is not met automatically. Once you see match.ready=true set the game to "active" using the Admin HQ.