// Place global declarations here. const int N = 6; typedef int[0,N-1] pos_t; typedef int[2,3] size_t; const bool Vert = true; const bool Horz = false; typedef struct { size_t s; bool isVert; pos_t x; pos_t y; } car_def_t ; bool free[pos_t][pos_t]; int init_errors; const int Count = 1; typedef int[0,Count-1] id_t; // Red car (the target, to move out) should be first! const car_def_t defs[Count] = { { 2, Horz, 4, 3 } /* , { 3, Vert, 0, 2 }, { 2, Vert, 1, 3 }, { 2, Vert, 2, 4 }, { 2, Vert, 3, 1 }, { 2, Vert, 4, 5 }, { 3, Vert, 5, 4 }, { 2, Horz, 1, 5 }, { 2, Horz, 2, 0 }, { 2, Horz, 3, 5 }, { 2, Horz, 4, 2 }, { 2, Horz, 5, 0 }, { 2, Horz, 5, 1 } */ }; void initialize_cars() { int p; for (i : pos_t) for (j : pos_t) { free[i][j] = 1; } for (i : id_t) { for (p=0; p < defs[i].s; p++) { if (!free[defs[i].x-p*(1-defs[i].isVert)][defs[i].y-p*defs[i].isVert]) { init_errors++; } else { free[defs[i].x-p*(1-defs[i].isVert)][defs[i].y-p*defs[i].isVert] = 0; } } } } // Place template instantiations here. cars(const id_t i) = car(defs[i].x, defs[i].y, defs[i].s, defs[i].isVert); system cars, initializer;