P
P
Proger59132020-12-17 09:58:40
JavaScript
Proger5913, 2020-12-17 09:58:40

Who can make a move with JS?

There is a browser toy, you need to make a move there using JS, I've been trying for a month now, my head hurts from this already.
Here is the game: https://start.heroeswm.ru/demobattle.php
Just use JS to click on any cell to make it move. Is that possible?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Victor P., 2020-12-17
@Jeer

Hello,
As far as I can see, canvas is used here, so it won't work in a simple way (select the html element and execute the click () function).
There are two options here - the first is to poke around in the available js code, understand the models, data formats, how the game is stored, figure out which functions are responsible for what and which parameters are passed. The process is very time-consuming and exciting, but only after that it will be possible to write your own logic using their native functions. I doubt that anyone on the toaster will do this.
The second option is to google emulator programs through which bots are created without having access to the code at all. I'm not great at this, but they definitely exist in large numbers. Through such programs, automated testing of software is done, for example, and bots, including

A
Alexander, 2020-12-17
@Aleksandr-JS-Developer

It is possible, of course - nothing is impossible.
There must be some kind of click handler inside the game .
This handler, when clicked, calculates which cell was clicked on and calls a special function, passing parameters to it. Among which there are coordinates/index/cell number.
You need to access this function and call it with the coordinates of the desired point .
As written above, you have to dig into the code. But, it seems to me that this is better than, in an already incomprehensible situation, to connect and configure an unfamiliar technology . Plus, you can add comments to the code to make it easier to maintain/debug later.
If you are completely immortal, then you can refactor the code completely ...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question