Example #1
0
static JSBool js_set(JSContext *cx, JSObject *obj, jsid id, JSBool strict, jsval *vp)
{
	jsval idval;
    jsint		tiny;
	int32		i=0;
	JSBool		b;
	jsrefcount	rc;

    JS_IdToValue(cx, id, &idval);
    tiny = JSVAL_TO_INT(idval);

	switch(tiny) {
		case PROP_WSCROLL:
			JS_ValueToBoolean(cx, *vp, &_wscroll);
			break;
		case PROP_DIRECTVIDEO:
			JS_ValueToBoolean(cx, *vp, &directvideo);
			break;
		case PROP_HOLD_UPDATE:
			JS_ValueToBoolean(cx, *vp, &hold_update);
			break;
		case PROP_PUTTEXT_CAN_MOVE:
			JS_ValueToBoolean(cx, *vp, &puttext_can_move);
			break;
		case PROP_ESCDELAY:
			if(cio_api.ESCDELAY) {
				if(!JS_ValueToInt32(cx, *vp, (int32*)cio_api.ESCDELAY))
					return JS_FALSE;
			}
			break;
		case PROP_TEXTATTR:
			if(!JS_ValueToInt32(cx, *vp, &i))
				return JS_FALSE;
			rc=JS_SUSPENDREQUEST(cx);
			textattr(i);
			JS_RESUMEREQUEST(cx, rc);
			break;
		case PROP_WHEREX:
			if(!JS_ValueToInt32(cx, *vp, &i))
				return JS_FALSE;
			rc=JS_SUSPENDREQUEST(cx);
			gotoxy(i, cio_textinfo.cury);
			JS_RESUMEREQUEST(cx, rc);
			break;
		case PROP_WHEREY:
			if(!JS_ValueToInt32(cx, *vp, &i))
				return JS_FALSE;
			rc=JS_SUSPENDREQUEST(cx);
			gotoxy(cio_textinfo.curx, i);
			JS_RESUMEREQUEST(cx, rc);
			break;
		case PROP_TEXTMODE:
			if(!JS_ValueToInt32(cx, *vp, &i))
				return JS_FALSE;
			rc=JS_SUSPENDREQUEST(cx);
			textmode(i);
			JS_RESUMEREQUEST(cx, rc);
			break;
		case PROP_TEXTBACKGROUND:
			if(!JS_ValueToInt32(cx, *vp, &i))
				return JS_FALSE;
			rc=JS_SUSPENDREQUEST(cx);
			textbackground(i);
			JS_RESUMEREQUEST(cx, rc);
			break;
		case PROP_TEXTCOLOR:
			if(!JS_ValueToInt32(cx, *vp, &i))
				return JS_FALSE;
			rc=JS_SUSPENDREQUEST(cx);
			textcolor(i);
			JS_RESUMEREQUEST(cx, rc);
			break;
		case PROP_CLIPBOARD:
			{
				size_t	len;
				char	*bytes;

				JSVALUE_TO_MSTRING(cx, *vp, bytes, &len);
				HANDLE_PENDING(cx);
				if(!bytes)
					return JS_FALSE;
				rc=JS_SUSPENDREQUEST(cx);
				copytext(bytes, len+1);
				free(bytes);
				JS_RESUMEREQUEST(cx, rc);
			}
			break;
		case PROP_HIGHVIDEO:
			JS_ValueToBoolean(cx, *vp, &b);
			rc=JS_SUSPENDREQUEST(cx);
			if(b)
				highvideo();
			else
				lowvideo();
			JS_RESUMEREQUEST(cx, rc);
			break;
		case PROP_LOWVIDEO:
			JS_ValueToBoolean(cx, *vp, &b);
			rc=JS_SUSPENDREQUEST(cx);
			if(b)
				lowvideo();
			else
				highvideo();
			JS_RESUMEREQUEST(cx, rc);
			break;
	}

	return(JS_TRUE);
}
Example #2
0
File: tetris.c Project: seL4/refos
/*! @brief Render and update the current screen output. */
int
update(void)
{
    int x, y; 

    /* Render the next piece preview. */
    if (enablePreview) {
        static int start = 5;
        memset (preview, 0, sizeof(preview));

        int c = get_col(peekShape);
        preview[2 * B_COLS + 1] = c;
        preview[2 * B_COLS + 1 + peekShape[1]] = c;
        preview[2 * B_COLS + 1 + peekShape[2]] = c;
        preview[2 * B_COLS + 1 + peekShape[3]] = c;

        for (y = 0; y < 4; y++) {
            for (x = 0; x < B_COLS; x++) {
                if (preview[y * B_COLS + x] - shadowPreview[y * B_COLS + x]) {
                    shadowPreview[y * B_COLS + x] = preview[y * B_COLS + x];
                    gotoxy (x * 2 + 26 + 28, start + y);
                    printblock(preview[y * B_COLS + x]);
                }
            }
        }
    }

    /* Render the actual board. */
    for (y = 1; y < B_ROWS - 1; y++) {
        for (x = 0; x < B_COLS; x++) {
            if (board[y * B_COLS + x] - shadow[y * B_COLS + x]) {
                shadow[y * B_COLS + x] = board[y * B_COLS + x];
                gotoxy (x * 2 + 28, y);
                printblock(board[y * B_COLS + x]);
            }
        }
    }

    /* Update points and level. */
    while (linesCleared >= LINES_PER_LEVEL) {
        linesCleared -= LINES_PER_LEVEL;
        level++;
        if (level > MAX_LEVEL) level = MAX_LEVEL;
    }

    /* Render the scoreboard. */
    if (enableScoreBoard) {
        textattr(RESETATTR);
        gotoxy (26 + 28, 2);
        printf ("Level  : %d", level);
        fflush(stdout);
        gotoxy (26 + 28, 3);
        printf ("Points : %d", points);
        fflush(stdout);
    }

    if (enablePreview) {
        gotoxy (26 + 28, 5);
        printf ("Preview:");
        fflush(stdout);
    }

    gotoxy (26 + 28, 10);
    printf ("Keys:");
    fflush(stdout);
    return 0;
}
Example #3
0
/*显示先下棋方*/
void ShowOrderMsg(int Order)
{
  gotoxy(6,MAPY_O+20);
  textcolor(LIGHTRED);
  cputs("Player1 go!");
}
Example #4
0
void CaenVmeReadBlt(int32_t BHandle, man_par_t *man)
{
int					nb;
uint32_t				i,j ;
CVAddressModifier	am;
CVErrorCodes		ret,old_ret=cvSuccess;


if(man->am == cvA16_U)
	{
    con_printf(" Can't execute a A16 BLT Read Cycle");
	return ;
	}
if(man->am == cvCR_CSR)
	{
    con_printf(" Can't execute a CR/CSR BLT Read Cycle");
	return ;
	}

if (man->dtsize == cvD64)
	{
	if (man->am == cvA24_U_DATA)
		am = cvA24_U_MBLT;
	else 
		am = cvA32_U_MBLT;
	}
else
	{
	if (man->am == cvA24_U_DATA)
		am = cvA24_U_BLT;
	else 
		am = cvA32_U_BLT;
	}

if(man->ncyc == 0)				// Infinite Loop
	con_printf_xy(X_COMM,Y_COMM+2," Running ...    Press any key to stop.");

for (i=0; ((man->ncyc==0) || (i<man->ncyc)) && !con_kbhit(); i++)
	{
	for (j=0;j<(man->blts/4);j++)
		man->buff[j]=0;

	ret = CAENVME_BLTReadCycle(BHandle,man->addr,(char *)man->buff,man->blts,am,man->dtsize,&nb);
        
	if((i==0) || (ret != old_ret))
		{
		gotoxy(X_COMM,Y_COMM) ;

		switch (ret)
			{
			case cvSuccess   : con_printf(" Cycle(s) completed normally\n");
							   con_printf(" Read %u bytes",nb);
							   break ;
			case cvBusError	 : con_printf(" Bus Error !!!\n");
							   con_printf(" Read %u bytes",nb);
							   break ;				   
			case cvCommError : con_printf(" Communication Error !!!");
							   break ;
			default          : con_printf(" Unknown Error !!!");
							   break ;
			}
		}
       
	old_ret = ret;

    } 

if(man->ncyc == 0)
	clear_line(Y_COMM+2);        
}
void contacts(char uname[])
{






 int choice;

 char name[]="Welcome to Contact Manager";
 startup(name);
 //char intro[]="This is a unique feature of the James Gleick Messenger. This enables you to add contacts and make frineds within James Gleick Network. Before you get on with some 'Real Networking' this is very essential. It is highly recommended that you perform this, although it is not compulsory.";
 slowprin();

 //***********source program slide.cpp in my programs folder

 int i,j;
 char p[]=" 1. Yes. Ok. Proceed";
 char s[]=" 2. No. I'll Do it later.";
 for(i=0,j=62;i<=26;i+=1,j-=1)
 {
  clrscr();
  {
   int len;
   //char ch=97; //name[]="PG Database Securities";
   int l=(80-(strlen(name)))/2;
   gotoxy(l,3);
   cout<<name<<"\n\n\n";
   ifstream fin45("C:\\JG MSG\\settings\\conintro.txt");
   char intro[80];

   while(fin45.getline(intro,80))
   {
    len=strlen(intro);
    for(int i=0;i<len;i+=1)
    {
     cout<<intro[i];
    }
    cout<<"\n";
   }
    fin45.close();
  }
  gotoxy(i,12);
  puts(p);
  gotoxy(j,14);
  puts(s);
  delay(25);
 }
 delay(2000);




 cout<<"\n\n\n\t\t\t Enter your choice : ";
 cin>>choice;






 for(;i>=0&&j<=62;i-=1,j+=1)
 {
  clrscr();
  {
   int len;
   //char ch=97; //name[]="PG Database Securities";
   int l=(80-(strlen(name)))/2;
   gotoxy(l,3);
   cout<<name<<"\n\n\n";
   ifstream fin45("C:\\JG MSG\\settings\\conintro.txt");
   char intro[80];
   while(fin45.getline(intro,80))
   {
    len=strlen(intro);
    for(int i=0;i<len;i+=1)
    {
     cout<<intro[i];
    }
    cout<<"\n";
   }
    fin45.close();
  }
  gotoxy(i,12);
  puts(p);
  gotoxy(j,14);
  puts(s);
  delay(25);
 }




 clrscr();
 //char name[]="Welcome to Contact Manager";
 int l=(80-(strlen(name)))/2;
 gotoxy(l,3);
 cout<<name;
 ifstream fin56("C:\\JG MSG\\login\\list.use",ios::binary);
 char username[20][80],names[20][80];
 int k=0;
 {
  use A;
  while(fin56.read((char*)&A,sizeof(A)))
  {
   strcpy(username[k++],A.name);
  }
 }
 fin56.close();
 info X;
 int ch=1;
 int v=0;
 i=0;
 cout<<"\n\nView all available contacts now...";
 cout<<"\n\n\n";
 while(v<k)
 {
 char add[]="C:\\JG MSG\\login\\";
 strcat(add,username[v]);
 strcat(add,".jgs");
 ifstream fin57(add,ios::binary);
 fin57.read((char*)&X,sizeof(X));
 strcpy(names[v++],X.fname);
 cout<<" "<<ch<<". ";
 puts(X.fname);
 ch+=1;
}



 int selec[20],d=-1;
 char cho;
 cout<<"\n\nChoose your contacts !!! ";
 getch();







 for(i=0;i<k;i+=1)
 {

  clrscr();
  l=(80-(strlen(name)))/2;
  gotoxy(l,3);
  puts(name);
  cout<<"\n\n\n";

  v=0;ch=1;
  char nmew1[80];

  //while(v<k)
  {
   cout<<"\n\nAll the available contacts...";
   for(int x=0;x<k;x+=1)
   {
     int flag=0;
     strcpy(nmew1,names[x]);
     for(int j=0;j<k;j+=1)
     {
      if(strcmpi(names[selec[j]],names[x])==0)
      { flag=1;break; }
     }
     if (flag==1)
     {
      int y=0;
      for(;y<strlen(nmew1);y+=1)
      nmew1[y]=toupper(nmew1[y]);
     }
     cout<<"\n "<<x+1<<". "<<nmew1;
   }
  // v+=1;
  }
  cout<<"\n\n Choose Contact No."<<i+1<<" ? (Y/N) : ";
  cin>>cho;
  if(cho=='y'||cho=='Y')
  {
   d+=1;
   selec[d]=i;
  }
}

 /*char sel[20];
 k=0;
 cout<<"\n\nSelect the names by alphabets seperated by commas : ";
 gets(sel);
 int selec[20];
 for(i=0;i<strlen(sel);i+=1)
 {
  if (sel[i]!=',')
  {
   selec[k++]=selec[i];
  }
 }
 for(i=0;i<=k;i+=1)
 puts(names[selec[i]]);
   */


 //cout<<"\n\nnow the d value is : "<<d;
 //getch();



// cout<<"\n\nthe selec[d] values are printed below\n\n";
// for(i=0;i<d+1;i+=1)
// {
//  cout<<"selec["<<i<<"] = "<<selec[i]<<"\n";
// }
// getch();

// cout<<"\n\nAll the names are : ";
// for(i=0;i<k;i+=1)
// puts(names[i]);

// getch();

 char seln[100][20];
 char usel[100][20];
		  k=0;
 cout<<"\n\nThe selected names are : ";
 for( i=0;i<d+1;i+=1)
 {
  cout<<"\n\n\n The selec[i] value is "<<selec[i];
  cout<<"\nSo the names[selec[i]] value is names["<<selec[i]<<"] is : ";
  puts(names[selec[i]]); strcpy(seln[k],names[selec[i]]);
  cout<<"Their respective mail id is : ";puts(username[selec[i]]);
  strcpy(usel[k],username[selec[i]]);
  k++;
}
nocont=k;
contct a;
for( i=0;i<k;i++)
{
  cout<<"\n\ncopying";
  strcpy(a.unamei[i],usel[i]);
  strcpy(a.namei[i],seln[i]);
}


 getch();
 cout<<" \n\nNow moving forward to creating your contacts file...";

 for ( i=0;i<strlen(uname);i+=1)
 uname[i]=tolower(uname[i]);

 cout<<"\n\nyour correct mail id : "<<uname;




 /**********process of making the file address************/


 char add[]="C:\\JG MSG\\login\\";

 strcat(add,uname);
 strcat(add,".jgs");

 cout<<"\n\nfile access address of the person : "<<add;

 info X1;
 ifstream fi(add,ios::binary);

 int flag=0;
 if (!fi)
 cout<<"\n\nthe person's file is not available...";
 else
 {
  cout<<"\n\nthe person's personal file is available....";
  fi.read((char*)&X1,sizeof(X1));
  flag=1;
 }
 fi.close();





 if(flag)
 {
  cout<<"\n\nthe person's name is : "; puts(X1.fname);
  cout<<"\nthe person's user login id is : "<<X1.id;



  /*****************now making the folder address of his files********/



  strcpy(add,"C:\\JG MSG\\USERS\\user");
  strcat(add,X1.id);
  strcat(add,"\\contacts.dat");
  ofstream cf;
  cf.open(add,ios::binary);
  cf.write((char*)&a,sizeof(a));



  }


 }
