Example #1
0
File: main.cpp Project: CCJY/coliru
int main(int argc, char** argv) {
    std::string one = argv[1];
    std::string two = argv[1]+std::string(";");
    std::string three = "";
    
    clock_t begin = clock();
    unsigned r = three_way(one.c_str(), two.c_str(), three.c_str());
    clock_t end = clock();
    std::cout << "three_way:\t" << (end-begin) << " ticks\t" << r << '\n';
    
    begin = clock();
    r = two_way(one, two, three);
    end = clock();
    std::cout << "two_way:\t" << (end-begin) << " ticks\t" << r << '\n';
    
    begin = clock();
    r = two_wayish(one, two, three);
    end = clock();
    std::cout << "two_wayish:\t" << (end-begin) << " ticks\t" << r << '\n';
    
}
Example #2
0
void GACHAPON::normalF2(){
	static int ballnum[6];
	static int led = 0;
	static bool onflag = false;
	static bool upflag = true;
	static int i = 0;
	static int j = 0;
	static int h = 0;
	static int r = 0, g = 0, b = 0;

	int hoge = 3;

	if (onflag == false){
		for (int j = 0; j < 6; j++){
			ballnum[j] = random(0, 15);
		}
		onflag = true;
	}
	else{
		if (upflag == true){
			i++;
			j++;
		}
		else{
			i--;
			j++;
		}
		if (i >= 40){
			i = 40;
			upflag = false;
		}
		else if (i <= 0){
			i = 0;
			j = 0;
			upflag = true;
			onflag = false;
		}

		//long temp = HSV(((double)j / 40.0 * 360.0) , 100.0, (double)i / 3.0);
		//b = temp & 0xff;
		//g = temp >> 8 & 0xff;
		//r = temp >> 16 & 0xff;
		r = 0;
		g = (int)i;
		b = (int)i;

		for (int k = 0; k < 6; k++){
			int m = ballnum[k] / 3;
			int n = ballnum[k] % 3;
			for (long l = 0; l < hoge; l++){
				int j = n * 7 + l;
				two_way(m, j,
					((double)(r + g + b) / 3.0),
					((double)(r + g + b) / 3.0),
					((double)(r + g + b) / 3.0));
			}
			for (long l = hoge; l < 7; l++){
				int j = n * 7 + l;
				two_way(m, j,
					((double)r * (double)(l - hoge + 1) / (double)(7.0 - hoge) + (double)(r + g + b) / 3.0 * (double)(6 - l) / (double)(7.0 - hoge)),
					((double)g * (double)(l - hoge + 1) / (double)(7.0 - hoge) + (double)(r + g + b) / 3.0 * (double)(6 - l) / (double)(7.0 - hoge)),
					((double)b * (double)(l - hoge + 1) / (double)(7.0 - hoge) + (double)(r + g + b) / 3.0 * (double)(6 - l) / (double)(7.0 - hoge)));
			}
		}
		delay(15);
		All_show();
	}
}