首页 > 其他分享 >chinese game

chinese game

时间:2023-07-22 21:44:15浏览次数:26  
标签:chinese int px py game && home include

0.0.0版本震撼来袭

代码:

#include<bits/stdc++.h>
#include<windows.h>
#include<conio.h>
using namespace std;
int px=10,py=5,ma=0;
string jie[100005]={"这是墙壁,你不能通过","这是地面,上面似乎布满了灰尘"};
string dui[100005]={"墙","地","人"};
int home[5][15][15]={{
{},
{1,0,0,0,0,0,0,0,0,0},
{1,0,1,1,1,1,1,1,1,1,0},
{1,0,1,1,1,1,1,1,1,1,0},
{1,0,1,1,1,1,1,1,1,1,0},
{1,0,1,1,1,1,1,1,1,1,0},
{1,0,1,1,1,1,1,1,1,1,0},
{1,0,1,1,1,1,1,1,1,1,0},
{1,0,1,1,1,1,1,1,1,1,0},
{1,0,1,1,1,1,1,1,1,1,0},
{1,1,1,1,1,1,1,1,1,1,1},
}};
void print(){
    for(int i=1;i<=10;i++){
        for(int j=1;j<=10;j++){
            if(i==px&&j==py){
                cout << dui[2];
                continue;
            }
            cout << dui[home[ma][i][j]];
        }
        cout << "\n";
    }
    return ;
}
void step(){
    char c;
    if(c=getch()){
        if(c=='q'){
            cout << "请输入上下左右来查看旁边的情况\n";
            char f;
            f=getch();
            if(f=='w'){
                cout << jie[home[ma][px-1][py]];
            }else if(f=='s'){
                cout << jie[home[ma][px+1][py]];
            }else if(f=='a'){
                cout << jie[home[ma][px][py-1]];
            }else if(f=='d'){
                cout << jie[home[ma][px][py+1]];
            }
            cout << "\n输入任意键继续";
            f=getch();
        }
        else if(c=='w'&&px-1>0&&home[ma][px-1][py]!=0)px--;
        else if(c=='s'&&px+1<=10&&home[ma][px+1][py]!=0)px++;
        else if(c=='a'&&py-1>0&&home[ma][px][py-1]!=0)py--;
        else if(c=='d'&&py+1<=10&&home[ma][px][py+1]!=0 )py++;
        system("cls");
    }
    return ;
}

int main(){
    while(1){
        print();
        step();
    }
}

标签:chinese,int,px,py,game,&&,home,include
From: https://www.cnblogs.com/hyfly2000/p/17574327.html

相关文章

  • [ABC310G] Takahashi And Pass-The-Ball Game
    ProblemStatementThereare$N$Takahashi.The$i$-thTakahashihasaninteger$A_i$and$B_i$balls.Aninteger$x$between$1$and$K$,inclusive,willbechosenuniformlyatrandom,andtheywillrepeatthefollowingoperation$x$times.Forevery$i$,......
  • 103.Mr. Liang play Card Game
    杭电第一场补题103.Mr.LiangplayCardGame题目:有n张卡片,每一个卡片有自己的类型,等级、初始等级都是1。有以下两种操作:选择一张卡片打出去,获得权值为:val_{type_i}*p^{level-1}选择两个相邻,且相同种类,相同等级的卡片进行合并,合并之后等级+1.输出可以获得的最大权值......
  • 「解题报告」CF1067D Computer Game
    快国赛了,写点水题玩吧。首先容易有一个贪心策略:先以某种最优策略一直进行,直到成功一次后一直选择\(b_ip_i\)最大的进行。我们可以列出一个DP,设\(f_T\)表示在\(T\)时刻内期望最大收益,容易写出:\[f_T=\max\{p_i((T-1)v+a_i)+(1-p_i)f_{T-1}\}\]看起来就是可......
  • 【刷题笔记】55. Jump Game
    题目Givenanarrayofnon-negativeintegers,youareinitiallypositionedatthefirstindexofthearray.Eachelementinthearrayrepresentsyourmaximumjumplengthatthatposition.Determineifyouareabletoreachthelastindex.Example1:Input:......
  • poj 2311 Cutting Game (sg函数)
    小记:这题是对sg函数的初步理解。对于sg函数只要g[x]==0,则此时为必败态。x作为后继,我们就要对所有的后继进行标记,然后mex之。因为每次只能切一刀,所以切完之后,会有两块方格,而对每一块方格进行游戏又会有一个sg函数值,所以根据sg函数的性质,它这一刀所代表的后继,即为这两块方格的sg函......
  • Python pygame实现中国象棋单机版源码
    今天给大家带来的是关于Python实战的相关知识,文章围绕着用Pythonpygame实现中国象棋单机游戏版展开,文中有非常详细的代码示例,需要的朋友可以参考下#-*-coding:utf-8-*-"""CreatedonSunJun1315:41:562021@author:Administrator"""importpygamefrompygame.local......
  • Cutting Game
    题目来源:POJ2311CuttingGame题意给定一张\(N*M\)的矩形网格纸,两名玩家轮流行动。在每一次行动中,可以任选一张矩形网格纸,沿着某一行或者某一列的格线,把它剪成两部分。首先剪出\(1*1\)的玩家获胜。两名玩家都采取最优策略行动,求先手是否必胜。\[1\leqslantN,M\leqslant......
  • LWC 51:682. Baseball Game
    LWC51:682.BaseballGame传送门:682.BaseballGameProblem:You’renowabaseballgamepointrecorder.Givenalistofstrings,eachstringcanbeoneofthe4followingtypes:Integer(oneround’sscore):Directlyrepresentsthenumberofpointsyougetinthis......
  • LWC 50:679. 24 Game
    LWC50:679.24Game传送门:679.24GameProblem:Youhave4cardseachcontaininganumberfrom1to9.Youneedtojudgewhethertheycouldoperatedthrough*,/,+,-,(,)togetthevalueof24.Example1:Input:[4,1,8,7]Output:TrueExplanation:(8-4)......
  • CF842E Nikita and game 题解
    题意一棵树初始只有一个编号为1的根结点。\(n\)次操作,每次新增一个点作为\(p_i\)的子结点,询问更新后有多少点可以作为树直径的端点。\(n\le3\times10^5\)。题解以下\(dist(x,y)\)表示点\(x\)与点\(y\)在树上的距离。不难发现若干条直径必然叠合于至少一点,任选这......