void control::searchinformation()               //查询职工信息
{
    employee *p1=NULL,*p2=NULL;
    p1=head;
    if(p1==NULL)
    {
    	gotoxy(38,20);
        cout<<"系统暂无信息,无法查询,请录入信息!"<<endl;
        Sleep(3000);
        return;
    }
    int i;                 //选择变量
    do
    {
    	system("cls");
    	gotoxy(25,5);
        cout<<"==================================================================="<<endl;
        cout<<"\t\t\t|                                                                 |"<<endl;
        cout<<"\t\t\t|                            请选择查询方式                       |"<<endl;
        cout<<"\t\t\t|               1、按照编号                 2、按照姓名           |"<<endl;
        cout<<"\t\t\t|               3、按照部门                 4、按照职务           |"<<endl;
        cout<<"\t\t\t|                            5、返回上级菜单                      |"<<endl;
        cout<<"\t\t\t|                                                                 |"<<endl;
        cout<<"\t\t\t|                             请选择相应编号:                     |"<<endl;
        cout<<"\t\t\t==================================================================="<<endl;
        while(1)
        {
            char temp[100];
            gotoxy(70,12);
			cin>>temp;
            i=temp[0]-48;
            if(i>5||i==0)
            {
            gotoxy(25,15);
			cout<<"========================输入错误请重新输入========================="<<endl;
			Sleep(2000);
			gotoxy(25,15);
			cout<<"                                                                   "<<endl;
			}
            else break;
        }
        gotoxy(30,15);
        switch(i)
        {
        case 1:
        {
            int num;
            cout<<"\t\t编号:";
            cin>>num;
            p1=head;
            while(p1!=NULL)
            {
                if(p1->num==num)
                    break;
                else
                {
                    p2=p1;
                    p1=p1->next;
                }
            }
            if(p1!=NULL)
			{                          //若找到结点
                cout<<"\t\t\t职工信息为:"<<endl<<endl<<(*p1)<<endl;
                getch();
			}
            else
            {
                cout<<"\t\t\t该职工信息不存在!"<<endl;
                Sleep(1500);
            }
        }
        break;
        case 2:
        {
            char name[20];
            cout<<"姓名:";
            cin>>name;
            p1=head;
            while (p1!=NULL)
            {
                if (strcmp(p1->name,name)==0)                     break;
                else
                {
                    p2=p1;
                    p1=p1->next;
                }
            }
            if (p1!=NULL)//若找到结点
			{              
                cout<<(*p1)<<endl;
                getch();
            }
            else
            {
                cout<<"\t\t\t信息查询失败!"<<endl;
                Sleep(1500);
            }
        }
        break;
        case 3:
        {
            char department[20];
            int m=0;
            cout<<"部门:";
            cin>>department;
            p1=head;
            while (p1!=NULL)
            {
                if (strcmp(p1->department,department)==0)
                {
                    cout<<(*p1)<<endl;
                    p2=p1;
                    p1=p1->next;
                    m++;
                }
                else
                {
                    p2=p1;
                    p1=p1->next;
                }
            }
            if (m==0)
            {
                cout<<"\t\t\t信息查询失败!"<<endl;
                Sleep(1500);
        	}
			getch();
        }
        break;
        case 4:
        {
            int job;
            int n=0;
            cout<<"\t\t\t职务:";
            cin>>job;
            p1=head;
            while (p1!=NULL)
            {
                if (p1->job==job)
                {
                    cout<<(*p1)<<endl;
                    p2=p1;
                    p1=p1->next;
                    n++;
                }
                else
                {
                    p2=p1;
                    p1=p1->next;
                }
            }
            if (n==0)
            {
                cout<<"\t\t\t查询失败!"<<endl;
                 Sleep(1500);
            }
            getch();
        }
        break;
        case 5:
            return;
        }
    }
    while (i!=5);
}
Example #7
0
void CaenVmeIrqCheck(int32_t BHandle, man_par_t *man)
{
CVErrorCodes	ret ;

con_printf(" CHECK IRQ\n");

CAENVME_IRQCheck(BHandle,&man->irqstat);		// Check IRQ Status

con_printf(" IRQ status: %02X\n",man->irqstat);
con_printf(" Interrupt Level to Acknowledge (0 to exit) : ");  // Get the int level   
con_scanf("%x",&man->level); 

if (man->level == 0)
	{
    clear_line(Y_COMM);
    clear_line(Y_COMM+1);
    clear_line(Y_COMM+2);
	return ;
    }

con_printf_xy(X_COMM,Y_COMM+2," Waiting for interrupt ... Press any key to stop.");

while (!(man->irqstat & (1<<(man->level-1))) && !con_kbhit())   // Check Int loop
	CAENVME_IRQCheck(BHandle,&man->irqstat);

gotoxy(X_COMM,Y_COMM) ;

if(man->irqstat & (1<<(man->level-1)))
  {
    CVIRQLevels level;
    switch (man->level) {
            case 1:
                    level = cvIRQ1;
                    break;
            case 2:
                    level = cvIRQ2;
                    break;
            case 3:
                    level = cvIRQ3;
                    break;
            case 4:
                    level = cvIRQ4;
                    break;
            case 5:
                    level = cvIRQ5;
                    break;
            case 6:
                    level = cvIRQ6;
                    break;
            case 7:
                    level = cvIRQ7;
                    break;
            default:
                    level = cvIRQ1;
                    break;
    }
    ret = CAENVME_IACKCycle(BHandle,level,&man->data,man->dtsize);
    
	switch (ret)
		{
		case cvSuccess   : con_printf(" Cycle completed normally\n");							    
						   con_printf(" Int. Ack. on IRQ%d: StatusID = %0X",man->level,man->data);
						   break ;
		case cvBusError	 : con_printf(" Bus Error !!!");
						   break ;				   
		case cvCommError : con_printf(" Communication Error !!!");
							   break ;
		default          : con_printf(" Unknown Error !!!");
						   break ;


        }
	}
else
	con_printf(" Interrupt request IRQ%d not active",man->level);
     
}
Example #8
0
void scr3x3()
{
	gotoxy(13.5,8);
	printf("�����������������ͻ");
	gotoxy(13.5,9);
	printf("�     �     �     �");
	gotoxy(13.5,10);
	printf("�  %c  �  %c  �  %c  �",ch[7],ch[8],ch[9]);
	gotoxy(13.5,11);
	printf("�     �     �     �");
	gotoxy(13.5,12);
	printf("�����������������͹");
	gotoxy(13.5,13);
        printf("�     �     �     �");
	gotoxy(13.5,14);
	printf("�  %c  �  %c  �  %c  �",ch[4],ch[5],ch[6]);
	gotoxy(13.5,15);
	printf("�     �     �     �");
	gotoxy(13.5,16);
	printf("�����������������͹");
	gotoxy(13.5,17);
        printf("�     �     �     �");
	gotoxy(13.5,18);
	printf("�  %c  �  %c  �  %c  �",ch[1],ch[2],ch[3]);
	gotoxy(13.5,19);
	printf("�     �     �     �");
	gotoxy(13.5,20);
	printf("�����������������ͼ");
}
Example #9
0
void maingame3x3()
{
		while(gameover != 1)
		{
			if((nextplayer == 1)&&(gameover == 0))
			{
				mainscr();
				scr3x3();
				gotoxy(72,11);
				printf("%s", name[0]);
				gotoxy(46,19);
				printf("What Box? ");
				{
					scanf("%d", &box);

					if((box < 1)||(box > 9))
					{
						mainscr();
						scr3x3();
						gotoxy(46,19);
						printf("Input Error");
						gotoxy(45,20);
						printf("Input Box 1-9.");
						gotoxy(45,21);
						printf("Press Any Key...");
						getch();
						nextplayer = 1;
					}

					else

					if((box > 1)||(box < 9))
					{
						if(((ch[box] == 'x')||(ch[box] == 'o'))&&(cheats == 0))
						{
							mainscr();
							scr3x3();
							gotoxy(46,19);
							printf("Input Error");
							gotoxy(45,20);
							printf("Input in an empty box.");
							gotoxy(45,21);
							printf("Press Any Key...");
							getch();
							nextplayer = 1;
						}

						else

						if((ch[box] != 'x')||(ch[box] != 'o'))
						{
							ch[box] = 'x';

							{
								if(((ch[1] == 'x')||(ch[1] == 'o'))&&((ch[2] == 'x')||(ch[2] == 'o'))&&((ch[3] == 'x')||(ch[3] == 'o'))&&((ch[4] == 'x')||(ch[4] == 'o'))&&((ch[5] == 'x')||(ch[5] == 'o'))&&((ch[6] ==
'x')||(ch[6] == 'o'))&&((ch[7] == 'x')||(ch[7] == 'o'))&&((ch[8] == 'x')||(ch[8] == 'o'))&&((ch[9] == 'x')||(ch[9] == 'o')))
								{
									strcpy(winner,"None");
									draw = draw + 1;
									gameover = 1;
								}


								if(ch[1] == 'x')
								{
									if((ch[2] == 'x') && (ch[3] == 'x'))
									{
										strcpy(winner,name[0]);
										wins[0] = wins[0] + 1;
										lose[1] = lose[1] + 1;
										gameover = 1;
									}
								}

								if(ch[4] == 'x')
								{
									if((ch[5] == 'x')&&(ch[6] == 'x'))
									{
										strcpy(winner,name[0]);
										wins[0] = wins[0] + 1;
										lose[1] = lose[1] + 1;
										gameover = 1;
									}
								}

								if(ch[7] == 'x')
								{
									if((ch[8] == 'x')&&(ch[9] == 'x'))
									{
										strcpy(winner,name[0]);
										wins[0] = wins[0] + 1;
										lose[1] = lose[1] + 1;
										gameover = 1;
									}
								}

								if(ch[1] == 'x')
								{
									if((ch[4] == 'x')&&(ch[7] == 'x'))
									{
										strcpy(winner,name[0]);
										wins[0] = wins[0] + 1;
										lose[1] = lose[1] + 1;
										gameover = 1;
									}
								}

								if(ch[2] == 'x')
								{
									if((ch[5] == 'x')&&(ch[8] == 'x'))
									{
										strcpy(winner,name[0]);
										wins[0] = wins[0] + 1;
										lose[1] = lose[1] + 1;
										gameover = 1;
									}
								}

								if(ch[3] == 'x')
								{
									if((ch[6] == 'x')&&(ch[9] == 'x'))
									{
										strcpy(winner,name[0]);
										wins[0] = wins[0] + 1;
										lose[1] = lose[1] + 1;
										gameover = 1;
									}
								}

								if(ch[5] == 'x')
								{
									if((ch[1] == 'x')&&(ch[9] == 'x'))
									{
										strcpy(winner,name[0]);
										wins[0] = wins[0] + 1;
										lose[1] = lose[1] + 1;
										gameover = 1;
									}
								}

                                              			if(ch[5] == 'x')
								{
									if((ch[3] == 'x')&&(ch[7] == 'x'))
									{
										strcpy(winner,name[0]);
										wins[0] = wins[0] + 1;
										lose[1] = lose[1] + 1;
										gameover = 1;
									}
								}
							}

							nextplayer = 2;
						}
					}
				}
			}

			if((nextplayer == 2)&&(gameover == 0))
			{
				mainscr();
				scr3x3();
				gotoxy(72,11);
				printf("%s", name[1]);
				gotoxy(46,19);
				printf("What Box? ");
				{
					scanf("%d", &box);

					if((box < 1)||(box > 9))
					{
						mainscr();
						scr3x3();
						gotoxy(46,19);
						printf("Input Error");
						gotoxy(45,20);
						printf("Input Box 1-9.");
						gotoxy(45,21);
						printf("Press Any Key...");
						getch();
						nextplayer = 2;
					}

					else

					if((box < 9)||(box > 1))
					{
						if(((ch[box] == 'x')||(ch[box] == 'o'))&&(cheats == 0))
						{
							mainscr();
							scr3x3();
							gotoxy(46,19);
							printf("Input Error");
							gotoxy(45,20);
							printf("Input in an empty box.");
							gotoxy(45,21);
							printf("Press Any Key...");
							getch();
							nextplayer = 2;
						}

						else

						if((ch[box] != 'x')||(ch[box] != 'o'))
						{
							ch[box] = 'o';

	                                        	{
								if(((ch[1] == 'x')||(ch[1] == 'o'))&&((ch[2] == 'x')||(ch[2] == 'o'))&&((ch[3] == 'x')||(ch[3] == 'o'))&&((ch[4] == 'x')||(ch[4] == 'o'))&&((ch[5] == 'x')||(ch[5] == 'o'))&&((ch[6] ==
'x')||(ch[6] == 'o'))&&((ch[7] == 'x')||(ch[7] == 'o'))&&((ch[8] == 'x')||(ch[8] == 'o'))&&((ch[9] == 'x')||(ch[9] == 'o')))
								{
									strcpy(winner,"None");
									draw = draw + 1;
									gameover = 1;
								}


								if(ch[1] == 'o')
								{
									if((ch[2] == 'o') && (ch[3] == 'o'))
									{
										strcpy(winner,name[1]);
										wins[1] = wins[1] + 1;
										lose[0] = lose[0] + 1;
										gameover = 1;
									}
								}

								if(ch[4] == 'o')
								{
									if((ch[5] == 'o')&&(ch[6] == 'o'))
									{
										strcpy(winner,name[1]);
										wins[1] = wins[1] + 1;
										lose[0] = lose[0] + 1;
										gameover = 1;
									}
								}

								if(ch[7] == 'o')
								{
									if((ch[8] == 'o')&&(ch[9] == 'o'))
									{
										strcpy(winner,name[1]);
										wins[1] = wins[1] + 1;
										lose[0] = lose[0] + 1;
										gameover = 1;
									}
								}

								if(ch[1] == 'o')
								{
									if((ch[4] == 'o')&&(ch[7] == 'o'))
									{
										strcpy(winner,name[1]);
										wins[1] = wins[1] + 1;
										lose[0] = lose[0] + 1;
										gameover = 1;
									}
								}

								if(ch[2] == 'o')
								{
									if((ch[5] == 'o')&&(ch[8] == 'o'))
									{
										strcpy(winner,name[1]);
										wins[1] = wins[1] + 1;
										lose[0] = lose[0] + 1;
										gameover = 1;
									}
								}

								if(ch[3] == 'o')
								{
									if((ch[6] == 'o')&&(ch[9] == 'o'))
									{
										strcpy(winner,name[1]);
										wins[1] = wins[1] + 1;
										lose[0] = lose[0] + 1;
										gameover = 1;
									}
								}

								if(ch[5] == 'o')
								{
									if((ch[1] == 'o')&&(ch[9] == 'o'))
									{
										strcpy(winner,name[1]);
										wins[1] = wins[1] + 1;
										lose[0] = lose[0] + 1;
										gameover = 1;
									}
								}

								if(ch[5] == 'o')
								{
									if((ch[3] == 'o')&&(ch[7] == 'o'))
									{
										strcpy(winner,name[1]);
										wins[1] = wins[1] + 1;
										lose[0] = lose[0] + 1;
										gameover = 1;
									}
								}

							}

							nextplayer = 1;
						}
					}
				}
			}
		}
		mainscr();
		scr3x3();
		gotoxy(46,19);
		printf("Winner: %s!",winner);
		if(stricmp(winner,"None") == 0)
		{
			mainscr();
			scr3x3();
			gotoxy(46,19);
			printf("Game Draw!");
		}
		gotoxy(45,20);
		printf("Press Any Key...");
		getch();
}
Example #10
0
void ruchKursorOperacje(wezel *adresListy,unsigned int *kolumnaAdres,unsigned int *wierszAdres)// ruch kursora podczas operacji kopiuj wklej
{

    char znak,buf[ROZMIAR_BUF_KOPIOWANIA];
    unsigned int kolumna,wiersz,licznikKopiowaniaStartX=0,licznikKopiowaniaStartY=0;
    int znakSpec=0,flaga=1,flagaWartoscBuf=0,licznikKopiowania=0; //flaga -> pokazuje czy kursor zostal zablokowany:0/nie zablokowany: 1
    char z=219;//przypisanie kodu ASCII całej zamalowanej komórki konsoli
    CONSOLE_CURSOR_INFO ci;//urywanie kursora
    HANDLE hC=GetStdHandle(STD_OUTPUT_HANDLE);
    GetConsoleCursorInfo(hC, &ci);
    ci.bVisible=1;//wyswietlenie kurosra
    SetConsoleCursorInfo(hC, &ci);
    OpcjeWOperacjach();
    wypiszTekst(adresListy,kolumnaAdres,wierszAdres);
    adresListy=adresListy->glowa;
    adresListy=przejdDoWiersza(adresListy,-1,kolumnaAdres,wierszAdres);
    kolumna=*kolumnaAdres;
    wiersz=*wierszAdres;
    buf[licznikKopiowania]='\0';
    while ((znak=getch())!=27)
    {
        gotoxy(0,7);
        printf(ZAMARZTESKST);
        gotoxy(0,7);
        printf("Status bufora: ");
        if (flagaWartoscBuf==0)//wypisanie stanu bufora
            printf("PUSTY");
        else if(licznikKopiowania<ROZMIAR_BUF_KOPIOWANIA-1)
            printf("CZESCIOWO ZAPELNIONY");
        else
            printf("PELNY");
        if (znak==-32)//znak specjalny np strzalki przekirowanie do obslugi ich
        {

            znakSpec=1;
            continue;
        }//end if
        if (znakSpec==1&&flaga==1)//mozliwosc ruchu kursorem jezeli nie zaczeto zaznaczania i jezeli jest potwierdzenie wcisniecia znaku specjalnego(strzalki)
        {
            switch(znak)
            {
            case 72:
            {
                if (wiersz>0)
                {
                    wiersz--;
                    adresListy=adresListy->poprz;
                    kolumna=adresListy->nrKolumny;
                }
                break;

            }//end case 72
            case 80:
            {
                if (adresListy->nast!=NULL)
                {
                    wiersz++;
                    adresListy=adresListy->nast;
                    kolumna=adresListy->nrKolumny;
                }
                break;

            }//end case 80
            case 75:
            {
                if(kolumna>0)
                    kolumna--;
                else if(adresListy->poprz!=NULL)
                {
                    wiersz--;
                    adresListy=adresListy->poprz;
                    kolumna=adresListy->nrKolumny;
                }
                break;
            }
            case 77:
            {
                if(kolumna<adresListy->nrKolumny)
                    kolumna++;
                else if(adresListy->nast!=NULL)
                {
                    wiersz++;
                    adresListy=adresListy->nast;
                    kolumna=0;
                }
                break;
            }

            }//end switch
            licznikKopiowaniaStartX=kolumna;//poczatek zaznaczania kolumna
            licznikKopiowaniaStartY=wiersz;//poczatek zaznaczania wiersz
            gotoxy(kolumna,wiersz+WYSOKOSC_MENU_GORNEGO);
            znakSpec=0;
            // continue;
        }//end if
        else
        {
            do
            {
                if (flaga==0)
                    znak=getch();
                switch(znak)
                {
                case '+':
                {
                    if (licznikKopiowania<ROZMIAR_BUF_KOPIOWANIA-1)// zeby nie przekroczyc tablicy przechowujaca przekopiowany tekst
                    {
                        gotoxy(kolumna,WYSOKOSC_MENU_GORNEGO+wiersz);
                        printf("%c",z);
                        if (adresListy->tabZnak[kolumna]!='\0')
                        {
                            kopiuj(buf,licznikKopiowania,adresListy->tabZnak[kolumna]);
                            licznikKopiowania++;
                        }
                        else if(adresListy->nast!=NULL)
                        {
                            kopiuj(buf,licznikKopiowania,' ');
                            licznikKopiowania++;
                        }

                        if(kolumna<adresListy->nrKolumny)
                            kolumna++;
                        else if(adresListy->nast!=NULL)
                        {
                            wiersz++;
                            adresListy=adresListy->nast;
                            kolumna=0;
                        }
                        flaga=0;
                        flagaWartoscBuf=1;
                    }
                    break;
                }//end case +
                case '-':
                {

                    if(kolumna>0)
                    {
                        licznikKopiowania--;
                        kolumna--;
                    }

                    else if(adresListy->poprz!=NULL)
                    {
                        licznikKopiowania--;
                        wiersz--;
                        adresListy=adresListy->poprz;
                        kolumna=adresListy->nrKolumny;
                    }//end else if
                    if (licznikKopiowania<0)
                    {
                        flaga=1;
                        flagaWartoscBuf=0;
                        //licznikKopiowania=0;
                    }
                    buf[licznikKopiowania]='\0';
                    gotoxy(kolumna,WYSOKOSC_MENU_GORNEGO+wiersz);
                    printf("%c",adresListy->tabZnak[kolumna]);
                    break;
                }//end case -
                case 'v':
                {
                    if(flaga==1)
                    {
                        wklej(adresListy,buf,kolumna,wiersz);
                        system("cls");
                        OpcjeWOperacjach();
                        wypiszTekst(adresListy,kolumnaAdres,wierszAdres);
                        gotoxy(kolumna,WYSOKOSC_MENU_GORNEGO+wiersz);
                    }
                    break;
                }
                case 'c':
                {
                    flaga=1;
                    break;
                }
                case 'f':
                {
                    system("cls");
                    OpcjeWOperacjach();
                    licznikKopiowania=0;
                    buf[licznikKopiowania]='\0';
                    flagaWartoscBuf=0;
                    wypiszTekst(adresListy,kolumnaAdres,wierszAdres);
                    gotoxy(kolumna,WYSOKOSC_MENU_GORNEGO+wiersz);
                    flaga=1;
                    break;
                }
                case 'x':
                {
                    wytnij(adresListy,buf,licznikKopiowaniaStartX,licznikKopiowaniaStartY,licznikKopiowania);
                    system("cls");
                    OpcjeWOperacjach();
                    wypiszTekst(adresListy,kolumnaAdres,wierszAdres);
                    gotoxy(kolumna,WYSOKOSC_MENU_GORNEGO+wiersz);
                    flaga=1;
                    break;
                }
                }//end switch
            }
            while(flaga==0);
        }//end else
    }//end while
    system("cls");
    PasekOpcjiGorny();
}
Example #11
0
void wybierz(wezel *wsk,unsigned int *znakNumer,unsigned int *wierszNumer, int wybor,char *zapis,char *odczyt,int *flaga)
//przechodzimy do funcji która wskaże jaka opcja w menu została wybrana
//argumenty funkcji to adres listy,licznik kolumn-znakNumer, licznik wierszy,sciezka zapisu pliku, odczytu pliku i flaga określająca zmianae tekstu z nowy plik na kontynułuj edycje
{
    wezel *adresPrzejsciaDoWybranejListy,*AdresPomocniczy=wsk;
    int nrWiersza;
    int nrKol=0,znaleziono=0;//znaleziono- licznik do wypisywania wyników w kolejnym wierszu przy wyszukiwaniu
    char tekstWyszukaj[30],znakWybor=80,pozycjaStrz=-1;//pozycjaStr wykorzystywane w menu opcji
    CONSOLE_CURSOR_INFO ci;//urywanie kursora
    HANDLE hC=GetStdHandle(STD_OUTPUT_HANDLE);
    GetConsoleCursorInfo(hC, &ci);
    ci.bVisible=0;
    SetConsoleCursorInfo(hC, &ci);
    switch(wybor)
    {
    case 0://EDYCJA
    {
        nrWiersza=-1;//przejscie do ostatniej lini
        /* AdresPomocniczy=wsk->glowa;
         while(AdresPomocniczy->nast!=NULL)
             AdresPomocniczy=AdresPomocniczy->nast;*/
        adresPrzejsciaDoWybranejListy=przejdDoWiersza(wsk,nrWiersza,znakNumer,wierszNumer);
        //nr wierszza okresla do którego wiersza ma przejść -1 oznacza przejscie do ostatniego wiersza, reszta to polozenie kursora
        system("cls");
        OpcjeWEdycji();
        pobierzZnakWsrodkuListy(wsk,adresPrzejsciaDoWybranejListy,znakNumer,wierszNumer,flaga);//pobiera znaki
        break;
    }
    case 1://ZAPIS
    {
        PasekOpcjiGorny();
        if(zapiszPlik(zapis,wsk))
            gprintf("Plik zapisany poprawnie!",WysrodkujTekst("Plik zapisany poprawnie!"),7);
        else
            gprintf("Plik nie zostal zapisany!",WysrodkujTekst("Plik nie zostal zapisany!"),7);
        break;
    }
    case 2://WCZYTANIE
    {
        if ((wsk->nast!=NULL)||(wsk->nrKolumny!=0))
        {
            gprintf("Nie mozna wczytywac pliku podczas edycji!",WysrodkujTekst("Nie mozna wczytywac pliku podczas edycji!"),7);
            break;
        }
        else   if(odczytZpliku(odczyt,wsk,znakNumer,wierszNumer))
            gprintf("Plik wczytany poprawnie!",WysrodkujTekst("Plik wczytany poprawnie!"),7);
        else
            gprintf("Plik nie zostal wczytany!",WysrodkujTekst("Plik nie zostal wczytany!"),7);
        break;
    }
    case 3://USUNIECIE
    {
        zapiszPlik("temp.txt",wsk);//zapisanie do pliku tymczasowego
        gprintf("Edycje zakonczono, praca zostala usunieta!",WysrodkujTekst("Edycje zakonczono, praca zostala usunieta!"),7);
        wyczyscListe(wsk,znakNumer,wierszNumer,flaga);//czyszczenie listy
        break;
    }
    case 4://PRZEJDZ DO WIERSZA
    {
        ci.bVisible=1;//widocznosc kursora
        SetConsoleCursorInfo(hC, &ci);
        gprintf("PRZEJDZ DO WIERSZA",WysrodkujTekst("Przejd do wiersza"),5);
        gprintf("Zatwierdz - ENTER",0,WYSOKOSC_MENU_GORNEGO-2);
        AdresPomocniczy=wsk->glowa;
        gprintf("Zakres wierszy ",WysrodkujTekst("Zakres wierszy: od %i do %i     "),7);
        while(AdresPomocniczy->nast!=NULL)//liczy ile wierszow sie znajduje na liscie
            AdresPomocniczy=AdresPomocniczy->nast;
        printf("od 1 do %i",AdresPomocniczy->nrWiersza+1);
        gprintf("Ustaw kurosor na koniec wiersza nr: ",WysrodkujTekst("Ustaw kurosor na koniec wiersza i wcisnij ENTER: "),8);
        scanf("%i",&nrWiersza);
        nrWiersza--;//zmiejszamy o 1 bo indeksowanie jest od 0
        if ((nrWiersza>AdresPomocniczy->nrWiersza)||(0==AdresPomocniczy->nrWiersza)) //wlaczenie zwyklej edycji
        {
            if (AdresPomocniczy->nrWiersza!=nrWiersza+1) //brak wyswietlania komunikatu przy ostatni wersie
            {
                gotoxy(WysrodkujTekst("Brak wiersza nr: %i za 3 sek przejscie do ostatniego wiersza"),21);
                printf("Brak wiersza nr: %i za 3 sek przejscie do ostatniego wiersza!!!",nrWiersza+1);
                Sleep(3000);
            }
            system("cls");
            OpcjeWEdycji();
            adresPrzejsciaDoWybranejListy=przejdDoWiersza(wsk,nrWiersza,znakNumer,wierszNumer);
            pobierzZnakWsrodkuListy(wsk,adresPrzejsciaDoWybranejListy,znakNumer,wierszNumer,flaga);
            break;
        }
        else
        {
            adresPrzejsciaDoWybranejListy=przejdDoWiersza(wsk,nrWiersza,znakNumer,wierszNumer);
            system("cls");
            PasekOpcjiGorny();
            OpcjeWEdycji();
            pobierzZnakWsrodkuListy(wsk,adresPrzejsciaDoWybranejListy,znakNumer,wierszNumer,flaga);
        }
        break;
    }
    case 5://WYSUKAJ
    {
        ci.bVisible=1;
        SetConsoleCursorInfo(hC, &ci);
        gprintf("WYSUKAJ",WysrodkujTekst("WYSZUKAJ"),5);
        gprintf("Zatwierdz - ENTER",0,WYSOKOSC_MENU_GORNEGO-2);
        gotoxy(WysrodkujTekst("Podaj tekst jaki chcesz wyszukac max 30 znakow: "),7);
        printf("Podaj tekst jaki chcesz wyszukac max 30 znakow: ");
       // fscanf(stdin,"%s",tekstWyszukaj);
        gets(tekstWyszukaj);//pobieranie ze spacja
        wsk=wsk->glowa;
        nrWiersza=0;
        gotoxy(0,WYSOKOSC_MENU_GORNEGO);
        while (wsk!=NULL)
        {
            nrKol=wyszukaj(wsk->tabZnak,tekstWyszukaj,30);

            if (nrKol>-1)
            {
                printf("Znaleziony wyraz znajduje sie w kolumnie: %i w wierszu: %i\n",nrKol,wsk->nrWiersza);
                znaleziono++;
            }
            wsk=wsk->nast;
        }
        if (znaleziono==0)
            gprintf("Nie znaleziono frazy!",WysrodkujTekst("Nie znaleziono frazy!"),14+znaleziono);
        gprintf("Wcisnij jakis klawisz...",WysrodkujTekst("Wcisnij jakis klawisz..."),16+znaleziono);
        getch();//przytrzymuje widok wyików
        system("cls");
        break;
    }
    case 6://OPERACJE
    {
        system("cls");
        ruchKursorOperacje(wsk,znakNumer,wierszNumer);//ruch kursorem przy operacjach
        break;
    }
    case 7://OPCJE
    {
        system("cls");
        PasekOpcjiGorny();
        gprintf("OPCJE",WysrodkujTekst("OPCJE"),5);
        MENU_OPCJE
        while (znakWybor!=27)
        {
            gprintf("    ",31,21+pozycjaStrz);
            switch(znakWybor)
            {
            case 80:
            {
                if (pozycjaStrz<ROZMIAR_MENU_OPCJE-1)
                    pozycjaStrz++;//zmiana pozyji w menu na dół
                break;
            }//end 80:
            case 72:
            {
                if (pozycjaStrz>0)
                    pozycjaStrz--;//zmiana pozycji w menu na górę
                break;
            }//end 72:
            case 13:
            {
                system("cls");
                PasekOpcjiGorny();
                gprintf("OPCJE",WysrodkujTekst("OPCJE"),5);
                gprintf("Zatwierdz i wyjdz - ENTER",0,WYSOKOSC_MENU_GORNEGO-2);
                switch(pozycjaStrz)
                {
                case 0:
                {
                    ci.bVisible=1;
                    SetConsoleCursorInfo(hC, &ci);
                    gprintf("Bierzaca sciezka zapisu: ",WysrodkujTekst("Bierzaca sciezka zapisu                               "),7);
                    printf("%s",zapis);
                    gprintf("Podaj nowa sciezke: ",WysrodkujTekst("Podaj nowa sciezke                                "),WYSOKOSC_MENU_GORNEGO+7);
                    gets(zapis);
                    system("cls");
                    PasekOpcjiGorny();
                    gprintf("OPCJE",WysrodkujTekst("OPCJE"),5);
                    ci.bVisible=0;
                    SetConsoleCursorInfo(hC, &ci);
                    MENU_OPCJE//wypisanie tekstu przez makrodefinicje
                    break;
                }
                case 1:
                {
                    ci.bVisible=1;
                    SetConsoleCursorInfo(hC, &ci);
                    gprintf("Bierzaca sciezka odczytu: ",WysrodkujTekst("Bierzaca sciezka odczytu                               "),7);
                    printf("%s",odczyt);
                    gprintf("Podaj nowa sciezke: ",WysrodkujTekst("Podaj nowa sciezke                                "),WYSOKOSC_MENU_GORNEGO+7);
                    gets(odczyt);
                    system("cls");
                    PasekOpcjiGorny();
                    gprintf("OPCJE",WysrodkujTekst("OPCJE"),5);
                    ci.bVisible=0;
                    SetConsoleCursorInfo(hC, &ci);
                    MENU_OPCJE//wypisanie tekstu przez makrodefinicje
                    break;
                }
                case 2:
                {
                    ci.bVisible=1;
                    SetConsoleCursorInfo(hC, &ci);
                    gprintf("Bierzacy rozmiar bufora: ",WysrodkujTekst("Bierzacy rozmiar bufora:"),7);
                    printf("%i",ROZMIAR_BUF_KOPIOWANIA);
                    gprintf("Podaj nowa rozmiar bufora: ",WysrodkujTekst("Podaj nowa rozmiar bufora:"),WYSOKOSC_MENU_GORNEGO+7);
                    scanf("%i",&ROZMIAR_BUF_KOPIOWANIA);
                    fflush(stdin);
                    system("cls");
                    PasekOpcjiGorny();
                    gprintf("OPCJE",WysrodkujTekst("OPCJE"),5);
                    ci.bVisible=0;
                    SetConsoleCursorInfo(hC, &ci);
                    MENU_OPCJE//wypisanie tekstu przez makrodefinicje
                }//end case 2

                }//end switch
                break;
            }//end 13:
            }//end switch
            gotoxy(0,7);
            printf(ZAMARZTESKST);
            gotoxy(0,8);
            printf(ZAMARZTESKST);
            gprintf("Bierzaca sciezka zapisu: ",WysrodkujTekst("Bierzaca sciezka zapisu                               "),7);
            printf("%s",zapis);
            gprintf("Bierzaca sciezka zapisu: ",WysrodkujTekst("Bierzaca sciezka zapisu                               "),8);
            printf("%s",odczyt);
            gprintf(STEROWANIE_MENU_OPIS,0,WYSOKOSC_MENU_GORNEGO-2);
            gprintf("===>",31,21+pozycjaStrz);
            znakWybor=getch();
        }//end while
        gprintf("    ",31,21+pozycjaStrz);
        gprintf(ZAMARZTESKST,0,7);
        gprintf(ZAMARZTESKST,0,8);
        gprintf(ZAMARZTESKST,0,5);
        gprintf(ZAMARZTESKST,0,21+0);
        gprintf(ZAMARZTESKST,0,21+1);
        break;
    }
    case 8:
    {
        gprintf("Dziekujemy za korzystanie z naszego programu.",WysrodkujTekst("Dziekujemy za korzystanie z naszego programu."),15);
        Sleep(1500);
        exit(0);
        break;
    }
    default:
    {
        break;
    }
    }//end switch
}//end wybierz
Example #12
0
void pobierzZnakWsrodkuListy(wezel *adresListy,wezel *adresListyWybranegoWiersza,unsigned int *kolumnaAdres,unsigned int *wierszAdres,int *Edycja)
{
    CONSOLE_CURSOR_INFO ci;//urywanie kursora
    HANDLE hC=GetStdHandle(STD_OUTPUT_HANDLE);
    GetConsoleCursorInfo(hC, &ci);
    ci.bVisible=1;//wyswietlenie kurosra
    SetConsoleCursorInfo(hC, &ci);
    char znakPobrany;
    wezel *adresListyTymczasowy;
    int i;
    unsigned int wiersz=*wierszAdres,kolumna=*kolumnaAdres;
    wypiszTekst(adresListy,kolumnaAdres,wierszAdres);
    adresListy=adresListyWybranegoWiersza;
    kolumna=*kolumnaAdres;
    gotoxy(kolumna,WYSOKOSC_MENU_GORNEGO+adresListy->nrWiersza);
    int znakSpec=0;
    while ((znakPobrany=getch())!=27)
    {
        if (znakPobrany==-32)//znak specjalny np strzalki przekirowanie do obslugi ich
        {
            kolumna=kolumna;
            wiersz=wiersz;
            znakSpec=1;
            continue;
        }//end if
        if (znakSpec==1)
        {
            switch(znakPobrany)
            {
            case 72:
            {
                if (wiersz>0)
                {
                    wiersz--;
                    adresListy->nrKolumny=kolumna;
                    adresListy->tabZnak[kolumna]='\0';//przypisanie konca tekstu zeby nie wypisywalo smieci w ostatnim wierszu
                    adresListy=adresListy->poprz;
                    kolumna=adresListy->nrKolumny;
                }
                break;

            }//end case 72
            case 80:
            {
                if (adresListy->nast!=NULL)
                {
                    wiersz++;
                    adresListy->nrKolumny=kolumna;
                    adresListy->tabZnak[kolumna]='\0';
                    adresListy=adresListy->nast;
                    kolumna=adresListy->nrKolumny;
                }
                break;

            }//end case 72
            }//end switch
            gotoxy(kolumna,wiersz+WYSOKOSC_MENU_GORNEGO);
            znakSpec=0;
            continue;


        }//end if

        switch(znakPobrany)
        {
        case 8://usuwanie znaku
        {
            i=0;
            if(kolumna>0) //jak są 2 linie puste
            {
                kolumna--;
            }
            adresListy->tabZnak[kolumna]='\0';
            printf("\r%s",adresListy->tabZnak);
            printf(" ");
            printf("\r%s",adresListy->tabZnak);
            if (wiersz<0)
                break;//zabezpieczenie przed usuwaniem nieistniejacych elementow listy mniejszych od 0
            if(kolumna==0)
            {

                if ((adresListy->nast==NULL)&&(adresListy->nrWiersza!=0)) //jezeli kursor jest na ostatnim elemncie w ostatnim wierszu
                {
                    adresListy=adresListy->poprz;
                    kolumna=adresListy->nrKolumny;
                    wiersz--;
                    gotoxy(kolumna,WYSOKOSC_MENU_GORNEGO+wiersz);
                    free(adresListy->nast);
                    adresListy->nast=NULL;
                }
                else if ((adresListy->nrWiersza>0)) //jezeli kurosr nie jest na glowie listy usuwanie wezla
                {
                    adresListy=adresListy->poprz;
                    adresListyTymczasowy=adresListy;
                    adresListyTymczasowy=adresListyTymczasowy->nast;
                    adresListy->nast=adresListyTymczasowy->nast;
                    adresListy=adresListy->nast;
                    adresListy->poprz=adresListyTymczasowy->poprz;
                    free(adresListyTymczasowy);
                    adresListyTymczasowy=NULL;
                    adresListy=adresListy->poprz;//powrod na wczesniejszy elemnt
                    wiersz--;
                    kolumna=adresListy->nrKolumny;
                    gotoxy(adresListy->nrKolumny,wiersz);
                }

                adresListyTymczasowy=adresListy;
                i=adresListy->nrWiersza;
                while(adresListyTymczasowy->nast!=NULL)//przesuniecie tekstu w gore i usuniecie
                {
                    adresListyTymczasowy->nrWiersza=i;
                    gotoxy(0,WYSOKOSC_MENU_GORNEGO+adresListyTymczasowy->nrWiersza);//gdzie zmazac
                    printf(ZAMARZTESKST);//zmazanie tekstu
                    gotoxy(0,WYSOKOSC_MENU_GORNEGO+adresListyTymczasowy->nrWiersza);//gdzie napisac
                    printf("%s",adresListyTymczasowy->tabZnak);//napisanie na nowo
                    i++;
                    adresListyTymczasowy=adresListyTymczasowy->nast;
                }
                adresListyTymczasowy->nrWiersza=i;//ostatni element listy pominiety w petli
                gotoxy(0,WYSOKOSC_MENU_GORNEGO+adresListyTymczasowy->nrWiersza);//gdzie zmazac
                printf(ZAMARZTESKST);//zmazanie tekstu
                gotoxy(0,WYSOKOSC_MENU_GORNEGO+adresListyTymczasowy->nrWiersza);//gdzie napisac
                printf("%s",adresListyTymczasowy->tabZnak);//napisanie na nowo
                gotoxy(0,WYSOKOSC_MENU_GORNEGO+adresListyTymczasowy->nrWiersza+1);//gdzie zmazać
                printf(ZAMARZTESKST);
            }//end if
            break;
        }//end case 8:
        default:
        {

            if(kolumna<ROZMIAR_STRONY-1)
            {
                adresListy->tabZnak[kolumna]=znakPobrany;
                printf("%c",adresListy->tabZnak[kolumna]);
                kolumna++;
                if(kolumna<ROZMIAR_STRONY-1)//je¿eli nie przekroczymy wartosc tablicy, przejscie do nowej lini po wpisaniu ostatnigo znaku
                    break;
            }

        }
        case 13://przejscie do nowej lini
        {
            if (adresListy->nast==NULL)//jezeli jest ostatni element listy
            {

                adresListy->tabZnak[kolumna]='\0';
                adresListy->nrKolumny=kolumna;
                *kolumnaAdres=kolumna;
                adresListy=DodajWiersz(adresListy);//dodaje wiersz
                kolumna=0;
                wiersz++;
                printf("\n");
                // break;
            }//end if
            else//jezeli jest w srodku listy
            {
                adresListy->tabZnak[kolumna]='\0';//przypisanie konca tekstu
                adresListy->nrKolumny=kolumna;// przypisanie ile liter jest w wierszu
                *kolumnaAdres=kolumna;//orzekazanie przez wskaźnik wartosci
                adresListy=DodajWierszWsrodekListy(adresListy);//dodanie wiersza
                kolumna=0;//wyzerowanie kolumny - ilosc znakow jest równa 0
                adresListy->tabZnak[kolumna]='\0';//znak jako zabezpieczenie jezeli odrazu sie wcisnie enter
                wiersz++;
                adresListyTymczasowy=adresListy;
                gotoxy(0,WYSOKOSC_MENU_GORNEGO+adresListy->nrWiersza);
                printf(ZAMARZTESKST);
                printf("%s",adresListyTymczasowy->tabZnak);
                while(adresListyTymczasowy!=NULL)//przypiuje tekst po zmianie
                {
                    gotoxy(0,WYSOKOSC_MENU_GORNEGO+adresListyTymczasowy->nrWiersza);
                    printf(ZAMARZTESKST);
                    gotoxy(0,WYSOKOSC_MENU_GORNEGO+adresListyTymczasowy->nrWiersza);
                    printf("%s",adresListyTymczasowy->tabZnak);
                    adresListyTymczasowy=adresListyTymczasowy->nast;
                }//end while
                gotoxy(0,adresListy->nrWiersza);//wraca do polozenia kursora
                //break;
            }
            zapiszPlik("temp1.txt",adresListy);//zapisanie do pliku tymczasowego jako zabezpieczenie przed utratą danych po bledzie programu
            break;
        }//end case 13

        }//end switch
        gotoxy(kolumna,WYSOKOSC_MENU_GORNEGO+adresListy->nrWiersza);
        if (wiersz==0&&kolumna==0&&adresListy->nast!=NULL)// sprawdza czy są dalsze elementy listy jezeli są to ustawia flage na 1 zeby pisało dalej kontynułowanie edycji
        {
            *Edycja=1;
        }
    }//end while
    adresListy->tabZnak[kolumna]='\0';
    adresListy->nrKolumny=kolumna;
    system("cls");
    PasekOpcjiGorny();
    *kolumnaAdres=kolumna;
    *wierszAdres=wiersz;

}
Example #13
0
void gprintf(char *tekst,int x, int y)//wypisuje dany tekst w odpowiednim miejscu
{
    gotoxy(x,y);
    printf(tekst);
}
int main(void)
{
      char n;
      int x=10,y=10;
      clrscr();
      textbackground(0);
      ipn();
      Sleep(600);
      voca3();
      Sleep(1000);
      marco();
      textcolor(10);
      Sleep(200);
      textbackground(0);
      gotoxy(10,11);
      printf("Altas");
      Sleep(200);
      gotoxy(10,12);
      textbackground(0);
      printf("Bajas");
      Sleep(200);
      gotoxy(10,13);
      textbackground(0);
      printf("Modificaciones");
      Sleep(200);
      textbackground(0);
      gotoxy(10,14);
      printf("Consultas");
      Sleep(200);
      gotoxy(10,15);
      textbackground(0);
      printf("Reportes");
      Sleep(200);
      gotoxy(10,16);
      textbackground(0);
      printf("Salir");
      Sleep(500);
      about();

      do
      {
             n = tolower(getch());
             switch(n)
             {
                      case 'w':
                           if(y<=16 && y>=12)
                           {
                                    y=y-1;
                                    menu(&x,&y);
                                    about();
                           }
                           else
                           {
                               Beep(9000,300);
                               if(y==12)
                               {
                                        y=9;
                                        menu(&x,&y);
                                        about();
                               }
                           }
                           break;

                      case 's':
                           if(y<=15 && y>=10)
                           {
                                    y=y+1;
                                    menu(&x,&y);
                                    about();
                           }
                           
                           else
                           {
                               y=16;
                               Beep(9000,300);
                               menu(&x,&y);
                               about();
                           }
                           break;

                      case enter:
                           if(y==11)
                           {
                                    daralta();
                           }
                           if(y==12)
                           {
                                    darbaja();
                           }
                           if(y==13)
                           {
                                    modificaciones();
                           }
                           if(y==14)
                           {
                                    consultas();
                           }
                           if(y==15)
                           {
                                    reportes();
                           }
                           if(y==16)
                           {
                                    salir();
                           }
                           break;
                      
             }  
      }
      while(n !='v');
}
Example #15
0
main()
{
	int i,j,key,num,b[20],p;
 	char ch;
aa: 
	window(1,1,25,80);
	textbackground(LIGHTGREEN);
	textcolor(YELLOW);
	clrscr();
	fu(b);
	num=0;
	p=0;
	textcolor(LIGHTRED);
	gotoxy(18,1);
	cprintf("%c(UP) %c(DOWN) %c(LEFT) %c(RIGHT)",24,25,27,26);
	gotoxy(16,2);
	cprintf("Eat the numbers in your road whose sum is 7,");
	gotoxy(14,3);
	cprintf("and eat 7 in the end, then you will win the game!");
	textcolor(MAGENTA);
	for(i=4;i<21;i++)
		for(j=20;j<44;j++)
			if(k[i-4][j-20]==0)
			{
				gotoxy(j,i);
				cprintf("%c",219);
			}
			else if(k[i-4][j-20]!=1)
			{
				gotoxy(j,i);
				cprintf("%d",k[i-4][j-20]);
			}
	textcolor(YELLOW);
	i=5;
	j=21;
	gotoxy(j,i);
	cprintf("\1");
	gotoxy(33,5);
	cprintf("7");
	gotoxy(7,7);
	cprintf("num:%d",num);
	textcolor(WHITE);
	gotoxy(11,22);
	cprintf("Press any key to start game, Q key to quit...");
	ch=getch();
	if(ch=='Q'||ch=='q')
	{
		window(1,1,25,80);
		textbackground(BLACK);
		textcolor(LIGHTGRAY);
		clrscr();
		exit(0);
	}
	else
	{
		textcolor(YELLOW);
		gotoxy(11,22);
		cprintf("                                             ");
	}
	do
	{
		key=bioskey(0);
		sound(200);
		delay(1000);
		nosound();
		switch(key)
		{
			case DOWN:
			{
				if(k[i-4+1][j-20]==0)
					continue;
				if(k[i-4+1][j-20]!=1&&k[i-4+1][j-20]!=7&&en(b,i+j+1))
				{
					num+=k[i-4+1][j-20];
					b[p++]=i+j+1;
					gotoxy(7,7);
					cprintf("num:%d",num);
				}
				textcolor(YELLOW);
				gotoxy(j,i++);
				printf(" ");
				gotoxy(j,i);
				cprintf("\1");
				gotoxy(33,5);
				if(k[i-4][j-20]==7&&num==7)
					wingame();
				else if(num!=7&&k[i-4][j-20]==7)
				{
					lostgame(num);
					goto aa;
				}
				break; 
			}
			case UP:
			{
				if(k[i-4-1][j-20]==0)
					continue;
				if(k[i-4-1][j-20]!=1&&k[i-4-1][j-20]!=7&&en(b,i+j-1))
				{
					num+=k[i-4-1][j-20];
					b[p++]=i+j-1;
					gotoxy(7,7);
					cprintf("num:%d",num);
				}
				textcolor(YELLOW);
				gotoxy(j,i--);
				printf(" ");
				gotoxy(j,i);
				cprintf("\1");
				gotoxy(33,5);
				if(k[i-4][j-20]==7&&num==7)
					wingame();
				else if(num!=7&&k[i-4][j-20]==7)
				{
					lostgame(num);
					goto aa;
				}
				break; 
			}
			case LEFT:
			{
				if(k[i-4][j-20-1]==0)
					continue;
				if(k[i-4][j-20-1]!=1&&k[i-4][j-20-1]!=7&&en(b,i+j-1))
				{
					num+=k[i-4][j-20-1];
					b[p++]=i+j-1;
					gotoxy(7,7);
					cprintf("num:%d",num);
				}
				textcolor(YELLOW);
				gotoxy(j--,i);
				printf(" ");
				gotoxy(j,i);
				cprintf("\1");
				gotoxy(33,5);
				if(k[i-4][j-20]==7&&num==7)
					wingame();
				else if(num!=7&&k[i-4][j-20]==7)
				{
					lostgame(num);
					goto aa;
				}
				break; 
			}
			case RIGHT:
			{
				if(k[i-4][j-20+1]==0)
					continue;
				if(k[i-4][j-20+1]!=1&&k[i-4][j-20+1]!=7&&en(b,i+j+1))
				{
					num+=k[i-4][j-20+1];
					b[p++]=i+j+1;
					gotoxy(7,7);
					cprintf("num:%d",num);
				}
				textcolor(YELLOW);
				gotoxy(j++,i);
				printf(" ");
				gotoxy(j,i);
				cprintf("\1");gotoxy(33,5);
				if(k[i-4][j-20]==7&&num==7)
					wingame();
				else if(num!=7&&k[i-4][j-20]==7)
				{
					lostgame(num);
					goto aa;
				}
				break; 
			}
			default:
				continue;
		}
	}while(1);
}
Example #16
0
void scr4x4()
{
	gotoxy(10.5,6);
	printf("�����������������������ͻ");
	gotoxy(10.5,7);
	printf("�     �     �     �     �");
	gotoxy(10.5,8);
	printf("�  %c  �  %c  �  %c  �  %c  �",ch[13],ch[14],ch[15],ch[16]);
	gotoxy(10.5,9);
	printf("�     �     �     �     �");
	gotoxy(10.5,10);
	printf("�����������������������͹");
	gotoxy(10.5,11);
	printf("�     �     �     �     �");
	gotoxy(10.5,12);
	printf("�  %c  �  %c  �  %c  �  %c  �",ch[9],ch[10],ch[11],ch[12]);
	gotoxy(10.5,13);
	printf("�     �     �     �     �");
	gotoxy(10.5,14);
	printf("�����������������������͹");
	gotoxy(10.5,15);
	printf("�     �     �     �     �");
	gotoxy(10.5,16);
	printf("�  %c  �  %c  �  %c  �  %c  �",ch[5],ch[6],ch[7],ch[8]);
	gotoxy(10.5,17);
	printf("�     �     �     �     �");
	gotoxy(10.5,18);
	printf("�����������������������͹");
	gotoxy(10.5,19);
	printf("�     �     �     �     �");
	gotoxy(10.5,20);
	printf("�  %c  �  %c  �  %c  �  %c  �",ch[1],ch[2],ch[3],ch[4]);
	gotoxy(10.5,21);
	printf("�     �     �     �     �");
	gotoxy(10.5,22);
	printf("�����������������������ͼ");
}
Example #17
0
void main() {
    // clrscr
    uint8_t color;
    uint8_t bg;
    uint8_t x, y;
    uint8_t a;
    uint16_t b;
    char c;
    char *vram;
    unsigned char index;
    char buffer[20];
    unsigned char offs;

    // links, oben, rechts, unten
    window(3, 3, 30, 30);
    clrscr();
    for (color = 0; color < 16; color++) {
        textcolor(color);
        for (bg = 0; bg < 8; bg++) {
            textbackground(bg);
            cstbt(0x1b);
        }
        cputs("  Hello KC85!\r\n");
    }
    x = wherex();
    y = wherey();

    gotoxy(0, 3);
    delline();
    gotoxy(0, 5);
    delline();
    cputs("test");

    gotoxy(x, y);

    c = getche();
    putch(c);
    crlf();

    // kbhit

    textcolor(BROWN);
    clrscr();

    for (index = 0; index < 20; index++) {
        if ((index & 0x01) == 0x01)
            highvideo();
        else
            lowvideo();
        cputs("press key\r\n");
    }
    textcolor(WHITE);

    while (kbhit())
        cputs("you have touched key.\r\n");
    cputs("done\r\n");
    next();

    // delline
    cputs("This line will be deleted. press key.");
    getch();
    delline();
    cputs("Line deleted successfully.");
    getch();
    crlf();

    // inlin

    cputs("Zeug eingeben: ");
    offs = wherex();
    vram = inlin();
    vram += offs;
    crlf();

    index = 0;
    while (*vram != '\0') {
        buffer[index] = *vram;
        index++;
        vram++;
    }
    ahex(index);
    while (index > 0) {
        index--;
        ahex(buffer[index]);
        space();
    }
    next();
    crlf();

    // cgets
    cputs("Zeug eingeben: ");
    buffer[0] = 10;
    vram = cgets(buffer);
    crlf();
    delline();
    index = buffer[1];
    ahex(index);
    space();
    space();

    while (index > 0) {
        index--;
        ahex(*vram);
        space();
        vram++;
    }
    ahex(*vram);
    crlf();

    // add test
    a = sqr(100);
    b = puse(10, 10, 10);
    b = b + a;
    hlhx(b);
    crlf();
}
Example #18
0
main()

{
	clrscr();
	textbackground(BLACK);
	textcolor(LIGHTCYAN);

	for(loading = 0; loading <= 0; loading++)
	{
		delay(9999999);
		clrscr();
		printf("Loading TicTacToe %d%%...", loading);
	}

	delay(9999999);

	while(exiton != 1)
	{
		for(y = 0; y < 8; y ++)
		{
			x[y] = 32;
		}

		for(y = 1; y < 17; y ++)
		{
			ch[y] = 32;
		}
		
		mainscr();

		if(version == 1)
		{
			scr3x3();
		}
		else
		if(version == 2)
		{
			scr4x4();
		}

		gotoxy(46,19);
		printf("Enter Command: ");
		scanf("%d", &cmd);
		
		
		
		if(cmd == 0)
		{
			if(cheats == 0)
			{
				cheats = 1;
				strcpy(ce,"On ");
				mainscr();

				if(version == 1)
				{
					scr3x3();
				}
				else
				if(version == 2)
				{
					scr4x4();
				}

				gotoxy(46,19);
				printf("Cheats Activated!");
				gotoxy(45,20);
				printf("Press Any Key...");
				getch();
			}

			else

			if(cheats == 1)
			{
				cheats = 0;
				strcpy(ce,"Off");
				mainscr();

				if(version == 1)
				{
					scr3x3();
				}
				else
				if(version == 2)
				{
					scr4x4();
				}

				gotoxy(46,19);
				printf("Cheats Deactivated!");
				gotoxy(45,20);
				printf("Press Any Key...");
				getch();
			}
		}
		
		if(cmd == 1)
		{	
			game = 0;
			newgame = 0;
			cont = 0;
			gameover = 0;
			nextplayer = 1;

			for(box = 1; box < 17; box++)
			{
				ch[box] = ' ';
			}
			
			wins[0] = 0;
			wins[1] = 0;
			lose[0] = 0;
			lose[1] = 0;
			draw = 0;
			
			x[0] = 16;
			x[1] = 17;

			strcpy(name[0],"P1");
			strcpy(name[1],"P2");

			mainscr();
			gotoxy(46,19);
			printf("Enter Version: ");
			gotoxy(45,21);
			printf("Version 1: 3 by 3");
			gotoxy(45,22);
			printf("Version 2: 4 by 4");
			gotoxy(61,19);
			scanf("%d", &version);

			if((version == 1)||(version == 2))
			{
				game = 1;
				newgame = 1;
				mainscr();

				if(version == 1)
				{
					scr3x3();
				}
				else
				if(version == 2)
				{
					scr4x4();
				}		

				gotoxy(46,19);
				printf("Enter Name P1: ");	
				scanf("%s",name[0]);
				mainscr();

				if(version == 1)
				{
					scr3x3();
				}
				else
				if(version == 2)
				{
					scr4x4();
				}

				gotoxy(46,19);
				printf("Enter Name P2: ");	
				scanf("%s",name[1]);		
		
				if(version == 1)
				{
					maingame3x3();
				}
				else
				if(version == 2)
				{
					maingame4x4();
				}
			}
		
			else
			{
				mainscr();
				gotoxy(46,19);
				printf("Input Error");
				gotoxy(45,20);
				printf("Version 1 or 2 only please.");
				gotoxy(45,21);
				printf("Press Any Key...");
				getch();
			}
		}
		
		if(cmd ==2)
		{
			if(game != 0)
			{
				newgame = 0;
				cont = 1;
				gameover = 0;
				nextplayer = 1;
				game = game + 1;		

				for(box = 1; box < 17; box++)
				{
					ch[box] = ' ';
				}

				x[2] = 16;
				x[3] = 17;
			
				if(((wins[0] != 3)||(wins[1] != 3))||(game < 10))
				{
					if(version == 1)
					{
						maingame3x3();
					}
					else
					if(version == 2)
					{
						maingame4x4();
					}	
				}
			
				if(wins[0] == 3)
				{
					mainscr();

					if(version == 1)
					{
						scr3x3();
					}
					else
					if(version == 2)
					{
						scr4x4();
					}

					gotoxy(2,4);
					printf("Game Over!");
					gotoxy(2,5);
					printf("Winner: %s!",name[0]);
					gotoxy(46,19);
					printf("Press Any Key...");
					getch();
					wins[0] = 0;
					wins[1] = 0;
					lose[0] = 0;
					lose[1] = 0;
					draw = 0;
					newgame = 0;
					cont = 0;
					game = 0;
					nextplayer = 0;
					strcpy(name[0],"P1");
					strcpy(name[1],"P2");
				}
		
				else	

				if(wins[1] == 3)
				{
					mainscr();

					if(version == 1)
					{
						scr3x3();
					}
					else
					if(version == 2)
					{
						scr4x4();
					}

					gotoxy(2,4);
					printf("Game Over!");
					gotoxy(2,5);
					printf("Winner: %s!",name[1]);
					gotoxy(46,19);
					printf("Press Any Key...");
					getch();
					wins[0] = 0;
					wins[1] = 0;
					lose[0] = 0;
					lose[1] = 0;
					draw = 0;
					newgame = 0;
					cont = 0;
					game = 0;
					nextplayer = 0;
					strcpy(name[0],"P1");
					strcpy(name[1],"P2");
				}
			
				else

				if((game == 9)&&((wins[0] != 3)||(wins[1] != 3)))
				{
					mainscr();

					if(version == 1)
					{
						scr3x3();
					}
					else
					if(version == 2)
					{
						scr4x4();
					}

					gotoxy(2,4);
					printf("Game Over!");
					gotoxy(2,5);
					printf("It's A Draw!");
					gotoxy(45,19);
					printf("Press Any Key...");
					getch();
					wins[0] = 0;
					wins[1] = 0;
					lose[0] = 0;
					lose[1] = 0;
					draw = 0;	
					newgame = 0;
					cont = 0;
					game = 0;
					nextplayer = 0;
					strcpy(name[0],"P1");
					strcpy(name[1],"P2");
				}
			}
			
			else
			{
				mainscr();

				if(version == 1)
				{
					scr3x3();
				}
				else
				if(version == 2)
				{
					scr4x4();
				}

				gotoxy(46,19);
				printf("Input Error");
				gotoxy(45,20);
				printf("Cannot continue, try a new game.");
				gotoxy(45,21);
				printf("Press Any Key...");
				getch();
			}
		
		}
		
		if(cmd == 3)
		{
			x[4] = 16;
			x[5] = 17;
			mainscr();
			gotoxy(2,4);
			printf("You need to match 'x' or 'o' in a line.");
			gotoxy(2,5);
			printf("You must score 3 points in 9 games to win.");
			gotoxy(2,7);
			printf("Tic Tac Toe Version 2.8");
			gotoxy(2,8);
			printf("-Fixed 'continue bug'.");
			gotoxy(2,9);
			printf("-Created new 4 by 4 Tic Tac Toe.");
			gotoxy(2,10);
			printf("-New Interface");
			gotoxy(2,11);
			printf("-Fixed 'no output 4 by 4 bug'.");
			gotoxy(2,12);
			printf("-Fixed 2.7 Bugs & Errors.");
			gotoxy(2,13);
			printf("-Created condition for '4 by 4 game over'.");
			gotoxy(2,14);
			printf("-Fixed '4 by 4 draw bug.");
			gotoxy(2,16);
			printf("Beta Testers:");
			gotoxy(2,17);
			printf("-Reed");
			gotoxy(2,18);
			printf("-Byn");
			gotoxy(2,20);
			printf("If you found bugs:");
			gotoxy(2,21);
			printf("E-mail me @ [email protected]");
			gotoxy(46,19);
			printf("Press Any Key...");
			getch();	
		}
		
		if(cmd == 4)
		{
			x[6] = 16;
			x[7] = 17;
			exiton = 1;
		}
		
		if((cmd > 4)||(cmd < 0))
		{
			mainscr();

			if(version == 1)
			{
				scr3x3();
			}
			else
			if(version == 2)
			{
				scr4x4();
			}

			gotoxy(46,19);
			printf("Input Error");
			gotoxy(46,20);
			printf("Enter Command  (1-4).");
			gotoxy(46,21);
			printf("Press Any Key...");
			getch();
		}
	}	
	
	wins[0] = 0;
	wins[1] = 0;
	lose[0] = 0;
	lose[1] = 0;
	draw = 0;
	strcpy(name[0],"P1");
	strcpy(name[1],"P2");	
	game = 0;
	newgame = 0;
	cont = 0;
	mainscr();

	gotoxy(46,19);
	printf("Press Any Key To Exit...");
	getch();
}
Example #19
0
int main(int argc,char *argv[])
{
	if(argc < 2) {
		gnPlayerIndex = 0;
	}
	else {
		gnPlayerIndex = atoi(argv[1]);
	}

	printf("ready player %d \r\n",gnPlayerIndex);
	

//소켓 연결 시도...
	struct sockaddr_in server;

	socket_desc = socket(AF_INET,SOCK_STREAM,0);
	if(socket_desc == -1)
	{
		puts("err create socket");
	}
	server.sin_addr.s_addr = inet_addr("127.0.0.1");
	server.sin_family = AF_INET;
	server.sin_port = htons(8080);
	if(connect(socket_desc,(struct sockaddr *)&server,sizeof(server)) < 0) {
		puts("connect error");
		return 1;
	}

	puts("connect ok!");
//쓰레드 기동 ..
	{
		int err = pthread_create(&tid,NULL,&InputThread,NULL);
		if(err != 0) {
			printf("err : %s \r\n",strerror(err));
		}
		else {
			printf("thread create success \r\n");
		}
	}

	{
		int err = pthread_create(&tid,NULL,&ListenThread,NULL);
		if(err != 0) {
			printf("err : %s \r\n",strerror(err));
		}
		else {
			printf("thread create success \r\n");
		}
	}

	puts("system ready!");
	sleep(3);

//게임 리소스 로딩 
	for(int i=0;i<2;i++)
	{
		map_init(&gScreenBuf[i]);
		map_new(&gScreenBuf[i],60,30);
	}

	map_init(&gPlayerModel);
	map_load(&gPlayerModel,"plane1.dat");

	map_init(&gPlaneBulletModel);
	map_load(&gPlaneBulletModel,"bullet1.dat");

	map_init(&gPotal);
	map_load(&gPotal,"potal.dat");

	map_init(&gAlienModel);
	map_load(&gAlienModel,"alien.dat");

	map_init(&gPlasmaModel);
	map_load(&gPlasmaModel,"plasma.dat");

    Plane_init(&gPlayerObject[0],&gPlayerModel,5,25);
	gPlayerObject[0].m_nFSM = 1;

    Plane_init(&gPlayerObject[1],&gPlayerModel,50,25);
	gPlayerObject[1].m_nFSM = 1;

	Potal_init(&gPlayerPotal,&gPotal,1,1);

    for(int i=0;i<sizeof(gPlaneBulletObjects)/sizeof(_S_PLANE_BULLET_OBJECT);i++){
		plane_bullet_init(&gPlaneBulletObjects[i],0,0,0,&gPlaneBulletModel);
	}

	for(int i=0;i<sizeof(gPlasmaObjects)/sizeof(_S_BULLET_OBJECT);i++){
		bullet_init(&gPlasmaObjects[i],0,0,0,&gPlasmaModel);
	}

    double TablePosition[]={0,10,20,30,40,50,60};

	for(int i=0;i<6;i++){
		_S_ALIEN_OBJECT *pObj=&gAlienObjects[i];
		alien_init(pObj,&gAlienModel);
		pObj->m_fXpos=TablePosition[i];
		pObj->m_fYpos=5;
		pObj->m_nFSM=1;
		gAlienObjects[i].m_pBullet=&gPlasmaObjects[i];

	}

	puts("object setup ok!");
	sleep(1);

	system("clear");

	set_conio_terminal_mode();
	acc_tick=last_tick=0;

	while(bLoop) {
		//타이밍처리 
		clock_gettime(CLOCK_MONOTONIC,&work_timer);
		double cur_tick = work_timer.tv_sec + 
			(double)(work_timer.tv_nsec * 1e-9);
		double delta_tick = cur_tick - last_tick;
		last_tick = cur_tick;

        for(int i=0;i<sizeof(gPlaneBulletObjects)/sizeof(_S_PLANE_BULLET_OBJECT);i++) {
			_S_PLANE_BULLET_OBJECT *pObj=&gPlaneBulletObjects[i];
			pObj->pfApply(pObj,delta_tick);

		}

		for(int i=0;i<6;i++ ){
			_S_ALIEN_OBJECT *pObj=&gAlienObjects[i];
			pObj->pfApply(pObj,delta_tick);

		}

		// _S_Potal_Bullet_Object *pObj=&gPotalBulletObject;
		// 	if(pObj->m_nFSM==0){
        //             double potal_bullet_posx=gPlayerPotal.m_nXpos;
        //             double potal_bullet_posy=gPlayerPotal.m_nYpos;

        //             double target_x=gPlayerObject[0].m_fXpos;
        //             double target_y=gPlayerObject[0].m_fYpos;

		// 			double vx=target_x-potal_bullet_posx;
        //             double vy=target_y-potal_bullet_posy;

        //             double dist=sqrt(vx*vx+vy*vy);
        //             vx/=dist; vy/=dist;

		// 			Potal_Bullet_Fire(&gPotalBulletObject,gPlayerPotal.m_nXpos,gPlayerPotal.m_nYpos,10,vx,vy,10.0);
		// 	}

		//총알 맞았을때 게임오버
		for(int i=0;i<sizeof(gPlasmaObjects)/sizeof(_S_BULLET_OBJECT);i++) {
			if(gPlasmaObjects[i].m_nFSM!=0) {
				
				double bullet_posx=gPlasmaObjects[i].m_fXpos;
				double bullet_posy=gPlasmaObjects[i].m_fYpos;

				double target_posx=gPlayerObject[0].m_fXpos;
				double target_posy=gPlayerObject[0].m_fYpos;

				double vx=target_posx-bullet_posx;
				double vy=target_posy-bullet_posy;

				double dist=sqrt(vx*vx+vy*vy);

				if(dist<0.1) {
					gPlasmaObjects[i].m_nFSM=0;
					gPlayerObject[0].m_nFSM=0;
					gAlienObjects[i].m_nFSM=0;
					system("clear");
					printf("----------------------\r\n");
					printf("      Game over\r\n");
					printf("----------------------\r\n");

					bLoop=0;
				}
			}
		}

		//alien 총알 맞았을때
		for(int i=0;i<sizeof(gPlaneBulletObjects)/sizeof(_S_PLANE_BULLET_OBJECT);i++) {
			if(gPlaneBulletObjects[i].m_nFSM!=0) {
				double bullet_posx=gPlaneBulletObjects[i].m_fXpos;
				double bullet_posy=gPlaneBulletObjects[i].m_fYpos;

				double target_posx= gAlienObjects[i].m_fXpos;
				double target_posy= gAlienObjects[i].m_fYpos;

				double vx=target_posx-bullet_posx;
				double vy=target_posy-bullet_posy;
				double dist=sqrt(vx*vx+vy*vy);

				if(dist<5.0) {
					gAlienObjects[i].m_nFSM=0;
				}
			}
		}	

		for(int i=0;i<sizeof(gPlasmaObjects)/sizeof(_S_BULLET_OBJECT);i++) {
			gPlasmaObjects[i].pfApply(&gPlasmaObjects[i],delta_tick);

		}

		Potal_Bullet_Apply(&gPotalBulletObject,delta_tick);

        //충돌여부확인-거리계산
        {
            double potal_bullet_posx=gPlayerPotal.m_nXpos;
            double potal_bullet_posy=gPlayerPotal.m_nYpos;

            double target_x=gPlayerObject[0].m_fXpos;
            double target_y=gPlayerObject[0].m_fYpos;

            double angle=0;
    		angle+=(delta_tick*45);
	    	double rad=(angle/180.0)*PI;

			double vx=(target_x-potal_bullet_posx)*cos(rad)-(target_y-potal_bullet_posy)*sin(rad);
			double vy=(target_x-potal_bullet_posx)*sin(rad)+(target_y-potal_bullet_posy)*cos(rad);
		
            double dist=sqrt(vx*vx+vy*vy);

            if(dist<0.1){
                gPotalBulletObject.m_nFSM=0;
            }
         }

        acc_bullet_delay_tick+=delta_tick;
		if(acc_bullet_delay_tick>2.0){	//2초동안 방향설정

			acc_bullet_delay_tick=0;

			double bullet_posx=gPotalBulletObject.m_fXpos;
			double bullet_posy=gPotalBulletObject.m_fYpos;

			double target_posx=gPlayerObject[0].m_fXpos;
			double target_posy=gPlayerObject[0].m_fYpos;

			double vx=target_posx-bullet_posx;
			double vy=target_posy-bullet_posy;

			double dist=sqrt(vx*vx+vy*vy);

			vx/=dist; vy/=dist;

			gPotalBulletObject.m_fvx=vx;
			gPotalBulletObject.m_fvy=vy;
		}

		//타이밍 계산 
		acc_tick += delta_tick;
		if(acc_tick > 0.1) {
			gotoxy(0,0);
			map_drawTile(&gScreenBuf[0],0,0,&gScreenBuf[1]);
			
			for(int i=0;i<2;i++){
		    	gPlayerObject[i].pfDraw(&gPlayerObject[i],&gScreenBuf[1]);
            }

			Potal_Draw(&gPlayerPotal,&gScreenBuf[1]);
			Potal_Bullet_Draw(&gPotalBulletObject,&gScreenBuf[1]);

            for(int i=0;i<sizeof(gPlaneBulletObjects)/sizeof(_S_PLANE_BULLET_OBJECT);i++){
				_S_PLANE_BULLET_OBJECT *pObj = &gPlaneBulletObjects[i];
				pObj->pfDraw(pObj,&gScreenBuf[1]);
			}

            for(int i=0;i<6;i++) {
				_S_ALIEN_OBJECT *pObj = &gAlienObjects[i];
				pObj->pfDraw(pObj,&gScreenBuf[1]);
			}

			for(int i=0;i<sizeof(gPlasmaObjects)/sizeof(_S_BULLET_OBJECT);i++){
				gPlasmaObjects[i].pfDraw(&gPlasmaObjects[i],&gScreenBuf[1]);
			}
			
			puts("------------------------------------------------------------\r");
			map_dump(&gScreenBuf[1],Default_Tilepalete);
			puts("------------------------------------------------------------\r");

			puts("move :  w,  a,  s,  d \r");
            puts("player0 fire : j   player1 fire : k");
			puts("quit : q \r");
			acc_tick = 0;
		}

	}

	return 0;

}
main()
{
 int i,j,x,y,loop=0,loop1,string_number;
 char ch;
 FILE *fp,*fp1;

 window(1,7,80,10);
 for(i=0;i<78;i++)
 {  gotoxy(i+1,1); printf("ÍÍ"); gotoxy(i+1,4); printf("ÍÍ");  }
 for(i=0;i<4;i++)
 {  gotoxy(1,i+1); printf("º"); gotoxy(80,i+1);  printf("º");  }

 gotoxy(1,1);  printf("ÉÍ");  gotoxy(79,1);  printf("Í»");
 gotoxy(1,4); printf("ÈÍ");  gotoxy(79,4); printf("ͼ");
 window(3,8,78,9); textbackground(01); textcolor(12);  clrscr();

   gotoxy(4,1); textcolor(YELLOW); cprintf("RTL LAN for WRITE MAC");
   gotoxy(4,2); cprintf("LAN_ID=");
   scanf("%s",&all_1);
   string_number=strlen(all_1);
   if(string_number!=12)
   { gotoxy(35,2); cprintf("Above 12bit,Please try again!");
     delay(3000); spawnl(P_WAIT,"makemac.exe",NULL); exit(1); }

   fp=fopen(template,"r");
Example #21
0
void CaenVmeWriteBlt(int32_t BHandle, man_par_t *man)
{
int					nb;
uint32_t			i,incr ;
CVAddressModifier	am;
CVErrorCodes		ret,old_ret=cvSuccess;


if(man->am == cvA16_U)
	{
    con_printf(" Can't execute a A16 BLT Write Cycle");
	return ;
	}
if(man->am == cvCR_CSR)
	{
    con_printf(" Can't execute a CR/CSR BLT Write Cycle");
	return ;
	}

con_printf_xy(X_COMM,Y_COMM+2," First Data [hex] : ") ;
con_scanf("%x",&man->data);					// Get data to write 
clear_line(Y_COMM+2) ;
con_printf_xy(X_COMM,Y_COMM+2," Data Increment [hex] : ") ; // Get increment for data
con_scanf("%x",&incr);  
for(i=0; i<(man->blts/4); i++)				// Fill the data buffer
	man->buff[i] = man->data+incr*i;

if (man->dtsize == cvD64)
	{
	if (man->am == cvA24_U_DATA)
		am = cvA24_U_MBLT;
	else 
		am = cvA32_U_MBLT;
	}
else
	{
	if (man->am == cvA24_U_DATA)
		am = cvA24_U_BLT;
	else 
		am = cvA32_U_BLT;
	}

if(man->ncyc == 0)				// Infinite Loop
	con_printf_xy(X_COMM,Y_COMM+2," Running ...    Press any key to stop.");

for (i=0; ((man->ncyc==0) || (i<man->ncyc)) && !con_kbhit(); i++)
	{

	ret = CAENVME_BLTWriteCycle(BHandle,man->addr,(char *)man->buff,man->blts,am,man->dtsize,&nb);
        		
	if((i==0) || (ret != old_ret))
		{
		gotoxy(X_COMM,Y_COMM) ;

		switch (ret)
			{
			case cvSuccess   : con_printf(" Cycle(s) completed normally\n");
							   con_printf(" Written %u bytes",nb);
							   break ;
			case cvBusError	 : con_printf(" Bus Error !!!\n");
							   con_printf(" Written %u bytes",nb);
							   break ;				   
			case cvCommError : con_printf(" Communication Error !!!");
							   break ;
			default          : con_printf(" Unknown Error !!!");
							   break ;
			}
		}
       
	old_ret = ret;

    } 
    
if(man->ncyc == 0)
	clear_line(Y_COMM+2);
}
//-----------------------------------------------------------------------
void fontcon::convert()
{
	
	for(int i=0,j=0;indata[j]!='\0'&&i<29998&&j<24950;i++,j++)
		{
				if(indata[j]=='/'&&indata[j+1]=='k')
				{
					outdata[i]='Ì';
					j++;
				}

					else if(indata[j]=='\"'&&indata[j+1]=='k')
				{
					outdata[i]='Ô';
					j++;
				}

				else if(indata[j]=='{'&&indata[j+1]=='k')
				{
					outdata[i]='Õ';
					j++;
				}
				else if(indata[j]=='g'&&indata[j+1]=='~'&&indata[j+2]=='o')
				{
					outdata[i]='à';
					j++;
					j++;
				}
				else if(indata[j]=='g'&&indata[j+1]=='z')
				{
					outdata[i]='Ð';
					j++;
				}
				else if(indata[j]=='v'&&indata[j+1]=='k'&&indata[j+2]=='S')
				{
					outdata[i]='Ñ';
					j+=2;
				}
				else if(indata[j]=='n'&&indata[j+1]=='~'&&indata[j+2]=='x')
				{
					outdata[i]='å';
					j+=2;
				}
				else if(indata[j]==','&&indata[j+1]=='W')
				{
					outdata[i]='Ê';
					j++;
				}
				else if(indata[j]=='F'&&indata[j+1]=='k')
				{
					outdata[i]='É';
					j++;
				}



				else if(indata[j]=='.'&&indata[j+1]=='k')
				{
					outdata[i]='Æ';
					j++;
				}
				else if(indata[j]=='['&&indata[j+1]=='k')
				{
					outdata[i]='Â';
					j++;
				}
				else if(indata[j]=='v'&&indata[j+1]=='k')
				{
					outdata[i]='Á';
					j++;
				}
				else if(indata[j]=='­'&&indata[j+1]=='®')
				{
					outdata[i]='k';
					i++;
					outdata[i]='s';
					j++;
				}
				else if(indata[j]=='Å'&&indata[j+1]=='¡')
				{
					outdata[i]='¬';
					j++;
				}

				else
				{
			switch(indata[j])
				{
				case '®':outdata[i]='¨';break;
				case 'Ê':outdata[i]='h';i++;outdata[i]='Z';break;
				case 'Ï':outdata[i]='ì';break;
				case '÷':outdata[i]='Ö';break;
				case 'ø':outdata[i]='¿';break;
				case 'ù':outdata[i]='ö';break;
				case 'Œ':outdata[i]='0';break;
				case 'Š':outdata[i]='8';break;
				case 'Ÿ':outdata[i]='Ù';break;
				case 'ƒ':outdata[i]='1';break;
				case 'ˆ':outdata[i]='6';break;
				case '˜':outdata[i]='ö';break;
				case '–':outdata[i]='n';i++;outdata[i]='`';break;
				case '—':outdata[i]='d';i++;outdata[i]='`';break;
				case '‚':outdata[i]='k';i++;outdata[i]='W';break;
				case '„':outdata[i]='2';break;
				case '†':outdata[i]='4';break;
				case '‡':outdata[i]='5';break;
				case '…':outdata[i]='3';break;
				case '‰':outdata[i]='7';break;
				case '‹':outdata[i]='9';break;
				case '›':outdata[i]='S';i++;outdata[i]='Z';i++;outdata[i]='a';break;
				case '™':outdata[i]='U';i++;outdata[i]='U';break;
				case '“':outdata[i]='\'';break;
				case '”':outdata[i]='\'';break;
				case '‘':outdata[i]='\"';break;
				case '’':outdata[i]='\"';break;

				case '!':outdata[i]='!';break;
				case '\"':outdata[i]='\"';break;
				case '#':outdata[i]='#';break;
				case '$':outdata[i]='$';break;
				case '%':outdata[i]='%';break;
				case '&':outdata[i]='&';break;
				case '\'':outdata[i]='\'';break;
				case '(':outdata[i]='(';break;
				case ')':outdata[i]=')';break;
				case '*':outdata[i]='*';break;
				case '+':outdata[i]='+';break;
				case ',':outdata[i]=',';break;
				case '-':outdata[i]='-';break;
				case '.':outdata[i]='.';break;
				case '/':outdata[i]='/';break;
				case '0':outdata[i]='0';break;
				case '1':outdata[i]='1';break;
				case '2':outdata[i]='2';break;
				case '3':outdata[i]='3';break;
				case '4':outdata[i]='4';break;
				case '5':outdata[i]='5';break;
				case '6':outdata[i]='6';break;
				case '7':outdata[i]='7';break;
				case '8':outdata[i]='8';break;
				case '9':outdata[i]='9';break;
				case ':':outdata[i]=':';break;
				case ';':outdata[i]=';';break;
				case '<':outdata[i]='<';break;
				case '=':outdata[i]='=';break;
				case '>':outdata[i]='>';break;
				case '?':outdata[i]='?';break;
				case '@':outdata[i]='@';break;
				case 'A':outdata[i]='A';break;
				case 'B':outdata[i]='B';break;
				case 'C':outdata[i]='C';break;
				case 'D':outdata[i]='D';break;
				case 'E':outdata[i]='E';break;
				case 'F':outdata[i]='F';break;
				case 'G':outdata[i]='G';break;
				case 'H':outdata[i]='H';break;
				case 'I':outdata[i]='I';break;
				case 'J':outdata[i]='J';break;
				case 'K':outdata[i]='K';break;
				case 'L':outdata[i]='L';break;
				case 'M':outdata[i]='M';break;
				case 'N':outdata[i]='N';break;
				case 'O':outdata[i]='O';break;
				case 'P':outdata[i]='P';break;
				case 'Q':outdata[i]='Q';break;
				case 'R':outdata[i]='R';break;
				case 'S':outdata[i]='S';break;
				case 'T':outdata[i]='T';break;
				case 'U':outdata[i]='U';break;
				case 'V':outdata[i]='V';break;
				case 'W':outdata[i]='W';break;
				case 'X':outdata[i]='X';break;
				case 'Y':outdata[i]='Y';break;
				case 'Z':outdata[i]='Z';break;
				case '[':outdata[i]='[';break;
				case '\\':outdata[i]='\\';break;
				case ']':outdata[i]=']';break;
				case '^':outdata[i]='^';break;
				case '_':outdata[i]='_';break;
				case '`':outdata[i]='`';break;
				case 'a':outdata[i]='a';break;
				case 'b':outdata[i]='b';break;
				case 'c':outdata[i]='c';break;
				case 'd':outdata[i]='d';break;
				case 'e':outdata[i]='e';break;
				case 'f':outdata[i]='f';break;
				case 'g':outdata[i]='g';break;
				case 'h':outdata[i]='h';break;
				case 'i':outdata[i]='i';break;
				case 'j':outdata[i]='j';break;
				case 'k':outdata[i]='k';break;
				case 'l':outdata[i]='l';break;
				case 'm':outdata[i]='m';break;
				case 'n':outdata[i]='n';break;
				case 'o':outdata[i]='o';break;
				case 'p':outdata[i]='p';break;
				case 'q':outdata[i]='q';break;
				case 'r':outdata[i]='r';break;
				case 's':outdata[i]='s';break;
				case 't':outdata[i]='t';break;
				case 'u':outdata[i]='u';break;
				case 'v':outdata[i]='v';break;
				case 'w':outdata[i]='w';break;
				case 'x':outdata[i]='x';break;
				case 'y':outdata[i]='y';break;
				case 'z':outdata[i]='z';break;
				case '{':outdata[i]='{';break;
				case '|':outdata[i]='|';break;
				case '}':outdata[i]='}';break;
				case '~':outdata[i]='~';break;
				case '¡':outdata[i]='¡';break;
				case '¢':outdata[i]='s';break;
				case '£':outdata[i]='[';i++;outdata[i]='k';i++;outdata[i]='z';break;
				case 'Æ':outdata[i]='£';break;
				case '¤':outdata[i]='¤';break;
				case '¥':outdata[i]='´';break;

				case '§':outdata[i]='¤';break;
				case '¨':outdata[i]='¨';break;
				case '©':outdata[i]='©';break;
				case 'ª':outdata[i]='ª';break;
				case '«':outdata[i]='×';break;

				case '±':outdata[i]='±';break;
				case '³':outdata[i]='³';break;
				case '´':outdata[i]='´';break;

				case '¶':outdata[i]='¶';break;
				case '·':outdata[i]='·';break;
				case '¸':outdata[i]='¸';break;
				case 'º':outdata[i]='º';break;
				case '»':outdata[i]='»';break;
				case '¼':outdata[i]='¼';break;
				case '½':outdata[i]='½';break;
				case '¾':outdata[i]='¾';break;
				case '¿':outdata[i]='¿';break;
				case 'À':outdata[i]='À';break;
				case 'Á':outdata[i]='i';i++;outdata[i]='z';break;
				case 'Ã':outdata[i]='Ã';break;
				case 'Ä':outdata[i]='Ä';break;
				case 'Å':outdata[i]='Å';break;

				case 'Ç':outdata[i]='f';i++;outdata[i]='a';break;
				case 'È':outdata[i]='h';i++;outdata[i]='a';break;
				case 'É':outdata[i]='²';break;
				case 'Ê ':outdata[i]='h';i++;outdata[i]='Z';break;
				case 'Ë':outdata[i]='/';break;
				case 'Ì':outdata[i]='í';break;
				case 'Í':outdata[i]='ê';break;
				case 'Î':outdata[i]='ë';break;
				case 'Ñ':outdata[i]='d';i++;outdata[i]='`';break;
				case 'Ò':outdata[i]='Ò';break;
				case 'Ó':outdata[i]='î';break;
				case '\'k':outdata[i]='Ó';break;
				case 'Ô':outdata[i]='ï';break;
				case 'Ö':outdata[i]='Ö';break;

				case 'Ø':outdata[i]='Ø';break;
				case 'Ù':outdata[i]='Ù';break;
				case 'Ú':outdata[i]='Ú';break;
				case 'Û':outdata[i]='Û';break;
				case 'Ü':outdata[i]='Ü';break;
				case 'Ý':outdata[i]='Ý';break;
				case 'Þ':outdata[i]='Þ';break;
				case 'ß':outdata[i]='ß';break;
				case 'à':outdata[i]='g';i++;outdata[i]='~';i++;outdata[i]='u';break;
				case 'á':outdata[i]='á';break;
				case 'â':outdata[i]='â';break;
				case 'ã':outdata[i]='ã';break;
				case 'ä':outdata[i]='ä';break;
				case 'å':outdata[i]='0';break;
				case 'æ':outdata[i]='æ';break;
				case 'ç':outdata[i]='ç';break;
				case 'è':outdata[i]='è';break;
				case 'é':outdata[i]='é';break;
				case 'ê':outdata[i]='ê';break;
				case 'ë':outdata[i]='ë';break;
				case 'ì':outdata[i]='ì';break;
				case 'í':outdata[i]='í';break;
				case 'î':outdata[i]='î';break;
				case 'ï':outdata[i]='ï';break;
				case 'ð':outdata[i]='B';i++;outdata[i]='~';i++;outdata[i]='B';break;

				case 'ñ':outdata[i]='ñ';break;
				case 'ò':outdata[i]='ò';break;
				case 'ó':outdata[i]='ó';break;
				case 'ô':outdata[i]='ô';break;
				case 'õ':outdata[i]='S';i++;outdata[i]='Z';i++;outdata[i]='a';break;

				case 'ö':outdata[i]='ö';break;
				case'\t':outdata[i]='\t';break;
				case 10:outdata[i]=10;break;
				case ' ':outdata[i]=' ';break;
				default: outdata[i]='\t';stat.wrong++;break;
				}
		}
		{
				textcolor(LIGHTGRAY);
				gotoxy(39,17);
				cprintf("%d",stat.wrong);
				gotoxy(39,16);
				cprintf("%d",j+1);
				gotoxy(39,18);
				cprintf("%.2f %       ",float((100-(float(stat.wrong)/(j+1))*100)));
		}
		}
	outdata[i]='\0';
}
Example #23
0
void CaenVmeManual(int32_t BHandle, short first_call)
{	

static  man_par_t	man	;
char				key,dis_main_menu ;
uint32_t			value ;


if (first_call)
	{								// Default Value 
	man.addr = 0xEE000000 ;      
	man.level = 1 ;           
	man.am = cvA32_U_DATA ;            
	man.dtsize = cvD16 ;        
	man.basaddr = 0xEE000000 ; 
	man.blts = 256 ;          
	man.ncyc = 1 ;            
	man.autoinc = 0 ;  
	
	// Allocate 32K for the software buffer containing data for blt 

    man.buff = (uint32_t *)malloc(16*1024*1024);
    if (man.buff == NULL)
		{
		con_printf(" !!! Error. Can't allocate memory for BLT buffer. ");
		exit(-1);
		}
	}

for (;;)
	{
	dis_main_menu = 0 ;

	clrscr() ;

	dis_main_menu = 0 ;

	con_printf("\n     CAEN VME Manual Controller \n\n") ;

	con_printf(" R - READ\n") ;
	con_printf(" W - WRITE\n") ;
	con_printf(" B - BLOCK TRANSFER READ\n") ;
	con_printf(" T - BLOCK TRANSFER WRITE\n") ;
	con_printf(" I - CHECK INTERRUPT\n") ;
	con_printf(" 1 - ADDRESS                  [%08"PRIX32"]\n",man.addr) ;
	con_printf(" 2 - BASE ADDRESS             [%08"PRIX32"]\n",man.basaddr) ;
	con_printf(" 3 - DATA FORMAT              [") ; 
	if (man.dtsize == cvD8)
		con_printf("D8]\n") ; 
	if (man.dtsize == cvD16)
		con_printf("D16]\n") ; 
	if (man.dtsize == cvD32)
		con_printf("D32]\n") ; 
	if (man.dtsize == cvD64)
		con_printf("D64]\n") ; 
           
	con_printf(" 4 - ADDRESSING MODE          [") ;  
	if (man.am == cvA16_U)
		con_printf("A16]\n") ; 
	if (man.am == cvA24_U_DATA)
		con_printf("A124]\n") ; 
	if (man.am == cvA32_U_DATA)
		con_printf("A32]\n") ; 
	if (man.am == cvCR_CSR)
		con_printf("CR/CSR]\n") ; 
     
	con_printf(" 5 - BLOCK TRANSFER SIZE      [%"PRIu32"]\n",man.blts) ;
	con_printf(" 6 - AUTO INCREMENT ADDRESS   [") ; 
	if (man.autoinc)
		con_printf("ON] \n") ;
	else
		con_printf("OFF]\n") ;

	con_printf(" 7 - NUMBER OF CYCLES         [") ;
	if (man.ncyc)
		con_printf("%d]\n",man.ncyc) ; 
	else
		con_printf("Infinite\n") ;
		   		         
	con_printf(" 8 - VIEW BLT DATA\n") ;          
	con_printf(" F - FRONT PANEL I/O\n") ; 
	con_printf(" Q - QUIT MANUAL CONTROLLER\n") ; 


	do
		{
		gotoxy(X_COMM,Y_COMM) ;

		key = toupper(con_getch()) ;

		clear_line(Y_COMM) ;
		clear_line(Y_COMM+1) ;
		clear_line(Y_COMM+2) ;
		gotoxy(X_COMM,Y_COMM) ;

		switch (key)  
			{
			case  'R' :	CaenVmeRead(BHandle, &man) ;
						break ;	

			case  'W' : CaenVmeWrite(BHandle, &man) ; 
						break ;

			case  'B' : CaenVmeReadBlt(BHandle, &man) ; 
						break ;

			case  'T' : CaenVmeWriteBlt(BHandle, &man) ;
						break ;

			case  'I' : CaenVmeIrqCheck(BHandle, &man) ;
						break ;

			case  '1' : con_printf(" Please enter new Address : ") ;

						if (con_scanf("%"SCNx32,&value) != EOF)
							man.addr = man.basaddr + value ;

						con_printf_xy(X_ADDR,Y_ADDR,"%08"PRIX32,man.addr) ;
						clear_line(Y_COMM) ;

						break ;

			case  '2' :	con_printf(" Please enter new Base Address : ") ;

						if (con_scanf("%"SCNx32,&value) != EOF)
							{
                            man.addr -= man.basaddr ;   
							man.basaddr = value ;
							man.addr += man.basaddr ;
							}

						con_printf_xy(X_BADDR,Y_BADDR,"%08"PRIX32,man.basaddr) ;
						con_printf_xy(X_ADDR,Y_ADDR,"%08"PRIX32,man.addr) ;

						clear_line(Y_COMM) ;

						break ;

			case  '3' : gotoxy(X_DSIZE,Y_DSIZE) ;

						switch(man.dtsize)
							{
							case cvD8  : man.dtsize = cvD16 ;
									  	 con_printf("D16]\n") ;
										 break ;	
							case cvD16 : man.dtsize = cvD32 ;
										 con_printf("D32]\n") ;
										 break ;	
							case cvD32 : man.dtsize = cvD64 ;
										 con_printf("D64]\n") ;
										 break ;	
							case cvD64 : man.dtsize = cvD8 ;
										 con_printf("D8] \n") ;
										 break ;	

							case cvD16_swapped :
							case cvD32_swapped :
							case cvD64_swapped :
							default :
										break;
							}

						break ;

			case  '4' : gotoxy(X_AM,Y_AM) ;

						switch(man.am)
							{
							case cvA16_U	  : man.am = cvA24_U_DATA ;
									  			con_printf("A24]\n") ;
												break ;	
							case cvA24_U_DATA : man.am = cvA32_U_DATA ;
												con_printf("A32]\n") ;
												break ;	
							case cvA32_U_DATA : man.am = cvCR_CSR ;
												con_printf("CR/SCR]\n") ;
												break ;	
							case cvCR_CSR	  : man.am = cvA16_U ;
												con_printf("A16]   \n") ;
												break ;	
							}

						break ;

			case  '5' : con_printf(" Please enter Block Transfer Size : ") ;

						if (con_scanf("%"SCNu32,&value) != EOF)
							man.blts = value ;
						con_printf_xy(X_BLTSIZE,Y_BLTSIZE,"%"PRIu32"]        \n",man.blts) ;

						clear_line(Y_COMM) ;
					
						break ;

			case  '6' : gotoxy(X_AUTOINC,Y_AUTOINC) ;

						man.autoinc ^= 1 ;
						if (man.autoinc)
							con_printf("ON] \n") ;
						else
							con_printf("OFF]\n") ;

						break ;

			case  '7' : con_printf(" Please enter Number of Cycles : ") ;
					
						if (con_scanf("%"SCNu32,&value) != EOF)
							man.ncyc = (ushort)value ;
						gotoxy(X_NCYCLES,Y_NCYCLES) ;
						if (man.ncyc)
							con_printf("%"PRIu32"]       \n",man.ncyc) ;
						else
							con_printf("Infinite]\n",man.ncyc) ;

						clear_line(Y_COMM) ;

						break ;

			case  '8' :	ViewReadBltData(&man);
						dis_main_menu = 1;	// Display Main Menu
						break ;

			case  'Q' : free(man.buff);		// Release the memory buffer for BLT 
						return ;
					
			default   : break ;
			}

		}
	while (!dis_main_menu) ;
	
	}										// End 'for(;;)' 
}
Example #24
0
void addSupplier()
{
	char ch='y';
	FILE *fp;
	
	system("cls");
	
	fp=fopen("supplier.data","a");
	if(fp==NULL)
	{
	  printf("file can not be opened !!");
	  exit(0);
	}
	while(ch=='y')
	{
		Box_up();
	        bigBox();
	        gotoxy(26,4);
	        printf("  *** CAIRO PHARMACY *** ");
	        gotoxy(28,12);
	        printf("%c %c",175,175);
	        printf("  Add supplier  ");
	        gotoxy(46,12);
	        printf("%c %c",174,174);
		supp_data.supplier_ID=getSupplier_ID();
		gotoxy(4,14);
		printf("* Supplier    ID :%d",supp_data.supplier_ID);
		gotoxy(4,17);
		printf("* supplier   Name: ");
		gotoxy(4,20);
		printf("* supplier Mobile: ");
		gotoxy(4,23);
		printf("* supplier E-mail: ");
		gotoxy(4,26);
		printf("* supplier   City: ");
		gotoxy(22,17);
		getAllData(supp_data.supplier_name,0);
		gotoxy(23,20);
		getAllData(supp_data.supplier_mobile,1);
		gotoxy(23,23);
		getAllData(supp_data.supplier_E_mail,0);
		gotoxy(23,26);
		getAllData(supp_data.supplier_name,0);
		gotoxy(7,28);
	        printf("[ Save / Cancel ] ::");
		gotoxy(26,28);
		printf("   please Enter the first character: ");
		ch=(getch());
	
	}
	
	
}
void intro()
{
 char s[]={"Successful"};

 int cnt=0,i=0;

 do
  {
   clrscr();
   cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\t\t\tAccessing James Gleick Servers\n\n";
   cout<<setw(i)<<"===";
   delay(40);
  if (i<=77)
  i+=4;
  else
  i=0;
  cnt+=1;
 }
 while(cnt<=150);
 cnt=0;
 do
 {
  clrscr();
  cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\t\t  Server Link Establishment "<<s<<" ! ";
  delay(500);
  clrscr();
  cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\t\t  Server Link Establishment "<<s;
  delay(500);
  cnt+=1;
 }
 while(cnt<5);
 char sles[]="Server Link Establishment Successful";
 int slesl=strlen(sles);
 for(i=0;i<slesl;i+=1)
 {
  clrscr();
  gotoxy(5,13);
  for(int j=i;j<slesl;j+=1)
  cout<<sles[j];
  delay(50);
 }
 clrscr();

 info X;
 cout<<"\n\t\t\tJames Gleick's Messenger";
 cout<<"\n\t\t\t~~~~~ ~~~~~~~~ ~~~~~~~~";
 cout<<"\n\n\n\t\t\t\tSign Up";
 cout<<"\n\nEnter your first name : ";
 gets(X.fname);


 X.fname[0]=toupper(X.fname[0]); //changing startin letter to caps
 cout<<"\nEnter your second name  : ";

 gets(X.sname);
 X.sname[0]=toupper(X.sname[0]);//again changing 1st letter 2 caps

 cout<<"\nEnter your preferred user name :  ";
 gets(X.username);

 ofstream fout22("C:\\JG MSG\\login\\list.use",ios::binary|ios::app);
 {
   use A;
   fout22.seekp(0,ios::end);
   strcpy(A.name,X.username);
   fout22.write((char*)&A,sizeof(A));
  }
 fout22.close();
 char tempo[20];
 strcpy(tempo,X.username);
 strcat(tempo,"@jgs.com");
 strcpy(X.mname,tempo);
 cnt=0;

 enpass(X.pass1);
 cout<<"\n\nPlease Reconfirm your passowrd";
 cout<<"\n~~~~~~ ~~~~~~~~~ ~~~~ ~~~~~~~~";
 enpass(X.pass2);




char z[80],file[80];

  char nm[2],temp[1];
  logid B;
  ifstream fin15("C:\\JG MSG\\login\\signs.dat",ios::binary);
  fin15.read((char*)&B,ios::binary);
  nm[0]=B.a;
  nm[1]='\0';
  fin15.close();
  B.a+=1;
  ofstream fout16("C:\\JG MSG\\login\\signs.dat",ios::binary);
  fout16.write((char*)&B,ios::binary);
  fout16.close();
  strcpy(X.id,nm);

 strcpy(z,X.username);
/********************************************/
 strcat(z,".jgs");
/***all the user info files are being saved under name.jgs**/

 strcpy(file,"C:\\JG MSG\\login\\");

 strcat(file,z);
 ofstream fout7(file,ios::binary);
 fout7.write((char*)&X,sizeof(X));



 fout7.close();
 cout<<"\n\nAccount Created Successfully !";
 cout<<"\n\nPress Any Key To Proceed To view contact manager ";
 getch();
 contacts(X.username);

 clrscr();
 cout<<"\n\n\n\t\t\t\tAccount Details";
 cout<<"\n\n 1. Your USER Name : ";puts(X.username);
 cout<<"\n 2. Your USER Login ID : "; puts(nm);
 cout<<"\n 3. Stage 1 Password : "; puts(X.pass1);
 cout<<"\n 4. Stage 2 Password : "; puts(X.pass2);
 cout<<"\n  Now press a key to view your contact list ";
 getch();


 cout<<"\n\n\n Proceed to Login !";
 getch();


}
Example #26
0
int menue(void)
{
int x1=3,x2=60,y1=3,y2=23;
int x,y;
table(x,y,x1,y1,x2,y2);
vydelenie(0,x1+1,y1+1);

x=x1+2;y=y1+2;
gotoxy(x,y);
char c=0;
int v=0;

while (v==0)
 {
 c=getch();
 if (c==27) {return 0;}

  switch (c)
    {
     case 80:
	if (y<y2-4)
	{
	gotoxy(x,y+=4);
	if (y==y1+2)  vydelenie(1,x1+1,y1+1);
	if (y==y1+6)  vydelenie(2,x1+1,y1+1);
	if (y==y1+10) vydelenie(3,x1+1,y1+1);
	if (y==y1+14) vydelenie(4,x1+1,y1+1);
	if (y==y1+18) vydelenie(5,x1+1,y1+1);
	gotoxy(x,y);
	}break;

     case 72:
	 if (y-4>y1)
	 {
	 gotoxy(x,y-=4);
	 if (y==y1+2)  vydelenie(1,x1+1,y1+1);
	 if (y==y1+6)  vydelenie(2,x1+1,y1+1);
	 if (y==y1+10) vydelenie(3,x1+1,y1+1);
	 if (y==y1+14) vydelenie(4,x1+1,y1+1);
	 if (y==y1+18) vydelenie(5,x1+1,y1+1);
	 gotoxy(x,y);
	 }break;

     case 13:
	{
	if (y==y1+2) {v=1;break;}
	if (y==y1+6) {v=2;break;}
	if (y==y1+10) {v=3;break;}
	if (y==y1+14) {v=4;break;}
	if (y==y1+18) {v=5;break;}
	}
    }


 }

switch (v)
  {
    case 1: puts("\t\t...1..."); break;

     case 2: puts("\t\t...2..."); break;

     case 3: puts("\t\t...3..."); break;

     case 4: puts("\t\t...4...");break;

     case 5: return 0;break;

  }
getch();
return 1;
}
Example #27
0
/*画棋盘上的交叉点*/
void DrawCross(int x,int y)
{
  gotoxy(x+MAPX_O,y+MAPY_O);
  /*交叉点上是一号玩家的棋子*/
  if(gChessBoard[x][y]==CHESS_1)
  {
    textcolor(LIGHTRED);
    putch(CHESS_1);
    return;
  }
  /*交叉点上是二号玩家的棋子*/
  if(gChessBoard[x][y]==CHESS_2)
  {
    textcolor(LIGHTBLUE);
    putch(CHESS_2);
    return;
  }
  textcolor(YELLOW);
  /*左上角交叉点*/
  if(x==0&&y==0)
  {
    putch(CROSS_LU);
    return;
  }
  /*左下角交叉点*/
  if(x==0&&y==18)
  {
    putch(CROSS_LD);
    return;
  }
  /*右上角交叉点*/
  if(x==18&&y==0)
  {
    putch(CROSS_RU);
    return;
  }
  /*右下角交叉点*/
  if(x==18&&y==18)
  {
    putch(CROSS_RD);
    return;
  }
  /*左边界交叉点*/
  if(x==0)
  {
    putch(CROSS_L);
    return;
  }
  /*右边界交叉点*/
  if(x==18)
  {
    putch(CROSS_R);
    return;
  }
  /*上边界交叉点*/
  if(y==0)
  {
    putch(CROSS_U);
    return;
  }
  /*下边界交叉点*/
  if(y==18)
  {
    putch(CROSS_D);
    return;
  }
  /*棋盘中间的交叉点*/
  putch(CROSS);
}
Example #28
0
void vydelenie(int p,int x1,int y1)
{
 switch (p)
  {
   case 0:
     {
      gotoxy(x1+1,y1+1); tsvet("1) Pervoe",4);
      gotoxy(x1+1,y1+5); tsvet("2) Vtoroe",2);
      gotoxy(x1+1,y1+9); tsvet("3) Tretee",2);
      gotoxy(x1+1,y1+13); tsvet("4) Chetvertoe",2);
      gotoxy(x1+1,y1+17); tsvet("5) Exit",2);
     } break;
   case 1:
     {
      gotoxy(x1+1,y1+1); tsvet("1) Pervoe",4);
      gotoxy(x1+1,y1+5); tsvet("2) Vtoroe",2);
      gotoxy(x1+1,y1+9); tsvet("3) Tretee",2);
      gotoxy(x1+1,y1+13); tsvet("4) Chetvertoe",2);
      gotoxy(x1+1,y1+17); tsvet("5) Exit",2);
     } break;
   case 2:
     {
      gotoxy(x1+1,y1+1); tsvet("1) Pervoe",2);
      gotoxy(x1+1,y1+5); tsvet("2) Vtoroe",4);
      gotoxy(x1+1,y1+9); tsvet("3) Tretee",2);
      gotoxy(x1+1,y1+13); tsvet("4) Chetvertoe",2);
      gotoxy(x1+1,y1+17); tsvet("5) Exit",2);
     } break;
   case 3:
     {
      gotoxy(x1+1,y1+1); tsvet("1) Pervoe",2);
      gotoxy(x1+1,y1+5); tsvet("2) Vtoroe",2);
      gotoxy(x1+1,y1+9); tsvet("3) Tretee",4);
      gotoxy(x1+1,y1+13); tsvet("4) Chetvertoe",2);
      gotoxy(x1+1,y1+17); tsvet("5) Exit",2);
     } break;
   case 4:
     {
      gotoxy(x1+1,y1+1); tsvet("1) Pervoe",2);
      gotoxy(x1+1,y1+5); tsvet("2) Vtoroe",2);
      gotoxy(x1+1,y1+9); tsvet("3) Tretee",2);
      gotoxy(x1+1,y1+13); tsvet("4) Chetvertoe",4);
      gotoxy(x1+1,y1+17); tsvet("5) Exit",2);
     } break;
   case 5:
     {
      gotoxy(x1+1,y1+1); tsvet("1) Pervoe",2);
      gotoxy(x1+1,y1+5); tsvet("2) Vtoroe",2);
      gotoxy(x1+1,y1+9); tsvet("3) Tretee",2);
      gotoxy(x1+1,y1+13); tsvet("4) Chetvertoe",2);
      gotoxy(x1+1,y1+17); tsvet("5) Exit",4);
     } break;
  }
}
Example #29
0
/*主函数*/
void main()
{
  int press;
  int bOutWhile=0;/*退出循环标志*/

  int a=DETECT,b;     /*切换到图形模式*/
  initgraph(&a,&b,"d:\\tc");
  gotoxy(28,5);printf ("****WELCOME TO WU ZI Qi****");
  gotoxy(33,8);printf("xi  tong  ben\n");
  gotoxy(33,11);printf ("shao wang quan\n");
  gotoxy(33,12);printf("zhou  rui fei\n ");
  gotoxy(33,13);printf ("wu   guo  xu\n");
  gotoxy(33,14);printf ("yang      wu");
  gotoxy(28,20);printf("Please press any key  start.....");
  getch();
  closegraph();    /*切换到字符模式*/
  Init();/*初始化图象,数据*/
  while(1)
  {
     press=GetKey();/*获取用户的按键值*/
     switch(CheckKey(press))/*判断按键类别*/
        {
          /*是退出键*/
         case KEY_EXIT:
           clrscr();/*清屏*/
           bOutWhile = 1;
         break;
        /*是落子键*/
         case KEY_FALLCHESS:
              /*走棋*/
            if(ChessGo(gPlayOrder,gCursor)==0)/*判断当前是否有子并提示*/
             {
              textcolor(RED+BLINK);
              gotoxy(2,21);
              cputs("Point for chessman,Please enter again!");
              gotoxy(gCursor.x+MAPX_O,gCursor.y+MAPY_O);
             }
            else
             {
                gotoxy(2,21);
                cputs("                                      ");
              /*如果当前行棋方赢棋*/
              if(JudgeWin(gPlayOrder,gCursor)==1)
                {
                   DoWin(gPlayOrder);
                   bOutWhile = 1;/*退出循环标志置为真*/
                }
              else
               /*交换行棋方*/
               ChangeOrder();
            }
        break;
      /*是光标移动键*/
      case KEY_MOVECURSOR:
        MoveCursor(gPlayOrder,press);
      break;
    /*是无效键*/
      case KEY_INVALID:
      break;
    }
    if(bOutWhile==1)
      break;
  }
  /*游戏结束*/
  EndGame();
}
Example #30
0
void DrawOhMok()
{
	int x,y,i,j,z;
	x=y=0;
	SetColor(15);
	for(j=0;j<13;j++)
	{
		gotoxy(x,0);
		if(j>0 && j<12) printf("┳");
		else if(j==0) printf("┏");
		else if(j==12) printf("┓");
		//if(j<12){
		gotoxy(0,y);
		if(j>0 && j<12) printf("┣");
		else if(j==0) printf("┏");
		else if(j==12) printf("┗");
		//}
		for(z=1;z<23;z++)
		{
			if(j==12 && z%2==0)
			{
				gotoxy(x,z);
				printf("┫");
			}
			else
			{
				gotoxy(x,z);
				printf("┃");
			}
			if(z%2==0 && j>0 && j<12)
			{
				gotoxy(x,z);
				if(ohmok[z/2][x/4]==STONE_DARK) printf("○");
				else if(ohmok[z/2][x/4]==STONE_WHITE) printf("●");
				else printf("╋");
			} else
			{
				if(j==12 && z%2==0)
				{
					gotoxy(z*2,y);
					printf("┻");
				} else
				{
					gotoxy(z*2,y);
					printf("━");
				}
			}

		}
		gotoxy(z*2,y);
		printf("━");
		gotoxy(x,23);
		printf("┃");
		gotoxy(x,24);
		if(j>0 && j<12) printf("┻");
		else if(j==0) printf("┗");
		else if(j==12) printf("┛");
		x+=4;
		gotoxy(48,y);
		if(j>0 && j<12) printf("┫");
		else if(j==0) printf("┓");
		else if(j==12) printf("┛");
		y+=2;
	}
	SetColor(15);
	gotoxy(50,0);
	printf(" ♧★ OhMok ☆♣");
	MakeSq(50,1,20,9,12);
	gotoxy(52,1);
	printf("설명서");
	gotoxy(52,2);
	printf("Space Bar : 놓기");
	gotoxy(52,3);
	printf("  ↑");
	gotoxy(52,4);
	printf("←  → :  이동");
	gotoxy(52,5);
	printf("  ↓");
	gotoxy(52,6);
	printf(" ○ : 흑돌 ");
	gotoxy(52,7);
	printf(" ● : 백돌 ");
	gotoxy(52,8);
	printf(" ⊙ : 놓으려고 하는 위치");
	gotoxy(50,10);
	printf(" 차례 : ");
	
	if(suv == ONEP) printf("1 P");
	else if(suv == TWOP) printf("2 P");
	else if(suv == SERVER) printf(" 서버");
	else if(suv == CLIENT) printf(" 클라이언트");
	
}