alpha_beta.c
changeset 48 b94d657a9acb
parent 29 7abf6146898e
child 77 49e0babccb23
equal deleted inserted replaced
47:63adb261de90 48:b94d657a9acb
    46  */
    46  */
    47 void push (Move * move)
    47 void push (Move * move)
    48 {
    48 {
    49     Node *actual;
    49     Node *actual;
    50 
    50 
    51     if ((actual = malloc (sizeof (Node) + 1)) == NULL) {
    51     if ((actual = malloc (sizeof (Node))) == NULL) {
    52         perror ("MALLOC");
    52         perror ("MALLOC");
    53         exit (EXIT_FAILURE);
    53         exit (EXIT_FAILURE);
    54     }
    54     }
    55 
    55 
    56     actual->data = move;
    56     actual->data = move;
   174         if (!validMove (t)) {
   174         if (!validMove (t)) {
   175             t++;
   175             t++;
   176             continue;
   176             continue;
   177         }
   177         }
   178 
   178 
   179         if ((move = malloc (sizeof (Move) + 1)) == NULL) {
   179         if ((move = malloc (sizeof (Move))) == NULL) {
   180             perror ("MALLOC");
   180             perror ("MALLOC");
   181             exit (EXIT_FAILURE);
   181             exit (EXIT_FAILURE);
   182         }
   182         }
   183 
   183 
   184         if (player == 0)
   184         if (player == 0)
   301     if (argc == 2)
   301     if (argc == 2)
   302         depth = atoi (argv[1]);
   302         depth = atoi (argv[1]);
   303     else
   303     else
   304         depth = 1;
   304         depth = 1;
   305 
   305 
   306     if ((actual = malloc (sizeof (Node) + 1)) == NULL) {
   306     if ((actual = malloc (sizeof (Node))) == NULL) {
   307         perror ("MALLOC");
   307         perror ("MALLOC");
   308         return EXIT_FAILURE;
   308         return EXIT_FAILURE;
   309     }
   309     }
   310 
   310 
   311     actual->data = NULL;
   311     actual->data = NULL;