Bueno espero comentarios y sugerencias!!
Saludos!!
P.D: el codigo lo hice en linux por lo tanto el system("clear") tira error si no se ejecuta en ese OS
Código
#include<stdio.h> #include<stdlib.h> #include<time.h> #define SIZE 71 int printRace(int [][SIZE], int, int, int); main() { int row, column, raceTrack[3][SIZE]; int tortoise = 1, hare = 1, finish; finish = printRace(raceTrack, tortoise, hare, SIZE); if (finish == 1) else if (finish == 2) else return 0; } int printRace(int rt[][SIZE], int t, int h, int size) { void wait(int); int tortoiseArray[10] = {3, 3, 3, 3, 3, -6, -6, 1, 1, 1}; int hareArray[10] = {0, 0, 9, 9, -12, 1, 1, 1, -2, -2}; int timer = 1, row, column; while (t < size - 1 && h < size - 1){ for (row = 1; row < 3; row++){ for (column = 1; column < size; column++){ if (t != h || t == 1){ if (row == 1 && column == t) else if (row == 2 && column == h) else } else{ if (row == 1 && column == t) else if (row == 2 && column == h) else } } } if (t < 1) t = 1; if (h < 1) h = 1; if (t > size - 1) t = size - 1; if (h > size - 1) h = size - 1; wait(1); } for (row = 1; row < 3; row++){ for (column = 1; column < size; column++){ if (row == 1 && column == t) else if (row == 2 && column == h) else } } if (t == size - 1 && h == size -1) return 0; else if (t == size -1) return 1; else return 2; } void wait(int seconds) { clock_t endwait; }