Class: Challenge

Challenge(I_Oopt, MinInputopt, MaxInputopt)

An abstract Class representing the base challenge that allow us create uniformed challenges

Constructor

new Challenge(I_Oopt, MinInputopt, MaxInputopt)

Create a challenge that randomly create a number of inputs with size between [MinInput,MaxInput] if you don't provide a set of inputs before. and then create the output corresponded to the input generated or set.
Parameters:
Name Type Attributes Default Description
I_O I_O <optional>
{} the inputs and the output of the challenge to be set if its already generated.
MinInput Number <optional>
100 minimum number of inputs to generate.
MaxInput Number <optional>
150 maximum number of inputs to generate.
Properties:
Name Type Attributes Default Description
_InputGenerated Boolean <optional>
false check if the input has been assigned
_OutputGenerated Boolean <optional>
false check if the output has been assigned
_Inputs Array.<any> <optional>
[] the input of the challenge
_Output NS <optional>
0 the output of the challenge
Source:

Methods

CheckOutput(answer) → {Result}

this method checks if the answer given is the correct one
Parameters:
Name Type Description
answer NS the answer of the challenger
Source:
Returns:
the message and the result of the answer
Type
Result

(abstract) GetInputs() → {String}

an abstract method to remake when extended made for Generating text version of the inputs for the challenges
Source:
Throws:
throws an error if this method not re-implemented after extending.
Type
NotImplemented
Returns:
the inputs in a string form to be sent to the challenger.
Type
String

(abstract) InputsGenerator(InputNum) → {void}

abstract method to remake when extended made for Generating Inputs for the challenges
Parameters:
Name Type Description
InputNum Number Number of inputs to generate
Source:
Throws:
throws an error if this method not re-implemented after extending.
Type
NotImplemented
Returns:
Type
void

(abstract) OutputGenerator() → {void}

an abstract method to remake when extended made for Generating an Output for the challenges
Source:
Throws:
throws an error if this method not re-implemented after extending.
Type
NotImplemented
Returns:
Type
void

Random(minmax, maxopt) → {Number}

Random : Creates a random number in [min,max] range
Parameters:
Name Type Attributes Description
minmax Number the minimum of the Random number if max exist else its the maximum and the min became 0
max Number <optional>
the maximum of the Random number
Source:
Returns:
a Random integer number between [min,max]
Type
Number