Maquina de TUring c++ INTENTO
Enviado por belux • 10 de Enero de 2020 • Tarea • 1.183 Palabras (5 Páginas) • 141 Visitas
#include <Windows.h>
#include <string>
using namespace std;
void gotoxy(int x, int y) {//Ancho =80 Alto=25
HANDLE hcon = GetStdHandle(STD_OUTPUT_HANDLE);
COORD dwPos;
dwPos.X = x;
dwPos.Y = y;
SetConsoleCursorPosition(hcon, dwPos);
}
void TextoXY(int x, int y, string texto){
gotoxy(x, y);
cout << texto; //<< "\n";
}
void InforCurso(int Size, bool Visible) {
HANDLE hcon = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_CURSOR_INFO cci;
cci.dwSize = Size;
cci.bVisible = Visible;
SetConsoleCursorInfo(hcon, &cci);
}
void LineaHorizontal(int Hx1, int Hx2, int Hy){
for (int x = Hx1; x <= Hx2; x++)
{
gotoxy(x, Hy);
cout << "-";
}
}
void LineaVertical(int Vx, int Vy1, int Vy2){
for (int y = Vy1; y <= Vy2; y++)
{
gotoxy(Vx, y);
cout << "|";
}
}
void Texto2(int x, int y, char numero){
gotoxy(x, y);
cout << numero; //<< "\n";
}
void Rectangulo(int x1, int y1, int x2, int y2){
LineaHorizontal(x1 + 1, x2 - 1, y1);
LineaHorizontal(x1 + 1, x2 - 1, y2);
LineaVertical(x1, y1 + 1, y2 - 1);
LineaVertical(x2, y1 + 1, y2 - 1);
Texto2(x1, y1, '+');
Texto2(x1, y2, '+');
Texto2(x2, y1, '+');
Texto2(x2, y2, '+');
}
void Rectangulo_limpia(int x1,int y2,int XSixe, int YSixe){
string espacio="";
espacio.append(XSixe,' ');
for(int y=0;y<YSixe;y++){
gotoxy(x1,y2+y);
cout<<espacio;
}
}
void LogError(int x7 , int y7){
TextoXY(x7, y7 , " __________________ ___________ ");
TextoXY(x7, y7+1 , "_/ __ \\_ __ \\_ __ \\/ _ \\_ __ \\");
TextoXY(x7, y7+2 , "\\ ___/| | \\/| | \\( <_> ) | \\/");
TextoXY(x7, y7+3 , " \\___ >__| |__| \\____/|__| ");
TextoXY(x7, y7+4 , " \\/ ");
}
void LogDone(int x7 , int y7){
TextoXY(x7, y7 , " .___ ");
TextoXY(x7, y7+1 , " __| _/____ ____ ____ ");
TextoXY(x7, y7+2 , " / __ |/ _ \\ / \\_/ __ \\ ");
TextoXY(x7, y7+3 , "/ /_/ ( <_> ) | \\ ___/ ");
TextoXY(x7, y7+4 , "\\____ |\\____/|___| /\\___ >");
TextoXY(x7, y7+5 , " \\/ \\/ \\/");
}
void LOGO(int x6, int y6) {
TextoXY(x6, y6, " __ __ ");
TextoXY(x6, y6 + 1, "| |__ ____ _____ ____ | | __________________ ");
TextoXY(x6, y6 + 2, "| | \\ / _ \\ / \\ / _ \\| |/ / _ \\_ __ \\__ \\ ");
TextoXY(x6, y6 + 3, "| Y ( <_> ) Y Y ( <_> ) ( <_> ) | \\// __ \\_");
TextoXY(x6, y6 + 4, "|___| /\\____/|__|_| /\\____/|__|_ \\____/|__| (____ /");
TextoXY(x6, y6 + 5, " \\/ \\/ \\/ \\/ ");
}
//Maquina de Turing
#include <iostream>
#include <conio.h>
#include <stdlib.h>
#include <string.h>
#include <fstream>
/////////////////////////
/////////////////////////
#define Izquierda 75
#define Derecha 77
#define Arriba 72
#define Abajo 80
#define Espacio 32
///////////////////////
using namespace std;
///////STRUCT////////////////////////////////////
struct Condicion{
Condicion *siguiente;
string inserccion;
string escritura;
string movimiento;
string SigEstado;
};
struct Box{
string simbolo;
Box *Der;
Box *Izq;
};
struct Estado{
Estado *Izq;
string Nomb_Est;
Condicion *rul;
};
//*///////////////////////
//
////Variantes Globales//////////////////////////////////////////////
Estado *Nod_Pil=NULL;
Box *CaDna=NULL;
string direccion;
string cad_asig;
string Alfabeto;
string HE;//error
string E;//vacio
string S0;//lado que comienza
bool veri_FIN=true;
bool seguimiento=true, condic=false;
int UbComeX=2,UbComY=8;
//*//////////////////////////////////////////////
void juego();
void disenio();
void NuevoAll();
void crear_Cond(Condicion *&);
void crear_Cad(Box *&,string);
void crear_Estado(Estado *&,string);
void Del_cond(Condicion *&);
void Del_Cad(Box *&);
void Del_Estado(Estado *&);
void Del_Nodos(Estado *&);
void Del_CadAll(Box *&);
void Buq_Est(Estado *&,Estado *&,string , bool );
void Camb_Est(Estado *&,string);
void verificacion(string );
void ingresionTXT();
void ptTXT();
void botones();
void ingresion_cad();
void Buq_Cond(Condicion *&,Condicion *&,string ,string );
void Movimiento(Box *&Ubicacion,Box *&devuelve,string movm);
void almacenamiento(string );
bool verific_acep(Box *&,string);
/////MAIN////////////////////////////////////////////
int main(){
system("cls");
disenio();
LOGO(30,13);
ingresionTXT();
ingresion_cad();
juego();
disenio();
if(seguimiento){
LogDone(30,13);
}else{
LogError(30,13);
}
botones();
}
//////DISENIO////////Mesa de Trabajo =(2,5,116,25)=(2,5,118,30)///////////////////////////////////
/*
void mostLis(Box *a){
if(a==NULL){
cout<<endl;
return;
}else{
cout<<"Pila:"<<a->simbolo<<",";
mostLis(a->siguiente);
}
}
void mostCon(Condicion *a){
if(a==NULL){
return;
}else{
cout<<"Condicion:"<<a->inserccion<< " = "<<a->top<< " = "<<a->insert2<<
...