Skip to content

Instantly share code, notes, and snippets.

@fourplusone
Forked from anonymous/gist:5311976
Created April 4, 2013 18:07
Show Gist options
  • Save fourplusone/5312659 to your computer and use it in GitHub Desktop.
Save fourplusone/5312659 to your computer and use it in GitHub Desktop.
// Test.cpp : Definiert den Einstiegspunkt für die Konsolenanwendung.
//
#include <iostream>
#include <vector>
#include <iterator>
typedef enum {
links = '1',
rechts = '2',
runter = '3'
} anweisung;
typedef enum {
gruen, rot, blau, gelb
} farbe;
anweisung a[10];
int b;
int k,s;
using namespace std;
void nach_links_bewegen(){
k--;
}
void nach_rechts_bewegen(void){
k++;
}
void stein_holen(void){
// ........
}
int main(void)
{
//Aufbau des Feldes
vector<farbe> stapel[3];
stapel[0].push_back(gruen);
stapel[0].push_back(rot);
stapel[0].push_back(gelb);
stapel[1].push_back(gruen);
stapel[1].push_back(gruen);
stapel[2].push_back(gruen);
stapel[2].push_back(gruen);
stapel[2].push_back(gelb);
anweisung a[] = {links, rechts, links, rechts,runter,links, rechts, links, rechts,runter};
cout<<a[0];
cout<<a[1];
cout<<a[2];
cout<<a[3];
cout<<a[4];
cout<<a[5];
cout<<a[6];
cout<<a[7];
cout<<a[8];
cout<<a[9];
//Bewegen des Krans
k=0;
b=0;
switch(a[b])
{
case links :{
nach_links_bewegen();
break;
}
case rechts :{
nach_rechts_bewegen();
break;
}
case runter : {
stein_holen();
break;
};
}
if( (k<0)||(k>3))
{
cout<<"Game over";
}
cout<<"\n"<<k;
cout<<"\n"<<s;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment