This site uses cookies own and third. If you continue to browse consider to accept the use of cookies. OK More Info.

Tablero de Ajedrez en C [Dev-time]

  • 1 Replies
  • 2223 Views

0 Members and 1 Guest are viewing this topic.

Offline Zackonit

  • *
  • Underc0der
  • Posts: 6
  • Actividad:
    0%
  • Country: mx
  • Reputación 1
  • "El Universo es cuestion de tiempo"
    • View Profile

Tablero de Ajedrez en C [Dev-time]

  • on: March 17, 2022, 09:14:43 pm
Code: (c) You are not allowed to view links. Register or Login

#include <stdio.h>
#include <curses.h>
[color=green]
#define ANSI_COLOR_GREEN   "\x1b[32m"
#define ANSI_COLOR_RESET   "\x1b[0m"[/color]

int generate(int range);
char chess(int row,int col);

int main(int argc,char const *argv[]){
    printf(ANSI_COLOR_GREEN   "\tH4CK3R CH355 v0.01 \n \tby: | @zackonit |"   ANSI_COLOR_RESET "\n");
printf("\n");
printf("\n size : %i bits \n",chess(8,8));
//generate(3);
return 0;
}

char chess(int row,int col){
//podriamos usar numeros pares para rellenar
//los cuadros
//int int_pair(1,COLOR RED, COLOR GREEN);
    int size = row * col;

for(int i=0;i<row;i++){
for(int k=0;k<col;k++){
//pawn
if(i == 1 || i == row-2){
printf(" ♙ ");
}
else if(i == 0 && k == 0 || i == 7 && k == 0
|| i == 0 && k == 7 || i == 7 &&
k == 7){
printf(" ♖ ");
}
else if(i == 0 && k == 1
|| i == 7 && k == 1
|| i == 0 && k == 6
|| i == 7 && k == 6 ){
printf(" ♘ ");
}else if(i == 0 && k== 2
|| i == 0 && k == 5
|| i == 7 && k == 2 ||
i == 7 && k == 5 ){
printf(" ♗ ");
}
else if(i == 0 && k == 4
|| i == 7 && k ==4){
//QUEEN
printf(" ♕ ");
}
else if(i == 0 && k == 3 ||
        i == 7 && k == 3){
printf(" ♔ ");
}
else{
printf( ANSI_COLOR_GREEN   " 0 "   ANSI_COLOR_RESET );
}
}
printf("\n");
}
    return size;
}

Offline Holis640

  • *
  • Underc0der
  • Posts: 9
  • Actividad:
    0%
  • Reputación 0
    • View Profile
    • Email

Re: Tablero de Ajedrez en C [Dev-time]

  • on: March 18, 2022, 02:29:51 pm
Esta fino, pero yo no teniendo C.