1. Си / Говнокод #19833

    −49

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    #include<stdio.h>
    #include <stdlib.h>
    #include<string.h>
    #define chess 18
    int minimum_possible(int cur_Column,int cur_Row, int extro_board[][chess], int run ),
        check_point(   int row, int column,  int bord[][chess]	),
        cor_hor(int hor_out  ),
        cor_ver(int ver_out);
    int main(void) {
    	int  step = 1 ,
    	     y,x,
    	     moveNumber = 1,
    	     currentColumn,
    	     currentRow,
    	     board[chess][chess] = {0 } , p = 1;
    	while( p  ) {
    		printf("enter the coordinates of the knight y  x: ");
    		scanf("%d %d",&currentColumn ,  &currentRow   );
    		if (currentColumn <  0  ||  (currentColumn > (chess - 1)   )  ||  (currentRow  <  0 ||  (currentRow > (chess - 1))    ) )  {
    			puts("correct the coordinates of the knight from 0 to 11 for x and y");
    		} else {
    			p = 0;
    		}
    	}
    	while(  	moveNumber  != -1   )  {
    		board[currentRow][ currentColumn]  = step++;
    		moveNumber =     minimum_possible(currentColumn,currentRow ,board , step ) ;
    		currentRow +=   cor_ver(moveNumber);
    		currentColumn +=   cor_hor(moveNumber);
    	}
    	for(x = 0; x <= chess - 1; x++) {
    		puts(" ");
    		for(y = 0 ; y <= chess - 1; y++)
    			printf("%3d ", board[x][y]);
    	}
    	return 0;
    }

    обход доски конем метод варнсдорфа ч.1

    Запостил: lazy_8, 17 Апреля 2016

    Комментарии (0) RSS

    Добавить комментарий

    Ошибка компиляции комментария:
    1. Гости могут высказаться только во вторник, пятницу или субботу
    ava Я, guest, находясь в здравом уме и твердой памяти, торжественно заявляю:
    А не использовать ли нам bbcode?
    • [b]жирный[/b] — жирный
    • [i]курсив[/i] — курсив
    • [u]подчеркнутый[/u] — подчеркнутый
    • [s]перечеркнутый[/s] — перечеркнутый
    • [blink]мигающий[/blink] — мигающий
    • [color=red]цвет[/color] — цвет (подробнее)
    • [size=20]размер[/size] — размер (подробнее)
    • [code=<language>]some code[/code] (подробнее)
    Проверочный код