After seeing my parents stay together for 40 years i personally want 52 women a year.
Printable View
Ohhhh i loves me a M.I.L.F.
Lets play chess
Code:#include <stdlib.h>
//-----------------------------------
struct sPiece { int ID, x, y, Val;};
struct sGroup { int ID, PiD[4]; };
struct sHalfMap{ int ID, GiD[4]; };
struct sFullMap{ int ID, HiD[2]; };
//----------------
struct sFullMap *board, *Boards;
struct sHalfMap *half, *Halves;
struct sGroup *group, *Groups;
struct sPiece *piece, *Pieces;
int iBoards=0, iHalves=0, iGroups=0, iPieces=0;
const cInitPiece[] = { 2,3,4,5,6,4,3,2 };
const PieceA[] = {'-','P','C','H','B','Q','K'};
const PieceB[] = {'-','p','c','h','b','q','k'};
int ShortBoard[8][8];
int ShortPiD[4][4];
int SPx, SPy;
//-----------------------------------
//-------------------------------------------------------------------------------------------------
void iiBoard(){
if(iBoards==0){
Boards = (struct sFullMap *)malloc(sizeof(struct sFullMap));
} else {
board = realloc(Boards,(iBoards+2)* sizeof(struct sFullMap));
if (board!=NULL) Boards = board;
}
}
//------------------
int BEScanner(int a, int b, int c){
int iBe, iHalt=-1;
for(iBe=0;iBe<iBoards;iBe++){
if(Boards[iBe].HiD[0] == b)
if(Boards[iBe].HiD[1] == c) iHalt=1;
if(iHalt==1){printf("Found @ %i", iBe); break;}
}
if(iHalt==-1) iBe=1;
return (iHalt * iBe);
}
//-----------------------
void BoardEntry(int iD, int HiDa, int HiDb){
if (BEScanner(iD, HiDa, HiDb)!=-1) return;
if(iBoards<=iD) iiBoard();
Boards[iD].ID = iD;
Boards[iD].HiD[0] = HiDa;
Boards[iD].HiD[1] = HiDb;
iBoards++;
printf("added %i", iBoards-1);
}
//-----------------------------------
void iiHalf(){
if(iHalves==0){
Halves = (struct sHalfMap *)malloc(sizeof(struct sHalfMap));
} else {
half = realloc(Halves,(iHalves+2)* sizeof(struct sHalfMap));
if (half!=NULL) Halves = half;
}
}
//------------------
int HEScanner(int a, int b, int c, int d){
int iBe, iHalt=-1;
for(iBe=0;iBe<iHalves;iBe++){
if(Halves[iBe].GiD[0] == a)
if(Halves[iBe].GiD[1] == b)
if(Halves[iBe].GiD[2] == c)
if(Halves[iBe].GiD[3] == d) iHalt=1;
if(iHalt==1){printf("Found @ %i", iBe); break;}
}
if(iHalt==-1) iBe=1;
return (iHalt * iBe);
}
//-----------------------
void HalfEntry(int iD, int GiDa, int GiDb, int GiDc, int GiDd){
if (HEScanner(GiDa, GiDb, GiDc, GiDd)!=-1) return;
if(iHalves<=iD) iiHalf();
Halves[iD].ID = iD;
Halves[iD].GiD[0] = GiDa;
Halves[iD].GiD[1] = GiDb;
Halves[iD].GiD[2] = GiDc;
Halves[iD].GiD[3] = GiDd;
iHalves++;
}
//-----------------------------------
void iiGroup(){
if(iGroups==0){
Groups = (struct sGroup *)malloc(sizeof(struct sGroup));
} else {
group = realloc(Groups,(iGroups+2)* sizeof(struct sGroup));
if (group!=NULL) Groups = group;
}
}
//------------------
int GEScanner(int a, int b, int c, int d){
int iBe, iHalt=-1;
for(iBe=0;iBe<iGroups;iBe++){
if(Groups[iBe].PiD[0] == a)
if(Groups[iBe].PiD[1] == b)
if(Groups[iBe].PiD[2] == c)
if(Groups[iBe].PiD[3] == d) iHalt=1;
if(iHalt==1){printf("Found @ %i", iBe); break;}
}
if(iHalt==-1) iBe=1;
return (iHalt * iBe);
}
//-----------------------
void GroupEntry(int iD, int PiDa, int PiDb, int PiDc, int PiDd){
if (GEScanner(PiDa, PiDb, PiDc, PiDd)!=-1) return;
if(iGroups<=iD) iiGroup();
Groups[iD].ID = iD;
Groups[iD].PiD[0] = PiDa;
Groups[iD].PiD[1] = PiDb;
Groups[iD].PiD[2] = PiDc;
Groups[iD].PiD[3] = PiDd;
iGroups++;
}
//-----------------------------------
void iiPiece(){
if(iPieces==0){
Pieces = (struct sPiece *)malloc(sizeof(struct sPiece));
} else {
piece = realloc(Pieces,(iPieces+2)* sizeof(struct sPiece));
if (piece!=NULL) Pieces = piece;
}
}
//------------------
int PEScanner(int a, int b, int c){
int iBe, iHalt=-1;
for(iBe=0;iBe<iPieces;iBe++){
if(Pieces[a].x == a)
if(Pieces[a].y == b)
if(Pieces[a].Val == c) iHalt=1;
if(iHalt==1){printf("Found @ %i", iBe); break;}
}
if(iHalt==-1) iBe=1;
return (iHalt * iBe);
}
//-----------------------
void PieceEntry(int iD, int Px, int Py, int PVal){
if(iPieces<=iD) iiPiece();
Pieces[iD].ID = iD;
Pieces[iD].x = Px;
Pieces[iD].y = Py;
Pieces[iD].Val = PVal;
iPieces++;
}
//-----------------------------------
//------------------------------------------------------------------------------------
void Amnesia(){
BoardEntry(0, 0, 0);
//BoardEntry(1,0,1);
//BoardEntry(2,0,2);
HalfEntry(0,0,1,2,3);
//HalfEntry(1,0,1,2,4);
GroupEntry(0,0,1,2,3);
GroupEntry(1,4,5,6,7);
GroupEntry(2,8,9,10,11);
GroupEntry(3,12,13,14,15);
//GroupEntry(4,12,13,14,15);
int i, y=0;
for(i=0;i<=14;i+=2){
PieceEntry(i, 1,y,1);
PieceEntry(i+1,0,y,(int) cInitPiece[y]);
y++;
}
}
//---------------------------------
void GetBoardX(int i){
int Hint, Gint, Pint;
int z,y,x;
Hint = Boards[i].HiD[0];
for (y=0;y<4;y++){
Gint = Halves[ Hint ].GiD[y];
for (z=0;z<4;z++){
Pint = Groups[ Gint ].PiD[z];
ShortBoard[ Pieces[Pint].x ][ Pieces[Pint].y ] = Pieces[Pint].Val;
ShortPiD[y][z]=Pint;
}
}
Hint = Boards[i].HiD[1];
for (y=0;y<4;y++){
Gint = Halves[ Hint ].GiD[y];
for (z=0;z<4;z++){
Pint = Groups[ Gint ].PiD[z];
ShortBoard[7- Pieces[Pint].x ][7- Pieces[Pint].y ] = -Pieces[Pint].Val;
}
}
return;
}
//-------------------------------
void ClearBoard(){
int x, y;
for(x=0;x<8;x++){
for(y=0;y<8;y++){
ShortBoard[x][y] = 0;
}
}
}
//-----------------------------------
void DrawBoard(){
int x, y;
printf("\n");
for(y=0;y<8;y++){
for(x=0;x<8;x++){
if(ShortBoard[x][y]>=0){
printf("%c ", PieceA[ShortBoard[x][y]]);
} else {
printf("%c ", PieceB[-ShortBoard[x][y]]);
}
}
printf("\n");
}
}
//-----------------------------------
//---------------------------------------------------------------------------------------------------
//--------------------------------------------------------------
void PMove(int x, int y){
int FMove=0;
if(x==1)FMove=1;
if(ShortBoard[x+1][y]==0){
printf("Move %i%i,%i%i Valid\n",x,y,x+1,y);
if((FMove==1) & (ShortBoard[x+2][y]==0)) printf("Move %i%i,%i%i Valid\n",x,y,x+2,y);
}
}
//----------------
void PAttack(int x, int y){
if(ShortBoard[x+1][y+1]<0)
printf("Attack %i%i,%i%i Valid\n",x,y,x+1,y+1);
if(ShortBoard[x+1][y-1]<0)
printf("Attack %i%i,%i%i Valid\n",x,y,x+1,y-1);
}
//-----------------------------------------
int JumpX(int x, int y){
if(((0>x) + (x>7) + (0>y) + (y>7))>=1) return -2;
if(ShortBoard[x][y]<=-1) return -1;
if(ShortBoard[x][y]==0) return 0;
if(ShortBoard[x][y]>=1) return 1;
}
//-----------------------------------------
int BAttackXY(int x, int y, int b, int b2, int c, int d){
int Stepb=x, Stepb2=y;
int Jumpy=0;
while((Stepb!=c) + (Stepb2!=d)==2){
Stepb+=b;
Stepb2+=b2;
if((Jumpy=JumpX(Stepb, Stepb2))!=0) Stepb=c;
printf("%i", Jumpy);
}
}
//-----------------------------------------
void BAttack(int x, int y){
BAttackXY(x,y,1,1,8,8);
BAttackXY(x,y,1,-1,8,-1);
BAttackXY(x,y,-1,1,-1,8);
BAttackXY(x,y,-1,-1,-1,-1);
}
//=--------------------
void CAttackvII(int x, int y){
printf("cx%i cy%i ",x,y);
BAttackXY(x,y,1,0,8,8);
BAttackXY(x,y,0,-1,8,-1);
BAttackXY(x,y,0,1,-1,8);
BAttackXY(x,y,-1,0,-1,-1);
}
//-------------
void QAttack(int x, int y){
BAttack(x, y);
CAttackvII(x, y);
}
//---------------------------
void Jump(int x, int y){
if((0>x) + (x>7)>=1){ printf("Null%i%i",x,y); return;}
if((0>y) + (y>7)>=1){printf("Null%i%i",x,y); return;}
if(ShortBoard[x][y]>=1) printf("Blocked %i%i",x,y);
if(ShortBoard[x][y]==0) printf("Open %i%i",x,y);
if(ShortBoard[x][y]<=-1) printf("Hit %i%i",x,y);
//printf("?");
}
//---------------------------
//------------------
void KAttack(x,y){
Jump(x+1, y+1); Jump(x+1, y); Jump(x+1, y-1);
Jump(x-1, y+1); Jump(x-1, y); Jump(x-1, y-1);
Jump(x, y+1); Jump(x, y-1);
}
//-----------------
void HAttack(x,y){
Jump(x+2, y+1); Jump(x+2, y-1);
Jump(x-2, y+1); Jump(x-2, y-1);
Jump(x+1, y+2); Jump(x+1, y-2);
Jump(x-1, y+2); Jump(x-1, y-2);
}
//-----------------
void Moves(int x, int y){
int PieceType=ShortBoard[x][y];
printf("%i @ %i,%i", ShortBoard[x][y], x ,y);
if (PieceType==1)
printf("GotPawn\n");
else if(PieceType==2)
printf("\nGotCastle\n");
else if(PieceType==3)
printf("\nGotHorse\n");
else if(PieceType==4)
printf("\nGotBishop\n");
else if(PieceType==5)
printf("\nGotQueen\n");
else if(PieceType==6)
printf("\nGotKing\n");
switch (PieceType){
case 1: PMove(x, y);
PAttack(x, y);
break;
case 2: CAttackvII(x, y);
break;
case 3: HAttack(x, y);
break;
case 4: BAttack(x, y);
break;
case 5: QAttack(x, y);
break;
case 6: KAttack(x, y);
break;
}
//printf("Move?\n");
}
void GetMoves(){
for(SPx=0;SPx<4;SPx++){
for(SPy=0;SPy<4;SPy++){
if(ShortBoard[ Pieces[ShortPiD[SPx][SPy]].x ][ Pieces[ShortPiD[SPx][SPy]].y ]>0){
//printf("Found piece %i\n", ShortBoard[x][y]);
Moves(Pieces[ShortPiD[SPx][SPy]].x, Pieces[ShortPiD[SPx][SPy]].y);
}
}
}
}
//-----------------------------------------------------------------------
void main(){
Amnesia();
ClearBoard();
GetBoardX(0);
DrawBoard();
GetMoves();
free(Boards);
free(Halves);
free(Groups);
free(Pieces);
return;
}
It looks quite a buzz but I'm gonna have to decline I have to go play in traffic instead.
Ok then your move 1st.
are you rich yet Tim lmfao
nice Facebook pic serj
Tim is getting more fat, he's probably going to be another Clay
bring back dp!
:brian:
doing great Tim
tim