CATInterpreter class
This class is a Dart interpreter for the CAT language.
Constructors
- CATInterpreter(String json, Shape shape)
- It takes a JSON string and converts it into a Dart object.
- CATInterpreter.fromSchemes(Schemes schemes, Shape shape)
-
A constructor that takes a
Schemes
object and assigns it to theschemes
variable.
Properties
- board → Coloring
-
A getter for the board.
read-only
- getResults → Results
-
A getter for the results of the command execution.
read-only
- hashCode → int
-
The hash code for this object.
read-onlyinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-onlyinherited
- schemes ↔ Schemes
-
A getter for the loaded schemes.
latefinal
- shape ↔ Shape
-
Creating a class called Shape with a variable called shape.
read / write
Methods
-
copyCells(
List< String> origin, List<String> destination) → void -
It takes a list of origin cells and a list of destination cells,
the color of the origin cells is copied to the destination cells.
Args:
origin (List
): Origin cells from where to copy the colors destinations (List ): Destination cells -
fillEmpty(
List< String> colors) → void -
If the first element of the list is a valid color, then call the
color
function of thecommandCaller
object with thefillEmpty
command and the index of the color. -
go(
String move, int repetitions) → void -
goCell(
String cell) → void -
mirrorBoard(
String direction) → void - It calls the mirrorHorizontal or mirrorVertical function in the Dart code, depending on the value of the direction parameter
-
mirrorCells(
List< String> cells, String direction) → void - It takes a list of cells and a direction, and then it moves to each cell and calls the appropriate mirror function
-
mirrorCommands(
List< String> commands, String direction) → void - It creates a new command caller, copies the board from the old command caller, parses the commands, mirrors the board, and then joins the crosses from the new board to the old board.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
paintMultileCells(
List< String> colors, List<String> cellsPositions) → void -
paintPattern(
List< String> colors, String repetitions, String pattern) → void -
paintSingleCell(
String color) → void -
repeatCommands(
List< String> commands, List<String> positions) → void -
It takes a list of commands and a list of positions where to copy the
commands.
Args:
commands (List
): The commands to execute positions (List ): The positions where tto repeat the commands -
reset(
) → void -
reset()
is a function that resets the_results
variable to a new instance of theResults
class and resets thecommandCaller
variable to a new instance of theCommandCaller
class -
toString(
) → String -
A string representation of this object.
inherited
-
validateOnScheme(
String code, int schemeIndex) → Pair< Results, CatError> - It takes a string of code, parses it, and then checks if the code is valid
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited