Test AI program in D
This commit is contained in:
		
							parent
							
								
									1ca571002e
								
							
						
					
					
						commit
						fdb3b56623
					
				
					 1 changed files with 20 additions and 0 deletions
				
			
		
							
								
								
									
										20
									
								
								TestingAI.d
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								TestingAI.d
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,20 @@
 | 
			
		|||
#!dmd -run
 | 
			
		||||
 | 
			
		||||
import core.thread;
 | 
			
		||||
import std.stdio;
 | 
			
		||||
import std.socket;
 | 
			
		||||
import std.conv;
 | 
			
		||||
import std.utf;
 | 
			
		||||
 | 
			
		||||
void main() {
 | 
			
		||||
	writeln("Start");
 | 
			
		||||
	auto sock = new TcpSocket;
 | 
			
		||||
	sock.blocking = 1;
 | 
			
		||||
	sock.connect(new InternetAddress("127.0.0.1", 8080));
 | 
			
		||||
	writeln("Connected");
 | 
			
		||||
 | 
			
		||||
	auto msg = `{"action":"bind","target":"testnpc"}`;
 | 
			
		||||
	sock.send(msg.toUTF8);
 | 
			
		||||
	writeln("Sent");
 | 
			
		||||
	Thread.sleep(dur!"seconds"(1));
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	Add table
		
		Reference in a new issue