TL;DR: Is there a framework method to validate specific action arguments like 'playToken(X, Y)'' and check for valid X and or Y values?
Long version:
Noob question again, bear with me. I was wondering if there's a granular way to check if a move is valid or not.
I'm aware that on the frontend side we have a method to check if an action is possible given the current state of the state machine and all the possible actions of a given state (ie see the code below)
But I was wondering if there's anything more specific. Let's suppose that in the game I'm coding there's an action called "playToken" that receives two arguments, X and Y, and there's a number of valid X and Y values given the current game state.
It's there any method provided by the framework to cover these?
I'm also aware that In the Reversi tutorial, there's an elaborated method (https://gist.github.com/leocaseiro/a8bc ... 5035937d15) that returns all posible moves and then on the frontend side some board squares are marked as "possibleMove" by adding a class attribute. Is this the recommended approach?
Thanks in advance
Long version:
Noob question again, bear with me. I was wondering if there's a granular way to check if a move is valid or not.
I'm aware that on the frontend side we have a method to check if an action is possible given the current state of the state machine and all the possible actions of a given state (ie see the code below)
Code: Select all
if (!this.checkAction('myActionName')) {
return;
}
It's there any method provided by the framework to cover these?
I'm also aware that In the Reversi tutorial, there's an elaborated method (https://gist.github.com/leocaseiro/a8bc ... 5035937d15) that returns all posible moves and then on the frontend side some board squares are marked as "possibleMove" by adding a class attribute. Is this the recommended approach?
Thanks in advance