This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
public class CubeSpawner : MonoBehaviour { | |
public GameObject cube; | |
void Start() { | |
StartCoroutine(spawnCubes()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int * spiral(int r, int c, int sr, int sc) { | |
//Traverse direction increment state and direction state | |
// %4 == 1 -> north; 2 -> east; 3 -> south; 0 -> west; | |
int *array = new int [r*c]; | |
int counter = 1, steps, dir, increment, arridx = 0; | |
bool vertical = true; | |
array[arridx++] = matrix[sr-1][sc-1]; | |
while(arridx < r*c) { | |
dir = counter % 4; | |
vertical = dir == 1 || dir == 3 ? true : false; |