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

    −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
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    82. 82
    83. 83
    84. 84
    int minimal_array(int array[], int flag_array[] , int intro_run) {
    	int step;
    	int end = -1;
    	int Minimum = 8;
    	for(step = 0; step <= 7; ++step) {
    		if( array[step] <= Minimum &&  array[step] >=  1 &&   flag_array[step] ==  1     ) {
    			Minimum = array[step];
    			end = step;
    		}
    	}
    	if(     intro_run >= (chess * chess - 4) ||      intro_run <=  (chess * chess - 2  ) ) {
    		for(step = 0; step <= 7; ++step) {
    			if(    array[step] ==  0 &&   flag_array[step] ==  1     ) {
    				end = step;
    			}
    		}
    	}
    	return end;
    }
    int   check_point(   int row, int column,  int bord[][chess]	) {
    	int p;
    	row >= 0 && row <= chess - 1 && column >= 0 && column <= chess -1 && bord[row][column]  == 0 ? (p = 1 ) : (p = 0);
    	return p;
    }
    int cor_hor(int hor_out  ) {
    	static	int	  horizont[chess] = {2,1,-1,-2,-2,-1,1,2 };
    	return 	   horizont[hor_out];
    }
    int cor_ver(int ver_out) {
    	static	int  	verti[chess] = { -1, -2,-2,-1,1,2,2,1  };
    	return  verti[ver_out];
    }
    int minimum_possible(int cur_Column,int cur_Row, int extro_board[][chess],int run) {
    	int   check_point(   int row, int column,  int bord[][chess]	),
    	         cor_hor(int in  ),
    	         cor_ver(int ni),
    	         extro_stop = 0,
    	         intro_board[chess][chess] = {0 },
    	                                     extro_array[8] = {0 },
    	                                             step_row[8] = {0 },
    	                                                     step_column[8] = {0 },
    	                                                             intro_array[8] = {0 },
    	                                                                     extro_number_shift,
    	                                                                     extro_shag = 0,
    	                                                                     extro_Row  ,
    	                                                                     extro_Column ,
    	                                                                     cycle_all= 0 ,
    	                                                                     step = 0;
    	memcpy( intro_board      ,extro_board,  sizeof(intro_board  ));
    	for( extro_number_shift = -1; extro_stop <= 8; ) {
    		extro_Row += cor_ver(extro_number_shift),extro_Column += cor_hor(extro_number_shift);
    		if(check_point(  extro_Row  ,extro_Column ,  intro_board	)  == 1) {
    			intro_board[extro_Row][extro_Column]  = ++extro_shag;
    			++extro_array[extro_number_shift];
    			step_row[extro_number_shift]   =   extro_Row ;
    			step_column[extro_number_shift] =  extro_Column ;
    		} else {
    			++extro_stop;
    		}
    		extro_Column = cur_Column;
    		extro_Row = cur_Row;
    		++extro_number_shift ;
    	}
    	while(cycle_all <=  7)	{
    		if(extro_array[cycle_all] == 1) {
    			memcpy( intro_board,extro_board,sizeof(intro_board  ));
    			intro_board[cur_Row][cur_Column] = 1;
    			for( extro_stop = 0,  extro_number_shift  = -1  ; extro_stop  !=   8;) {
    				extro_Row +=  cor_ver(extro_number_shift) ,extro_Column += cor_hor(extro_number_shift );
    				if(    check_point(  extro_Row  ,extro_Column ,  intro_board	)  == 1) {
    					intro_board[extro_Row][extro_Column]  = extro_shag++;
    					++intro_array[cycle_all];
    				} else {
    					extro_stop++;
    				}
    				extro_Row =     step_row[cycle_all];
    				extro_Column  =     step_column[cycle_all] ;
    				++extro_number_shift;
    			}
    		}
    		++cycle_all;
    	}
    	return      	 minimal_array(intro_array   ,extro_array , run )   ;
    }

    обход доски конем метод варнсдорфа ч.2 набор функций

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

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

    • Страйкер, ехлический потрох! Пора бы уже заняться выпуском туалетной бумаги с распечатками постов с говнокода!
      Ответить
    • int minimum_possible(int cur_Column,int cur_Row, int extro_board[][chess],int run) {
      	int   check_point(   int row, int column,  int bord[][chess]	), // ШТА?
      	         cor_hor(int in  ),  // ШТА?
      	         cor_ver(int ni),  // ШТА?
      	         extro_stop = 0,
      	         intro_board[chess][chess] = {0 },
      	                                     extro_array[8] = {0 },
      	                                             step_row[8] = {0 },
      	                                                     step_column[8] = {0 },
      	                                                             intro_array[8] = {0 },
      	                                                                     extro_number_shift,
      	                                                                     extro_shag = 0,
      	                                                                     extro_Row  ,
      	                                                                     extro_Column ,
      	                                                                     cycle_all= 0 ,
      	                                                                     step = 0;
      ШТА?
      Ответить

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