public float[] GetState(int piece, int x, int rot) { float[] states = new float[4]; // get the position of each square when rotated at x position V2Int[] p0Positions = tetrominoes[piece].GetBlockPositions(x, TetrisSettings.SpawnY, TetrisSettings.Rotations[rot]); gridTemp = grid.GetTempGrid(); if (grid.CheckPositionsAreValid(p0Positions, gridTemp)) { grid.MoveBlockDownToPlace(p0Positions, ref gridTemp); grid.GetLines(ref gridTemp); grid.GetGridProperties(gridTemp, ref states[0], ref states[1], ref states[2], ref states[3]); // normalise state values 0 - 1 states[0] = states[0] / 4f; // max height states[1] = states[1] / TetrisSettings.GridSize; // sum height states[2] = states[2] / TetrisSettings.GridSize; // bumpiness states[3] = states[3] / TetrisSettings.GridSize; // numHoles } else { states[0] = -1; states[1] = -1; states[2] = -1; states[3] = -1; } return(states); }