C++#include<bits/stdc++.h>
#include<conio.h>
#include<windows.h>
#define colorinit() {HANDLE hd=GetStdHandle(STD_OUTPUT_HANDLE);if(hd==INVALID_HANDLE_VALUE)return GetLastError();DWORD dm=0;if(!GetConsoleMode(hd,&dm))return GetLastError();dm|=0x0004;if(!SetConsoleMode(hd,dm))return GetLastError();}
#define setcolorf(fr,fg,fb) wprintf(L"\x1b[38;2;%d;%d;%dm",fr,fg,fb);
#define setcolorb(br,bg,bb) wprintf(L"\x1b[48;2;%d;%d;%dm",br,bg,bb);
#define setcolory() {setcolorf(204,204,204);setcolorb(12,12,12);}
using namespace std;
//class data
int coins=10;
int board[11][11]={
{0,0,0,0,0,0,0,0,0,0
},{0,0,0,0,0,0,0,0,0,0
},{0,0,8,0,0,0,8,0,0,0
},{0,0,0,0,0,0,0,0,0,0
},{0,0,0,0,8,0,8,0,0,0
},{0,0,0,0,0,0,0,0,0,0
},{0,0,8,0,8,0,8,0,8,0
},{0,0,0,0,0,0,0,0,0,0
},{0,0,0,0,0,0,8,0,8,0
},{0,0,0,0,0,0,0,0,0,0}
};
/*
0=blank
1=farm
2=market
3=fort
4=castle
5=lake
6=forest(4)
7=quarry(4)
8=enemy
9=forest(3)
10=forest(2)
11=forest(1)
12=quarry(3)
13=quarry(2)
14=quarry(1)
15=forest/quarry(0)
16=dead-enemy
*/
int initj[11]={6,5,7,1,6,2,5,1,6,5},initi[11]={7,6,7,6,7,6,7,6,7,6};
int hr[12][11],zr[11][12];
string timeseed;
int steptype[11];
//class display
int colczs[5][4]={
{254,76,97},//1~2 road
{255,193,22},//3~4 dig
{83,196,26},//5~9 build
{52,152,219}//0 use
};
void gotoxy(int x,int y){
HANDLE hout;
COORD pos;
pos.X=x;
pos.Y=y;
hout=GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorPosition(hout,pos);
return;
}
void hidecur(){
CONSOLE_CURSOR_INFO cursor_info={1,0};
SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE),&cursor_info);
return;
}
void setsize(int col,int row){
char cmd[64];
sprintf(cmd,"mode con cols=%d lines=%d",col,row);
system(cmd);
return;
}
void gettimeseed(){
time_t t=time(NULL);
struct tm *ntm=localtime(&t);
char strt[12];
strftime(strt,11,"%y%m%d%H%M",ntm);
timeseed=strt;
return;
}
void maindisplay(){
int rowcnt;
cout<<"+--------------------------------+-----------+\n|X ";
rowcnt++;
for(int i=0;i<10;i++){
setcolorf(colczs[steptype[i]][0],colczs[steptype[i]][1],colczs[steptype[i]][2]);
cout<<" "<<timeseed[i]<<" ";
}
setcolory();
cout<<"|Coins:";
setcolorf(255,193,22);
cout<<(coins/1000)<<(coins/100%10)<<(coins/10%10)<<(coins%10);
setcolory();
cout<<" |\n";
rowcnt++;
for(int i=0;i<10;i++){
setcolory();
cout<<"| ";
for(int j=0;j<11;j++){
cout<<" ";
if(j<10){
if(hr[i][j]){
setcolorf(241,196,15);
}
else{
setcolory();
}
cout<<"--";
}
}
setcolory();
cout<<(rowcnt++==2?"+-----------+":"|");
if(rowcnt^3)cout<<rowcnt-1;
cout<<"\n| ";
for(int j=0;j<11;j++){
if(zr[i][j]){
setcolorf(241,196,15);
}
else{
setcolory();
}
cout<<"|";
if(j<10){
if(board[i][j]==8){
setcolorf(231,76,60);
cout<<"/\\";
}
else if(board[i][j]==1){
setcolorf(94,185,94);
cout<<"--";
}
else if(board[i][j]==2){
setcolorf(102,198,255);
cout<<"/\\";
}
else if(board[i][j]==3){
setcolorf(142,68,173);
cout<<"__";
}
else if(board[i][j]==4){
setcolorf(241,196,15);
cout<<"^^";
}
else if(board[i][j]==5){
setcolorf(102,198,255);
cout<<"~~";
}
else if(board[i][j]==6){
setcolorf(153,102,0);
cout<<"||";
}
else if(board[i][j]==9){
setcolorf(153,102,0);
cout<<"||";
}
else if(board[i][j]==10){
setcolorf(153,102,0);
cout<<"||";
}
else if(board[i][j]==11){
setcolorf(153,102,0);
cout<<"| ";
}
else if(board[i][j]==7){
setcolorf(187,187,187);
cout<<"oo";
}
else if(board[i][j]==12){
setcolorf(187,187,187);
cout<<"oo";
}
else if(board[i][j]==13){
setcolorf(187,187,187);
cout<<"oo";
}
else if(board[i][j]==14){
setcolorf(187,187,187);
cout<<"o ";
}
else if(board[i][j]==15){
setcolorf(178,178,178);
cout<<"\\/";
}
else if(board[i][j]==16){
setcolorf(231,76,60);
cout<<"/X";
}
else{
setcolory();
cout<<" ";
}
}
}
setcolory();
cout<<"|"<<rowcnt++/**/<<"\n|";
setcolorf(colczs[steptype[i]][0],colczs[steptype[i]][1],colczs[steptype[i]][2]);
cout<<timeseed[i];
for(int j=0;j<11;j++){
if(zr[i][j]){
setcolorf(241,196,15);
}
else{
setcolory();
}
cout<<"|";
if(j<10){
if(board[i][j]==8){
setcolorf(231,76,60);
cout<<"\\/";
}
else if(board[i][j]==5){
setcolorf(102,198,255);
cout<<"~~";
}
else if(board[i][j]==6){
setcolorf(153,102,0);
cout<<"||";
}
else if(board[i][j]==9){
setcolorf(153,102,0);
cout<<"| ";
}
else if(board[i][j]==10){
setcolorf(153,102,0);
cout<<" ";
}
else if(board[i][j]==11){
setcolorf(153,102,0);
cout<<" ";
}
else if(board[i][j]==7){
setcolorf(187,187,187);
cout<<"oo";
}
else if(board[i][j]==12){
setcolorf(187,187,187);
cout<<"o ";
}
else if(board[i][j]==13){
setcolorf(187,187,187);
cout<<" ";
}
else if(board[i][j]==14){
setcolorf(187,187,187);
cout<<" ";
}
else if(board[i][j]==15){
setcolorf(178,178,178);
cout<<"/\\";
}
else if(board[i][j]==16){
setcolorf(231,76,60);
cout<<"X/";
}
else{
setcolory();
cout<<" ";
}
}
}
setcolory();
cout<<"|"<<rowcnt++/**/<<endl;
}
cout<<"| ";
for(int j=0;j<11;j++){
cout<<" ";
if(j<10){
if(hr[10][j]){
setcolorf(241,196,15);
}
else{
setcolory();
}
cout<<"--";
}
}
cout<<"|"<<rowcnt++/**/<<"\n+--------------------------------+";
return;
}
//class function
int randint(int a,int b){
return rand()%(b-a+1)+a;
}
char getkey(){
int getk;
while(1){
if(_kbhit){
getk=getch();
break;
}
}
switch(getk){
case 'H':
getk='w';
break;
case 'K':
getk='a';
break;
case 'P':
getk='s';
break;
case 'M':
getk='d';
break;
}
return getk;
}
int main(){
colorinit();
hidecur();
SetConsoleTitle("Tempus Imperium-made by shenhan");
if(1+1==2){/*setsize(70,2);
cout<<"Game init\nPlease press Up arrow";
while(1){
int cz=getkey();
if(cz=='w'){
break;
}
}
setsize(70,2);
cout<<"Game init\nPlease press Left arrow";
while(1){
int cz=getkey();
if(cz=='a'){
break;
}
}
setsize(70,2);
cout<<"Game init\nPlease press Down arrow";
while(1){
int cz=getkey();
if(cz=='s'){
break;
}
}
setsize(70,2);
cout<<"Game init\nPlease press Right arrow";
while(1){
int cz=getkey();
if(cz=='d'){
break;
}
}
setsize(70,3);
cout<<"Game init\nTurn off the Caps Lock!\nPlease press Z";
while(1){
int cz=getkey();
if(cz=='z'){
break;
}
}
setsize(70,2);
cout<<"Game init\nPlease press X";
while(1){
int cz=getkey();
if(cz=='x'){
break;
}
}
setsize(70,2);
cout<<"Game init\nPlease press C";
while(1){
int cz=getkey();
if(cz=='c'){
break;
}
}
setsize(70,2);
cout<<"Game init\nPlease press V";
while(1){
int cz=getkey();
if(cz=='v'){
break;
}
}
setsize(70,2);
cout<<"Game init\nPlease press B";
while(1){
int cz=getkey();
if(cz=='b'){
break;
}
}
setsize(70,2);
cout<<"Game init\nPlease press N";
while(1){
int cz=getkey();
if(cz=='n'){
break;
}
}
setsize(70,2);
cout<<"Game init\nPlease press M";
while(1){
int cz=getkey();
if(cz=='m'){
break;
}
}
setsize(70,1);
cout<<"Now don't press any key again while the game start...";
Sleep(2000);
setsize(80,16);
for(int i=10;i>-1;i--){
cout<<"_|_|_| _|_|_| _| _| _|_| _| _| _|_|\n";
cout<<" _| _| _|_| _|_| _| _| _| _| _| \n";
cout<<" _| _|_|_| _| _| _| _|_| _| _| _| \n";
cout<<" _| _| _| _| _| _| _| _|\n";
cout<<" _| _|_|_| _| _| _| _|_|_| _|_| \n\n";
cout<<"_|_|_| _| _| _|_| _|_|_| _|_| _|_|_| _| _| _| _|\n";
cout<<" _| _|_| _|_| _| _| _| _| _| _| _| _| _|_| _|_|\n";
cout<<" _| _| _| _| _|_| _|_|_| _|_| _| _| _| _| _| _|\n";
cout<<" _| _| _| _| _| _| _| _| _| _| _| _|\n";
cout<<"_|_|_| _| _| _| _|_|_| _| _| _|_|_| _|_|_| _| _|";
cout<<"\nTempusImperium GAME\nAuther: shenhan(shenhfr on CSDN,Extparxt_Helium on ACwing)\nHow to play:\nSee this link: https://postimg.cc/gallery/rrzTk3t\n"<<i;
Sleep(1000);
setsize(80,16);
}*/}
timeseed="2510181439";
//gettimeseed();
for(int i=0;i<10;i++){
if(!(timeseed[i]-'0')){
steptype[i]=3;
}
else if(timeseed[i]-'0'<3){
steptype[i]=0;
}
else if(timeseed[i]-'0'<5){
steptype[i]=1;
}
else{
steptype[i]=2;
}
}
setsize(128,40);
maindisplay();
return 0;
}