跳到正文

个人记录

模仿人类

count_year约 3 分钟
原文

这是 2025年11月7日 存档的第 1 版,不是当前版本。查看当前版本

文章信息与版本

文章信息

发布
2025年11月7日
收录
2025年12月12日
更新
2026年11月17日
篇幅
约 3 分钟

版本

  1. v3当前
  2. v2
  3. v1
C++
#include<bits/stdc++.h>
#include<windows.h>
void asd(char a){
	keybd_event(a,0,0,0);
	Sleep(1);
	keybd_event(a,0,KEYEVENTF_KEYUP,0);
	Sleep(1);
}
int main() {
	srand(time(NULL));
	Sleep(2000);
    POINT pt;
    pt.x=100;
    pt.y=100;
    int len=1;
	double x=1;
	double y=1;
	bool flag=0;
    while(1){
    	while(!GetAsyncKeyState(38));
    	while(1){
	    	if(rand()%10==0){
	    		int t=rand()%8;
	    		for(int i=1;i<=rand()%100;i++){
	    			Sleep(10);
	    			if(rand()%2==0){
		    			x-=0.1*(rand()%5);
					}else{
						x+=0.1*(rand()%5);
					}
					if(x>1){
						x=1;
					}
					if(x<-1){
						x=-1;
					}
		    		if(rand()%2==0){
		    			y+=0.1;
					}else{
						y-=0.1;
					}
					if(y>1){
						y=1;
					}
					if(y<-1){
						y=-1;
					}
					if(x>0&&pt.x>=1590){
						x=-x;
					}
					if(x<0&&pt.x<=9){
						x=-x;
					}
					if(y>0&&pt.y>=890){
						y=-y;
					}
					if(y<0&&pt.y<=9){
						y=-y;
					}
		    		pt.x+=len*x;
		    		pt.y+=len*y;
					if(rand()%2==0){
						len++;
						if(len>5){
							len=4;
						}
					}else{
						len--;
						if(len<1){
							len=1;
						}
					}
	    			SetCursorPos(pt.x,pt.y);
				} 
			}
	    	SetCursorPos(pt.x,pt.y);
	    	if(rand()%10==0){
	    		flag=!flag;
	    		if(flag==1){
	    			mouse_event(MOUSEEVENTF_LEFTDOWN,pt.x,pt.y,0,NULL);
				}else{
					mouse_event(MOUSEEVENTF_LEFTUP,pt.x,pt.y,0,NULL);
				}
			}
			int kkk=rand()%28;
			if(kkk<=26){
				asd('A'+kkk);
			}else if(kkk==27){
				asd(32);
			}else{
				asd(13);
			}
	    	if(GetAsyncKeyState(VK_ESCAPE)){
	            break;
	        }
		}
	}
	    
    return 0;
}