闘地主発札システム

2128 ワード

// ConsoleApplication2.cpp:              。
//

#include "stdafx.h"
#include 

#include 
#include 

#define	DA 0
#define	XIAO 1
#define		HEI 2
#define		HONG 3
#define		MEI 4
#define		FANG 5

struct PAI {
	int zhi;
	int se;
};

const char* se[] = { " "," ","  ","  ","  ","  " };
const char* zhi[] = { "3","4","5","6","7","8","9","10","j","q","k","1","2"," " };
void shuchu(PAI pai) {
	/*if(pai.se==WANG){
	std::cout<20) {
			do {
				zhi2 = rand() % 14;
			} while (zhi2 == pk.zhi);
		}
		if (len>41) {
			do {
				zhi3 = rand() % 14;
			} while (zhi3 == pk.zhi || zhi3 == zhi2);
		}

		p[plen++] = pk;
		for (int i = k; i20) {
			zhi2 = rand() % 14;
		}
		if (len>41) {
			do {
				zhi3 = rand() % 14;
			} while (zhi3 == zhi2);
		}

		//      
		while (len != maxlen - shu) {
			do {
				k = rand() % len;
			} while (zhi3 == k || k == zhi2);
			PAI pk = pai[k];
			p[plen++] = pk;
			for (int i = k; i= 0; --i) {
			if (jishu>0) {
				if (jishu == 5)
					return true;
				if (zhi == pai[i].zhi) {
					jishu--;
				}
				else if (zhi + 1 != pai[i].zhi)
				{
					zhi = -1;
					memset(s, 0, 4 * jishu);
					jishu = 0;
				}
			}
			if (pai[i].zhi<12) {
				zhi = pai[i].zhi;
				s[jishu++] = i;
			}
		}
		return false;
	}
};

bool pd(PAI& a, PAI& b) {
	return (a.zhi == b.zhi ? a.seb.zhi);
}

void main() {
	{
		Doudizhu d;
		//d.show();
		int a = 13;
		PAI pai[13];
		d.fapai(a, pai);
		std::cout << "---------------------
"; d.Sort(pai, a, pd); for (int i = 0; i