对拍

写了一个对拍。用于测试跳马的程序
首先是随机数生成程序:

//rand.cpp
#include <bits/stdc++.h>
#define random(x) (rand() % x)
using namespace std;
int n, m;
int main(){
	srand(time(NULL));
	n = random(200);
	m = random(200);
	int x = random(n);
	int y = random(m);
	while(!x || !y) {
			int x = random(n);
	int y = random(m);
	}
	cout << n <<' ' << m << ' ' << x << ' ' << y << ' ';
	return 0;
}

然后是bat脚本

@echo off

:loop

rand>in.txt
my<in.txt>myout.txt
std<in.txt>stdout.txt

fc myout.txt stdout.txt

if not errorlevel 1 goto loop

pause
goto loop

效果还不错!

posted on 2016-10-29 16:32  蒟蒻konjac  阅读(50)  评论(0编辑  收藏

统计