#include<bits/stdc++.h>
using namespace std;
namespace work{
const int maxPlayerNumber = 11;
int n,m,top = 1;//玩家数,牌堆中的牌数,目前的牌堆顶
unordered_map<string,int> transCard;//牌型编号
unordered_map<string,int> transRole;//角色编号
vector<int> cardHeap;//牌堆
int prince = 1,enemy;//反贼数量和主公数量
int Sstate = 0;//场上无懈可击状态
struct Player{
int role,state,health;//玩家角色,装备(是否装备上诸葛连弩),体力值
string endState = "ALIVE";//在场状态(死亡判断)
bool usedKill;//是否在出牌阶段使用了‘杀’
int emo[maxPlayerNumber];//对每个玩家的态度
list<int> card;//手牌
}P[maxPlayerNumber];
void init() {
transRole["MP"] = 1;transRole["ZP"] = 2;transRole["FP"] = 3;
transCard["P"] = 1;transCard["K"] = 2;transCard["D"] = 3;transCard["F"] = 4;
transCard["N"] = 5;transCard["W"] = 6;transCard["J"] = 7;transCard["Z"] = 8;
}
void getData() {
//读数据
cin>>n>>m;
string s;
for(int i = 1;i<=n;i++) {
cin>>s;
P[i].role = transRole[s];
P[i].health = 4;
if(P[i].role == 3) enemy++;
for(int j = 1;j<=4;j++) {cin>>s;P[i].card.emplace_back(transCard[s]);}
}
for(int i = 1;i<=m;i++) {cin>>s;cardHeap.emplace_back(transCard[s]);}
}
bool Check() {
//判断局面情况
if(!prince) return -1;
if(!enemy) return 1;
return 0;
}
int now = 1;
void getCard(int player){
//摸牌
P[player].card.emplace_back(cardHeap[top++]);
if(top == m + 1) top = m;
P[player].card.emplace_back(cardHeap[top++]);
if(top == m + 1) top = m;
}
void use_The_Next_Card(int player,list<int>::iterator it){
//使用下一张牌
for(;it != P[player].card.end();it++) {
if()
}
}
void PlayerOption(int player){
getCard(player);
auto now_used = P[player].card.begin();
while(now_used != P[player].card.end()) {
use_The_Next_Card(player,now_used);
Check();
Sstate = 0;
}
}
void solve(){
getData();
while(Check()){
PlayerOption(now);
now = (now) % (n + 1) + 1;
}
if(Check() == 1) {
cout<<"MP\n";
for(int i = 1;i<=n;i++) {
if(P[i].endState == "DEAD") cout<<P[i].endState;
else for(auto j:P[i].card) cout<<j<<" ";
cout<<'\n';
}
}else {
cout<<"FP\n";
for(int i = 1;i<=n;i++) {
if(P[i].endState == "DEAD") cout<<P[i].endState;
else for(auto j:P[i].card) cout<<j<<" ";
cout<<'\n';
}
}
}
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
work::init();
work::solve();
return 0;
}
标签:猪国,int,transCard,top,暂未,SDOI2010,player,now,card
From: https://www.cnblogs.com/WG-MingJunYi/p/18299689