Example #1
0
int main() {
    if( foo( five, three ) != 1 ) _fail;
    if( my_xor( two, two ) != 0 ) _fail;
    if( my_xor( three, twelve ) != 15 ) _fail;
    if( my_and( two, two ) != 2 ) _fail;
    if( my_and( three, twelve ) != 0 ) _fail;
    _PASS;
}
Example #2
0
int matrix_equations(Matrix_t *A, uint8 *D, uint32 size){
	uint32 i,j,search_1;
	uint8 **matpoint;
	matpoint = (uint8 **)malloc(A->row * sizeof(uint8 *));
	for(i=0; i<A->row; i++){
		matpoint[i] = (uint8 *)malloc(A->colum*sizeof(uint8));
		memcpy(matpoint[i], A->rowpoint[i], A->colum);
	}
	//matpoint = A->rowpoint;
	for(j=0; j<A->colum; j++){
		/*/////////////
		for(uint32 k = 0;k<A->row;k++){
		for(uint32 m = 0; m<A->colum; m++){
		printf("%2d ",matpoint[k][m]);
		}
		printf("\n");
		}
		printf("\n");
		///////////////*/
		search_1 = search_col_1(matpoint, j, A->row);

		if(search_1!=j){
			if(search_1 == -1){
				//if(j ==
				return 0;
			}
			row_exchange(j,search_1, matpoint, A->colum);
			my_exchange(D+j*size, D+search_1*size, size);
		}

		for(i=0;i<A->row; i++){
			if(matpoint[i][j] != 0){
				if(i!= j){
					//row_sub(i,j,inv_matpoint,A->colum,matpoint[j][j],matpoint[i][j]);
					//row_sub(i,j,matpoint,A->colum,matpoint[j][j],matpoint[i][j]);
					//row_or(i,j,inv_matpoint,A->colum);
					row_or(i,j,matpoint,A->colum);
					my_xor(D+i*size, D+j*size, size);
				}

				///////////////////////////////
				/*for(uint32 k = 0;k<A->row;k++){
				for(uint32 m = 0; m<A->colum; m++){
				printf("%2d ",matpoint[k][m]);
				}
				printf("\n");
				}
				printf("\n");*/
			}
		}
	}
	matrix_free(matpoint,A->row);
	return 1;
}
Example #3
0
int		marienbad(t_var *f, int total)
{
  int		xor;

  my_putstr("AI is playing ...\n");
  sleep(1);
  xor = my_xor(f);
  total = f->line[0] + f->line[1] + f->line[2] + f->line[3];
  my_putstr("The AI withdraws ");
  my_putnbr(xor);
  my_putstr(" matche(s)\n");
  ending_intell(f, total);
  return (total);
}