/ 夏风 / 讨论 / 分享 /

icecream的讨论组~~

额......大家畅所欲言吧
2018.2.3
icecream.

17 条评论

  • @ 2018-03-01 16:17:34

    李大爷,你去访问这个网站:lgblog.xfice.cn

  • @ 2018-02-27 13:10:37

    晚上玩吗

  • @ 2018-02-27 13:07:06

    你写完作业了吗

  • @ 2018-02-27 13:06:56

    在吗

  • @ 2018-02-27 09:31:37

    #include<bits/stdc++.h>
    using namespace std;
    int a[210],b[210],c[210];
    char al[210],bl[210];
    int main(){
    int i,lena,lenb,lenc;
    gets(al);
    gets(bl);
    lena=strlen(al);
    lenb=strlen(bl);
    if(lena<lenb||lena==lenb&&strcmp(al,bl)<0){
    cout<<"-";
    swap(al,bl);
    }
    for(i=0;i<=lena-1;i++)
    a[lena-i]=al[i]-'0';
    for(i=0;i<=lenb-1;i++)
    b[lenb-i]=bl[i]-'0';
    i=1;
    while(i<=lena||i<=lenb){
    if(a[i]<b[i]){
    a[i]+=10;
    a[i+1]--;
    }
    c[i]=a[i]-b[i];
    i++;
    }
    lenc=i;
    while(c[lenc]==0&&lenc>1)
    lenc--;
    for(i=lenc;i>=1;i--)
    cout<<c[i];
    return 0;
    }

  • @ 2018-02-05 13:44:38

    哈哈

  • @ 2018-02-05 13:43:07

    @李大爷
    Orz

  • @ 2018-02-04 15:59:53

    #include<bits/stdc++.h>
    #include<time.h>
    using namespace std;
    //----------------UserData----------------
    int level;
    int HP;
    int maxHP;
    int attack;
    int defend;
    int magic;
    int maxMic;
    int RP;
    int money;
    int EXP;
    int skill;
    int LP;
    const int speed = 20;
    int myobj[6];
    int skl_level[3];
    //---------------SystemInfo---------------
    string name;
    int latest;
    int lasted;
    int allc;
    //-----------------RunTime----------------
    const int obj_num = 7;
    const int skl_num = 3;
    const int dem_num = 3;
    const int cost[obj_num] = {
    600,1000,1000,1500,1000,5000,1500

    };

    const string object[obj_num] = {
    "血量回复药水(50)",

    "血量恢复药水(100)",

    "魔法恢复药水(50)",

    "魔法恢复药水(100)",

    "经验药水",

    "重生宝石",

    "野猪林地图"

    };

    const int upd[30] = {
    20,25,40,60,85,105,140,165,190,210,240,285,310,355,405,450,500,570,660,750,820,900,950,1000,1150,1200,1200,1200

    };

    const string skl_name[skl_num] = {
    "火球术",

    "雷暴术",

    "治疗术"

    };

    const string skl_fur[skl_num] = {
    "||稳定伤害|| 法术 ||",

    "||不定伤害|| 法术 ||",
    "|| 治疗 || 法术 ||"
    };

    const string skl_upd[skl_num] = {
    "10点技能点",

    "10点技能点",

    "15点技能点",

    };

    const int skl_upd_cost[skl_num] = {

    10,10,10 }; const int skl_cost[skl_num] = {
    8,8,15

    };

    const string exp_hrm_word[4] = {
    "你被路过的野兽撞了一下,",

    "你从上坡上滚下来,",

    "一道光从林中闪过,",

    "一个椰子从天而降,",

    };

    const string exp_heal_word[3] = {
    "一道绿光划过,",

    "一个野人路过,救起了你,",

    "喝了一口清澈的溪水,",

    };

    const string dem_name[dem_num] = {
    "西瓜猪",

    "南瓜猪",

    "怕西斯大野猪"

    };
    const int dem_property[dem_num][6] = {
    /*attack//defend//gold//EXP//object//speed*/
    {40,15,35,25,0,20},
    {20,50,30,30,0,15},
    {500,100,250,60,5,15}
    };
    const int dem_HParea[dem_num][2] = {
    {30,60},
    {40,100},
    {150,600}
    };
    //----------------------------------------
    void help();
    void info();
    void check();
    void timess();
    void logout();
    void login();
    void save();
    void backpack();
    void shop();
    void buy();
    void use();
    void updata();
    void luck();
    void explorer();
    void Map();
    void learn();
    void init(){
    ifstream in("magic.data");
    in >> level;
    in >> HP ;
    in >> maxHP;
    in >> attack;
    in >> defend;
    in >> magic;
    in >> maxMic;
    in >> RP;
    in >> money;
    in >> EXP;
    in >> skill;
    for(int i = 0;i ^ obj_num; i++)in >> myobj[i];
    in >> LP;
    for(int i = 0;i ^ skl_num; i++)in >> skl_level[i];
    in.close();
    in.open("normal.data");
    in >> name;
    in >> latest;
    in >> lasted;
    in >> allc;
    cout << "it have been loading up\n";
    srand(time(NULL));
    if(name == "Default")login();
    }
    void login(){
    cout << "新来的,请输入你的名字:";
    cin >> name;
    }
    void logout(){
    save();
    exit(0);
    }
    void save(){
    ofstream out("magic.data");
    out << level << "\n";
    out << HP << "\n";
    out << maxHP << "\n";
    out << attack << "\n";
    out << defend << "\n";
    out << magic << "\n";
    out << maxMic << "\n";
    out << RP << "\n";
    out << money << "\n";
    out << EXP << "\n";
    out << skill << "\n\n";
    for(int i = 0;i ^ obj_num; i++)out << myobj[i] << "\n";
    out <<"\n" << LP << "\n\n";
    for(int i = 0;i ^ skl_num; i++)out << skl_level[i] << "\n";
    out.close();
    out.open("normal.data");
    out << name << "\n";
    out << latest << "\n";
    out << lasted << "\n";
    out << allc << "\n";
    cout << "保存成功\n";
    }
    int main(){
    init();
    cout << "欢迎回来!!!" << name << "\n";
    while(1){
    string a,b;
    cin >> a;
    if(a == "退出" or a == "end" or a == "exit" or a == "End" or a == "Exit")logout();
    else if(a == "help" or a == "Help" or a == "introduce" or a == "帮助" or a == "?")help();
    else if(a == "info" or a == "information" or a == "个人信息" or a == "me" or a == "Me" or a == "Info")info();
    else if(a == "签到" or a == "card" or a == "check" or a == "Check" or a == "Card")check();
    else if(a == "time" or a == "Time" or a == "时间")timess();
    else if(a == "道具" or a == "物品" or a == "My" or a == "my" or a == "thing" or a == "object" or a == "backpack")backpack();
    else if(a == "商店" or a == "shop" or a == "Shop" or a == "Store" or a == "stroe")shop();
    else if(a == "购买物品" or a == "buy" or a == "Buy")buy();
    else if(a == "使用物品" or a == "use" or a == "Use")use();
    else if(a == "升级" or a == "Updata" or a == "updata" or a == "up" or a == "Up")updata();
    else if(a == "保存" or a == "Save" or a == "save")save();
    else if(a == "抽奖" or a == "luck" or a =="Luck")luck();
    else if(a == "冒险" or a == "exp" or a == "Exp" or a == "explorer")explorer();
    else if(a == "副本" or a == "地图" or a == "Map" or a == "map" or a == "expmap")Map();
    else if(a == "学习技能" or a == "learn" or a == "Learn" or a == "Study" or a == "study" or a == "Knowledge" or a == "knowledge")learn();
    else if(a == "Money" or a == "金币" or a == "money" or a == "gold" or a == "Gold"){
    cout << "System:如果你这么想要金币,那就一起去冒险吧~~\n";
    }else if(a == "sk" or a == "skill" or a == "Skill" or a == "技能" or a == "学习"){
    cout << "sys:输入'学习技能 ?'来 查找技能列表\n";
    cout << "sys:输入'学习技能' + 技能名称来学习技能\n";
    }else if(a == "www" or a == "internet" or a == "Internet"){
    system("explorer http://hao123.com");
    system("explorer http://hao123.com");
    }
    else{
    cout << "System:~E,无法识别指令,请输入Help查询指令~~\n";
    }
    }
    }
    void Map_1();
    void info(){
    cout << "---------==~您的个人信息:==------------\n";
    cout << "等级: " << level << "\n";
    cout << "生命值: " << HP << "/" << maxHP << "\n";
    cout << "法力值: " << magic << "/" << maxMic << "\n";
    cout << "攻击力: " << attack << " " << "防御力: " << defend << "\n";
    cout << "经验 : " << EXP << "\n";
    cout << "Money : " << money << "\n";
    cout << "技能点: " << skill << "\n";
    cout << "总共签到:" << allc << "天\n";
    cout << "输入'道具'查询个人物品\n";
    cout << "-----------------------------------------\n";
    }
    void backpack(){
    cout << "-----------==你的道具==------------\n";
    for(int i = 0;i ^ obj_num;i++ ){
    cout << object[i] << " x" << myobj[i] << "\n";
    }
    cout << "如果道具不够了,可以到'商店'去购买\n";
    cout << "-----------------------------------\n";
    }
    void help(){
    cout << "---------==~~Help~~==---------------\n";
    cout << "你可以输入'个人信息'玩玩试试\n";
    cout << "也可以随意输一些指令来看看你是否能试对\n";
    cout << "Notice :请用end关闭程序,否则不会保存~~\n";
    cout << "------------------------------------\n";
    }
    void check(){

    time_t tt = time(NULL);
    tm* t= localtime(&tt);
    if(t -> tm_mday == latest){
    cout << "Sys:你今天已经签过到了~\n";
    }else{
    if(t -> tm_mday == latest + 1)lasted ++ ;
    else lasted = 1;
    latest = t -> tm_mday;
    allc ++;
    cout << "Sys:签到成功~~";
    cout << "你获得了:";
    int choice = rand() % 3;
    if(choice == 0){
    int coin = rand() % 500 + 1;
    cout << coin << "个金币\n";
    money += coin;
    }else if(choice == 1){
    int skil = rand() % 3 + 1;
    cout << skil << "个技能点\n";
    skill += skil;
    }else if( choice == 2){
    int exp = rand() % 10;
    cout << exp << "点经验\n";
    EXP += exp;
    }
    HP = maxHP;
    magic = maxMic;
    LP = 5;
    cout << "Sys:你已经连续签到了" << lasted << "天了,继续加油~~\n";
    cout << "您的HP,法力值,LP都回满了,每天只能冒险5次哦~~\n";
    }
    }
    void timess(){
    time_t tt = time(NULL);//这句返回的只是一个时间cuo
    tm* t= localtime(&tt);
    printf("system:~现在时间是~%d-%02d-%02d %02d:%02d:%02d\n",
    t->tm_year + 1900, t->tm_mon + 1,

    t->tm_mday,

    t->tm_hour,

    t->tm_min,

    t->tm_sec);
    }
    void shop(){
    cout << "年轻人想买什么,我这有\n";_sleep(1000);
    cout << "---------------==老爷爷的商店==---------------\n";
    for(int i = 0 ;i ^ obj_num ;i++){
    cout << object[i] << " x 1,需要" << cost[i] << "个金币\n";
    }
    cout << "输入'购买物品'加上商品名称(编号)购买\n";
    cout << "老爷爷:缺钱吗,旁边野猪林里有好多宝藏呢,想要的话,就去冒险吧\n";
    cout << "----------------------------------------------\n";
    }
    void buy(){
    string names;cin >> names;
    for(int i = 0;i ^ obj_num;i ++){
    if(names == object[i] or names[0] == 49 + i){
    if(money < cost[i]){
    cout << "Sys:您的余额不够~~\n";
    return ;
    }
    myobj[i] ++;
    money -= cost[i];
    cout << "Sys:购买成功";
    cout << "可以输入'使用物品' + '物品名称(编号)'来使用\n";
    return ;
    }
    }
    cout << "老爷爷:这没有你想要的东西,请另寻高就吧\n";
    }
    void use(){
    string obj;cin >> obj;
    for(int i = 0;i ^ obj_num;i++){
    if(obj == object[i] or obj[0] == 49 + i){
    if(!myobj[i]){
    cout << "Sys:你没有这个物品哦~~\n";
    return ;
    }
    myobj[i] -- ;
    if(i == 0)HP = min(maxHP,HP + 50);
    if(i == 1)HP = min(maxHP,HP + 100);
    if(i == 2)magic = min(maxMic,magic + 50);
    if(i == 3)magic = min(maxMic,magic + 100);
    if(i == 4){
    int now = rand() % 200;
    EXP += now;
    cout << "你获得了 " << now << "点经验值\n";
    }
    if(i == 5 or i == 6){
    cout << "不能使用\n";
    return ;
    }
    cout << "使用成功\n";
    return ;
    }
    }
    }
    void updata(){
    if(EXP < upd[level]){
    cout << "升级失败,升级需" << upd[level] << "点经验\n";
    return ;
    }
    EXP -= upd[level];
    level ++ ;
    cout << "升级成功\n";
    int state = rand() % 4 + 1;
    if(state == 1){
    maxHP += 30;
    cout << "HP上限增加30,";
    }else if(state == 2){
    maxMic += 15;
    cout << "法力值上限增加15,";
    }else if(state == 3){
    attack += 3;
    cout << "攻击力+3,";
    }else{
    defend += 3;
    cout << "防御力+3,";
    }
    skill += 2;
    HP = maxHP;
    magic = maxMic;
    cout << "技能点+2,血量、魔法恢复至上限\n";
    cout << "升级成功了不如去看下技能?\n";
    return;
    }
    void luck(){
    if(money < 200){
    cout << "Sys:您的余额不足200~~\n";
    return ;
    }
    money -= 200;
    cout << "您花费了200金币,看看您抽到了什么宝物?\n";
    _sleep(1000);
    int state = rand() % 8;
    if(state == 0){
    int m = rand()%1000;
    cout << "您抽到了" << m << "枚金币,How Lucky You Are\n";
    money += m;
    }else if(state == 1){
    int sk = rand() % 2 + 1;
    cout << "您增加了" << sk << "点技能点\n";
    skill += sk;
    }else if(state == 2){
    cout << "您什么都没抽到,太可惜了~~\n";
    }else{
    cout << "您抽到了一个" << object[state - 3] << "\n";
    myobj[state - 3] ++ ;
    }
    }
    void explorer(){
    string place;cin >> place;
    if(place == "野猪林" or place[0] == '1'){
    Map_1();
    }else{
    cout << "没有这个地图(^-^)V~~\n";
    cout << "输入'副本'查询地图额~~\n";
    }
    }
    void learn(){
    string skil;cin >> skil;
    if(skil == "0" or skil == "?" or skil == "list" or skil == "help"){
    cout << "------------------==技能列表==------------------\n";
    for(int i = 0;i ^ skl_num; i++){
    cout << skl_name[i] << ": 您当前等级: " << skl_level[i] << "\n";
    cout << " 特性: " << skl_fur[i] << "*******\n";
    cout << " 升级消耗:" << skl_upd[i] << " 使用消耗: " << skl_cost[i] << "点法力值\n";
    cout << "********************************************\n";
    }
    cout << "------------------------------------------------\n";
    return ;
    }
    for(int i = 0; i ^ skl_num;i ++){
    if(skl_name[i] == skil or skil[0] == i + 49){
    if(skl_upd_cost[i] > 0){
    if(skill < skl_upd_cost[i]){
    cout << "Sys:你没有足够的技能点~~\n";
    cout << "老爷爷:不如氪一发(luck)\n";
    return ;
    }
    skill -= skl_upd_cost[i];
    cout << "你消耗了" << skl_upd_cost[i] << "点技能点\n";
    }else{
    int now = -skl_upd_cost[i];
    if(!myobj[now]){
    cout <<"Sys:你没有足够的物品啊~~\n";
    return ;
    }
    myobj[now] --;
    cout <<"你消耗了一个" << object[now] << "\n";
    }
    skl_level[i] ++;
    cout << "你成功将'" << skl_name[i] << "'升至" << skl_level[i] << "级\n";
    return ;
    }
    }
    cout << "未知技能(^-^)V,您发明的吧\n";
    cout << "Sys:输入 learn ? 查找技能列表\n";
    }
    bool fight(int tp);
    bool UDie();
    int skil();
    void Map(){
    cout << "------------==地图==------------\n";
    cout << "野猪林: 需要等级:0 难度 : 0\n";
    cout << " 伤害可能:25 ; 治疗可能:20\n";
    cout << " 修炼可能:20 ; 遇怪可能:25\n";
    cout << " 获利可能:10 ; ※※\n";
    cout << "--------------------------------\n";
    }
    void Map_1(){
    /*第一个副本:野猪林,(>_<)*/
    if(!LP){
    cout << "你没有LP了~~今天就不要来了吧~~\n";
    cout << "如果你还没有签到,先去签到吧\n";
    return ;
    }
    LP --;
    save();system("cls");
    cout << "欢迎来到野猪林------吼吼~~~---\n";
    cout << "此地十分凶险,请小心谨慎,如果想退出副本,可以输入'结束'来退出\n";
    //init//--------------------------------------------//
    int x = rand() % 100,y = rand() % 100;
    int allgone = 0;
    int mkt = 0;
    short mp_index[100][100];
    bool mark[100][100];
    bool visd[100][100];
    for(int i = 0 ;i <= 99;i ++){
    for(int j = 0;j <= 99;j ++){
    mp_index[i][j] = rand() % 100;
    mark[i][j] = visd[i][j] = false;
    }
    cout << "■";
    _sleep(1);
    }
    for(int i = 0;i ^ 5;i ++){
    int xt = rand() % 100,yt = rand() % 100;
    mp_index[xt][yt] = 101;
    }
    cout << "-------------地图加载完成100%-----------\n";
    cout << "你的位置是: X = " << x << ", Y = " << y << "\n";
    //operator//------------------------------------------//
    while(1){
    string a; cin >> a;
    if(a == "End" or a == "end" or a == "结束"){
    system("cls");
    save();
    cout << "冒险结束,欢迎回来~~~\n";
    return ;
    }else if(a == "?" or a == "help" or a == "Help" or a == "帮助"){
    cout << "---------------==help(副本)==---------------------------\n";
    cout << "操作很简单 输入 '向上'|'向下'|'向左'|'向右'移动\n";
    cout << "特殊操作 : 1.输入 '标记'来 标记当前位置\n";
    cout << " 2.输入 '挖掘'来 发掘此地的特殊物\n";
    cout << "副本玩法 :你可以不停在副本中移动发现物资与怪物,或者……\n";
    cout << "--------------------------------------------------------\n";
    continue ;
    }else if(a == "标记" or a == "Mark" or a == "mark" or a == "X"){
    if(mkt < 10)mkt ++;
    else{
    cout << "你已经用完了全部10个标记\n";
    }
    cout << "此地, X = " << x << " , Y = " << y << " ,被成功你标记\n";
    mark[x][y] = true;
    continue;
    }
    else if(a == "使用物品" or a == "use" or a == "Use")use();
    else if(a == "Up" or a =="up" or a == "向上" or a == "上" or a == "Y+" or a == "y+")y++;
    else if(a == "Down" or a == "down" or a == "向下" or a == "下" or a == "Y-" or a == "y-")y--;
    else if(a == "Left" or a == "left" or a == "向左" or a == "左" or a == "X-" or a == "x-")x--;
    else if(a == "right" or a == "Right" or a == "向右" or a == "右" or a == "X+" or a == "x+")x++;
    else{
    cout << "huhu~:未知指令~~输入Help来查询指令\n";
    continue ;
    }
    if(x >= 100){x -- ;cout << "您已越界\n";continue;}
    if(y >= 100){y -- ;cout << "您已越界\n";continue;}
    if(x < 0 ){x ++ ;cout << "您已越界\n";continue;}
    if(y < 0 ){y ++ ;cout << "您已越界\n";continue;}
    if(mark[x][y]){cout << "你已标记过此地 , X = " << x << " , Y = " << y << "\n";continue;}
    if(mp_index[x][y] <= 20 or visd[x][y]){cout << "这里什么也没有(^-^)V~~\n";continue;}
    else if(mp_index[x][y] <= 40){
    int harm = rand() % 60 + mp_index[x][y] - 20 - (RP % 10) + 10;
    cout << exp_hrm_word[harm % 4] << "你受到了" << harm << "点伤害\n";
    HP -= harm;
    if(HP <= 0){
    cout << "然后你就死了,2333~~\n";
    if(!UDie()){
    system("cls");
    save();
    cout << "冒险结束,欢迎回来~~~\n";
    return ;
    }
    }
    cout << "你的血量:" << HP << "/" << maxHP <<"\n";
    }else if(mp_index[x][y] <= 56){
    int heal = rand() % 35 + RP * 3 ;
    cout << exp_heal_word[heal % 3] << "你增加了" << heal << "点生命值\n";
    HP = min(maxHP,HP + heal);
    cout << "你的血量:" << HP << "/" << maxHP <<"\n";
    }else if(mp_index[x][y] <= 72){
    cout << "你增加了20点经验值\n";
    EXP += 20;
    }else if(mp_index[x][y] <= 92){
    cout << "你遇到了怪兽来袭……\n";
    int tp = rand() % 2;
    if(!fight(tp)){
    system("cls");
    save();
    cout << "冒险结束,欢迎回来~~~\n";
    return;
    }
    }else if(mp_index[x][y] <= 100){
    cout << "我们发财了\n";
    int mo = rand() % 200 + RP;
    money += mo;
    cout << "你获得了" << mo << "枚金币\n";
    }else{
    cout << "你触发了一个机关……\n";
    allgone ++;
    if(allgone == 5){
    cout << "你已经发现野猪林的秘密~~\n";
    cout << "野猪林的地底深处传来巨大的震动~~\n";
    cout << "??:是谁在召唤我~~?你是谁?!\n";
    cout << "嗯,虫子,你无路可逃\n";
    fight(2);
    }
    }
    visd[x][y] = true ;
    }
    }
    bool UDie(){
    if(myobj[5]){
    cout << "是否使用复活宝石[Y/N]?\n";
    string ans;cin >> ans;
    if(ans == "Y"){
    HP = maxHP;
    magic = maxHP;
    myobj[5] --;
    return true;
    }
    }
    cout << "你死了。。。需要等待20s重生\n";
    _sleep(20000);
    cout << "你已复活\n但生命值与魔法并没有回至上限\n";
    HP = 10;magic = 5;
    return false;
    }
    bool fight(int type){
    int HPD = dem_HParea[type][0] + rand() % (dem_HParea[type][1] - dem_HParea[type][0]);
    int atk = dem_property[type][0];
    int def = dem_property[type][1];
    int dmv = dem_property[type][5];
    int spp = 0;
    int spd = 0;
    cout << "迎面而来的是:" << dem_name[type] << "\n";
    cout << "HP = " << HPD << " || 攻击力 : " << atk << " || 防御力 : " << def << "\n";
    while(1){
    if(spd > spp){
    spp += speed;
    if(RP == 0)RP = 5;
    int harm = ((int)(atk * 3) - rand() % RP - defend) / 3;
    cout << dem_name[type] << "发动了攻击\n";
    int poss = rand() % 100;
    if(poss < 30){
    cout << "你机智的闪开了\n\n";
    }else{
    cout << "你受到了" << harm << "点伤害\n";
    HP -= harm;
    cout << "你的血量:" << HP << "/" << maxHP <<"\n\n";
    if(HP <= 0)if(!UDie())return false;
    }
    }else{
    cout << "输入你的作战指令(或Help)\n";
    string com;cin >> com;
    if(com == "Help" or com == "help" or com == "?"){
    cout << "------------------==战斗系统==-------------------\n";
    cout << "内核原理自己看代码(-_-)///\n";
    cout << "操作|Operator : \n";
    cout << "输入 '攻击' 进行攻击,使用物品方法不再赘述\n";
    cout << "输入'使用技能' +技能名称(编号) 发动技能\n";
    cout << "如果想逃跑,可以试试后果\n";
    cout << "-------------------------------------------------\n";
    continue;
    }else if(com == "使用物品" or com == "use" or com == "Use")use();
    else if(com == "攻击" or com == "atk"or com == "a" or com == "A"){
    int poss = rand()% 100;
    if(RP == 0)RP = 5;
    int harm = (rand() % RP + attack * 3 - def)/3;
    cout << "你发起了奋力一击\n";
    if(poss <= 30){
    cout << "却被" << dem_name[type] << "机智闪过了\n\n";
    }else{
    cout << dem_name[type] << "受到了" << harm << "点伤害\n";
    HPD -= harm;
    cout << "余剩" << HPD << "点生命值\n\n";
    if(HPD <= 0){
    cout << "哈,你击败了" <<dem_name[type] << "\n";
    cout << "获得了:\n";
    cout << " " << dem_property[type][2] << "个金币\n";
    cout << " " << dem_property[type][3] << "点经验\n";
    money += dem_property[type][2];
    EXP += dem_property[type][3];
    if(dem_property[type][4]){
    cout << " " << object[dem_property[type][4]] << " X1\n";
    myobj[dem_property[type][4]] ++;
    }
    return true;
    }
    }
    }else if(com == "使用技能" or com == "skill" or com == "s" or com == "S"){
    int asre = skil();
    if(asre == -1){
    cout << "您还没有学习该技能耶~~\n";
    continue;
    }
    if(asre == -2){
    cout << "你的魔法 ……已经用光了\n";
    continue;
    }
    if(asre != 0){
    HPD -= asre;
    cout << dem_name[type] << "受到了" << asre << "点伤害\n";
    cout << "余剩" << HPD << "点生命值\n\n";
    if(HPD <= 0){
    cout << "哈,你击败了" <<dem_name[type] << "\n";
    cout << "获得了:\n";
    cout << " " << dem_property[type][2] << "个金币\n";
    cout << " " << dem_property[type][3] << "点经验\n";
    money += dem_property[type][2];
    EXP += dem_property[type][3];
    if(dem_property[type][4]){
    cout << " " << object[dem_property[type][4]] << " X1\n";
    myobj[dem_property[type][4]] ++;
    }
    return true;
    }
    }
    }else if(com == "逃跑" or com == "run" or com == "Run" or com == "r"or com == "R"){
    int harm = atk;
    cout << "你受到了" <<harm << "点伤害\n";
    HP -= harm;
    cout << "你的血量:" << HP << "/" << maxHP <<"\n";
    if(HP <= 0)if(!UDie())return false;
    cout << "你成功逃跑\n";
    return true;
    }else{
    cout << "你说什么?我听不见~~!!\n";
    continue;
    }
    spd += dmv;
    }
    }
    return true;
    }
    int skil(){
    string com; cin >> com;
    for(int i = 0;i ^skl_num; i++){
    if(com == skl_name[i] or com[0] == i + 49){
    if(!skl_level[i])return -1;
    if(magic < skl_cost[i])return -2;
    int lv = skl_level[i];
    cout << "你使用了:" << skl_name[i] << "\n";
    magic -= skl_cost[i];
    cout << "你的魔法还剩:" << magic << "/" << maxMic << "\n";
    int harm = 0;
    if(i == 0){
    harm = 17 + lv * 3.5 + rand() % 5 + rand() % RP;
    }else if(i == 1){
    harm = 10 + rand() % (int)(lv * 5.5) + rand() % RP;
    }else if(i == 2){
    harm = 0;
    int heal = 20 + lv * 5 + rand() % RP;
    cout << "你恢复了" << heal << "点生命值\n";
    HP = min(HP + heal,maxHP);
    cout << "你的生命值:" << HP << "/" << maxHP << "\n";
    }
    return harm;
    }
    }
    return -1;
    }

  • @ 2018-02-04 15:38:21

    #include<iostream>
    #include<cstdio>
    #include<cstdlib>
    #include<algorithm>
    #include<cstring>
    #include<cmath>
    #include<conio.h>
    #include<ctime>
    #include<windows.h>
    using namespace std;
    int n=4;
    int map[100][100];
    char cmd='w';
    int score;
    bool alive;
    bool combined[100][100];
    int digit(int x)
    {
    int cnt=0;
    while(x!=0)x/=10,cnt++;
    return cnt;
    }
    void draw()
    {
    system("cls");
    printf("Score:%d\n",score);
    for(int k=1;k<=n;k++)
    {
    for(int i=1;i<=n;i++)printf(" -----");
    cout<<endl;
    for(int i=1;i<=2;i++)
    {
    for(int j=1;j<=n+1;j++)
    {
    cout<<"|";
    if(!map[k][j]||i==2)cout<<" ";
    else
    {
    int x=map[k][j],dig=digit(x);
    if(dig==5)printf("%d",x);
    if(dig==4)printf(" %d",x);
    if(dig==3)printf(" %d ",x);
    if(dig==2)printf(" %d ",x);
    if(dig==1)printf(" %d ",x);
    }
    }
    cout<<endl;
    }
    }
    for(int i=1;i<=n;i++)printf(" -----");
    }
    bool check()
    {
    for(int i=1;i<=n;i++)
    for(int j=1;j<=n;j++)
    if(!map[i][j]||map[i][j]==map[i-1][j]||map[i][j]==map[i+1][j]||map[i][j]==map[i][j-1]||map[i][j]==map[i][j+1])return 1;
    return 0;
    }
    bool checkw()
    {
    for(int i=2;i<=n;i++)
    for(int j=1;j<=n;j++)
    if(map[i][j]&&(map[i][j]==map[i-1][j]||!map[i-1][j]))return 1;
    return 0;
    }
    void movew()
    {
    for(int i=2;i<=n;i++)
    for(int j=1;j<=n;j++)
    {
    if(!map[i][j])continue;
    int tmpx=i-1;
    while(!map[tmpx][j]&&tmpx>0)tmpx--;
    if(map[tmpx][j]==map[i][j]&&!combined[tmpx][j]&&!combined[i][j])
    {
    map[tmpx][j]*=2;
    score+=(map[i][j]*2);
    combined[tmpx][j]=1;
    map[i][j]=0;
    continue;
    }
    }
    for(int k=1;k<=n;k++)
    {
    for(int i=2;i<=n;i++)
    for(int j=1;j<=n;j++)
    {
    if(!map[i][j])continue;
    int tmpx=i;
    while(!map[tmpx-1][j]&&tmpx>1)map[tmpx-1][j]=map[tmpx][j],map[tmpx][j]=0,swap(combined[tmpx-1][j],combined[tmpx][j]),tmpx--;
    }
    }
    }
    bool checks()
    {
    for(int i=1;i<n;i++)
    for(int j=1;j<=n;j++)
    if(map[i][j]&&(map[i][j]==map[i+1][j]||!map[i+1][j]))return 1;
    return 0;
    }
    void moves()
    {
    for(int i=1;i<n;i++)
    for(int j=1;j<=n;j++)
    {
    if(!map[i][j])continue;
    int tmpx=i+1;
    while(!map[tmpx][j]&&tmpx<=n)tmpx++;
    if(map[tmpx][j]==map[i][j]&&!combined[tmpx][j]&&!combined[i][j])
    {
    map[tmpx][j]*=2;
    score+=(map[i][j]*2);
    combined[tmpx][j]=1;
    map[i][j]=0;
    continue;
    }
    }
    for(int k=1;k<=n;k++)
    {
    for(int i=1;i<n;i++)
    for(int j=1;j<=n;j++)
    {
    if(!map[i][j])continue;
    int tmpx=i;
    while(!map[tmpx+1][j]&&tmpx<n)map[tmpx+1][j]=map[tmpx][j],map[tmpx][j]=0,swap(combined[tmpx+1][j],combined[tmpx][j]),tmpx++;
    }
    }
    }
    bool checka()
    {
    for(int i=1;i<=n;i++)
    for(int j=2;j<=n;j++)
    if(map[i][j]&&(map[i][j]==map[i][j-1]||!map[i][j-1]))return 1;
    return 0;
    }
    void movea()
    {
    for(int i=1;i<=n;i++)
    for(int j=2;j<=n;j++)
    {
    if(!map[i][j])continue;
    int tmpy=j-1;
    while(!map[i][tmpy]&&tmpy>0)tmpy--;
    if(map[i][tmpy]==map[i][j]&&!combined[i][tmpy]&&!combined[i][j])
    {
    map[i][tmpy]*=2;
    score+=(map[i][j]*2);
    combined[i][tmpy]=1;
    map[i][j]=0;
    continue;
    }
    }
    for(int k=1;k<=n;k++)
    {
    for(int i=1;i<=n;i++)
    for(int j=2;j<=n;j++)
    {
    if(!map[i][j])continue;
    int tmpy=j;
    while(!map[i][tmpy-1]&&tmpy>1)map[i][tmpy-1]=map[i][tmpy],map[i][tmpy]=0,swap(combined[i][tmpy-1],combined[i][tmpy]),tmpy--;
    }
    }
    }
    bool checkd()
    {
    for(int i=1;i<=n;i++)
    for(int j=1;j<n;j++)
    if(map[i][j]&&(map[i][j]==map[i][j+1]||!map[i][j+1]))return 1;
    return 0;
    }
    void moved()
    {
    for(int i=1;i<=n;i++)
    for(int j=1;j<n;j++)
    {
    if(!map[i][j])continue;
    int tmpy=j+1;
    while(!map[i][tmpy]&&tmpy<=n)tmpy++;
    if(map[i][tmpy]==map[i][j]&&!combined[i][tmpy]&&!combined[i][j])
    {
    map[i][tmpy]*=2;
    score+=(map[i][j]*2);
    combined[i][tmpy]=1;
    map[i][j]=0;
    continue;
    }
    }
    for(int k=1;k<=n;k++)
    {
    for(int i=1;i<=n;i++)
    for(int j=1;j<n;j++)
    {
    if(!map[i][j])continue;
    int tmpy=j;
    while(!map[i][tmpy+1]&&tmpy<n)map[i][tmpy+1]=map[i][tmpy],map[i][tmpy]=0,swap(combined[i][tmpy+1],combined[i][tmpy]),tmpy++;
    }
    }
    }
    int main()
    {
    memset(map,0,sizeof(map));
    alive=1;
    score=0;
    srand(time(NULL));
    printf("Welcome To 2048 Game!\n");
    printf("Please Use WASD To Move!\n");
    printf("Enter 'f' To Experience Random-Spin Mode!\n");
    char sp=_getch();
    printf("Input The Size Of The Table:");
    cin>>n;
    while(alive)
    {
    memset(combined,0,sizeof(combined));
    draw();
    if(sp!='f')Sleep(200);
    int x,y;
    do{x=rand()%n+1,y=rand()%n+1;}while(map[x][y]);
    int pos=rand()%6+1;
    if(pos==4)map[x][y]=4;

    else map[x][y]=2;
    draw();
    if(!check())
    {
    alive=0;
    break;
    }
    getin: if(sp!='f')cmd=_getch();
    else
    {
    if(rand()%2)
    {
    if(cmd=='w')cmd='d';
    else
    {
    if(cmd=='d')cmd='s';
    else
    {
    if(cmd=='s')cmd='a';
    if(cmd=='a')cmd='w';
    }
    }

    }
    else
    {
    if(cmd=='w')cmd='a';
    else
    {
    if(cmd=='a')cmd='s';
    else
    {
    if(cmd=='s')cmd='d';
    if(cmd=='d')cmd='w';
    }
    }
    }

    }
    if(cmd=='w')
    {
    if(checkw())movew();
    else goto getin;
    }
    if(cmd=='s')
    {
    if(checks())moves();
    else goto getin;
    }
    if(cmd=='a')
    {
    if(checka())movea();
    else goto getin;
    }
    if(cmd=='d')
    {
    if(checkd())moved();
    else goto getin;
    }
    }
    if(!alive)
    {
    cout<<endl<<"GameOver!";
    }
    }
    1.运行方法:编译运行

    2.按任意键进入游戏(按'f'进入自动疯狂旋转模式)

    3.之后输入棋盘大小(默认4x4)

    4.没有啦

  • @ 2018-02-04 15:35:48

    #include <cstdio>
    #include <iostream>
    #include <cmath>
    #include <cstring>
    #include <cstdlib>
    #include <vector>
    #include <queue>
    #include <list>
    #include <stack>
    #include <set>
    #include <string>
    #include <algorithm>
    #include <functional>
    #include <bitset>
    #include <ctime>
    #include <windows.h>
    #include <conio.h>
    #include <io.h>
    #include <process.h>
    using namespace std;
    int posx,posy;
    int maxx,maxy;
    int Round;
    char map[100][100];
    struct Bullet
    {
    int x;
    int y;
    int kind;
    }Enemy[10000];
    int BulletCnt;
    void color(int a)
    {
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), a);
    }
    void set_color(int num)
    {
    switch (num)
    {
    case 0:color(0); return;
    case 1:color(112); return;
    case 2:color(96); return;
    case 3:color(224); return;
    case 4:color(80); return;
    case 5:color(208); return;
    case 6:color(64); return;
    case 7:color(192); return;
    case 8:color(16); return;
    case 9:color(48); return;
    case 10:color(176); return;
    case 11:color(144); return;
    default:color(160); return;
    }
    }
    void HideCursor()

    {

    CONSOLE_CURSOR_INFO cursor_info = {1, 0};

    SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &cursor_info);

    }

    void Position(int x, int y)
    {
    COORD pos={y-1,x-1};
    HANDLE Out=GetStdHandle(STD_OUTPUT_HANDLE);
    SetConsoleCursorPosition(Out, pos);
    }
    void Erase(int x1,int y1,int x2,int y2)
    {
    for(int i=x1;i<=x2;i++)
    for(int j=y1;j<=y2;j++)
    Position(i,j),cout<<" ",map[i][j]=' ';
    }
    void Draw(char a[100][100],int x1,int y1,int x2,int y2)
    {
    for(int i=1;i<=x2-x1+1;i++)
    {
    for(int j=1;j<=y2-y1+1;j++)Position(x1+i-1,y1+j-1),cout<<a[i][j],map[i][j]=a[i][j];
    }
    }
    void Drawliney(char a,int x1,int x2,int y)//一条竖线
    {
    for(int i=x1;i<=x2;i++)
    Position(i,y),putchar(a),map[i][y]=a;
    }
    void Drawlinex(char a,int y1,int y2,int x)//一条横线
    {
    for(int i=y1;i<=y2;i++)
    Position(x,i),putchar(a),map[x][i]=a;
    }
    void Insert(string s1,char a[100][100])
    {
    int l=s1.length(),x=1,y=1;
    for(int i=0;i<l;i++)
    {
    if(s1[i]=='7')
    {
    x++;
    y=1;
    continue;
    }
    a[x][y]=s1[i];
    y++;
    }
    }
    void SpawnEnemyRandPos()
    {
    int x=rand()%10+1;
    int y=rand()%39+1;
    Position(x,y);
    cout<<"*";
    map[x][y]='*';
    Enemy[++BulletCnt].x=x,Enemy[++BulletCnt].y=y;
    }
    void Shoot(char x)
    {
    int yy=posy+2,xx=posx-1;
    while(1)
    {
    if(xx<=1)break;
    if(map[xx][yy]==' ')
    Position(xx,yy),cout<<x;
    xx--;
    }
    }
    int main()
    {
    srand(time(NULL));
    HideCursor();
    Drawliney('|',1,30,40);
    int speed=30;
    char a[100][100];
    Insert(" --- 7| |7| |7 --- ",a);
    Round=0;
    BulletCnt=0;
    Draw(a,1,1,4,5);
    posx=1,posy=1;
    maxx=23,maxy=35;
    while(1)
    {
    set_color(rand()%12);
    Round++;
    //if(Round%10==0)SpawnEnemyRandPos();
    if(GetKeyState(VK_SHIFT)<0)speed=100;
    else speed=30;
    if(GetKeyState(VK_UP)<0)
    {
    Shoot(' ');
    Erase(posx,posy,posx+3,posy+4);
    if(posx>1)posx--;
    Draw(a,posx,posy,posx+3,posy+4);
    }

    if(GetKeyState(VK_DOWN)<0)
    {
    Shoot(' ');
    Erase(posx,posy,posx+3,posy+4);
    if(posx<maxx)posx++;
    Draw(a,posx,posy,posx+3,posy+4);
    }
    if(GetKeyState(VK_LEFT)<0)
    {
    Shoot(' ');
    Erase(posx,posy,posx+3,posy+4);
    if(posy>1)posy--;
    Draw(a,posx,posy,posx+3,posy+4);
    }

    if(GetKeyState(VK_RIGHT)<0)
    {
    Shoot(' ');
    Erase(posx,posy,posx+3,posy+4);
    if(posy<maxy)posy++;
    Draw(a,posx,posy,posx+3,posy+4);
    }

    if(GetKeyState(90)<0)
    {
    Shoot('^');
    }

    else Shoot(' ');
    Sleep(speed);
    }
    // ---
    // | |
    // | |
    // ---

    }

  • @ 2018-02-04 13:05:25

    #include <bits/stdc++.h>
    using namespace std;
    int main(){
    int i,x,y,t=0,k;
    for(i=1;i<=7;i++){
    cin>>x>>y;
    if(x+y>8&&t==0){
    t=1;
    k=i;
    }
    }
    if(i==0)
    cout<<" ";
    else
    cout<<k;
    return 0;
    }

  • @ 2018-02-04 12:35:26

    说好的畅所欲言呢

  • @ 2018-02-03 13:52:07

    没有经验

  • @ 2018-02-03 13:51:55

    233

  • @ 2018-02-03 13:49:34

    哦吼吼

  • @ 2018-02-03 13:49:16

    23333333333

  • @ 2018-02-03 13:49:10

  • 1