Example #1
0
void getMatrix(int Row, int Col, int RowCount, int ColCount, int Matrix[MaxRows][MaxColumns])
{
    drawEmptyMatrix(0,0, Row, Col, RowCount, ColCount );
    //Zahlenabfrage
  
    for(i=0; i < RowCount; i++)
    {
        for (j = 0; j < ColCount; j++)
        {

            BACKCOLOR_BLUE;
            POSITION((Row+i),(Col+3 + (7*j)));
            while(!scanf("%i", &Matrix[i][j]) || Matrix[i][j] <= -1000
                                              || Matrix[i][j] >= 10000 )
            {
                drawEmptyMatrix(i, j, Row, Col, RowCount, ColCount ); 
                clearBuffer();
                ATTRIBUTE_OFF;
                POSITION((Row + i), Col+3+(7*j));
                BACKCOLOR_BLUE;
            }
            POSITION((Row + i), Col + 2 +(7*j));
            printf("%4i", Matrix[i][j]);
            ATTRIBUTE_OFF;
        }
    }
}
Example #2
0
//  Eingabe-Abfrage
void getNumber(int Row, int Col, int *number) 
{
    POSITION (Row, Col);
    while(!scanf("%i", number))
    {
        clearBuffer();
        POSITION (Row, Col);
        printf("                                                                         ");
        POSITION (Row, Col);
    }
}
Example #3
0
void CInsertControlDlg::DoDataExchange(CDataExchange* pDX)
{
   int iItem;
   POSITION posControl;

	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CInsertControlDlg)
	DDX_Control(pDX, IDC_SERVERPATH, m_staticServerPath);
	DDX_Control(pDX, IDC_REQUIREDCATEGORIES, m_butRequiredCategories);
	DDX_Control(pDX, IDC_IGNOREREQUIREDCATEGORIES, m_butIgnoreRequiredCategories);
	DDX_Control(pDX, IDOK, m_butOK);
	DDX_Control(pDX, IDC_CONTROLS, m_lbControls);
	//}}AFX_DATA_MAP

   if( pDX->m_bSaveAndValidate )
   {
	  iItem = m_lbControls.GetCurSel();
	  if( iItem == LB_ERR )
	  {
		 m_clsid = CLSID_NULL;
	  }
	  else
	  {
		 posControl = POSITION( m_lbControls.GetItemDataPtr( iItem ) );
		 ASSERT( posControl != NULL );
		 m_clsid = m_lControls.GetAt( posControl );
	  }
   }
}
Example #4
0
Image::Image(Entity *entity) : AComponent(entity, T_IMAGE, 0, 1)
{
  POSITION(entity);
  VISIBILITY(entity);
  ROTATION(entity);
  this->bitmap = NULL;
}
Example #5
0
    //leere Matrix zeichnen
    void drawEmptyMatrix(int x, int y, int Row, int Col, int RowCount, int ColCount)
    {
    for(k=x; k < RowCount ; k++)
        {

        POSITION((Row+k),Col);
        printf("|");
            for (l=y; l < ColCount; l++)
            {     
            POSITION((Row+k),(Col+1+(7*l)));
            CLEAR_LINE;
            BACKCOLOR_BLUE;
            printf(" ---- ");
            ATTRIBUTE_OFF;
            }
        printf("|");
        }
    }
Example #6
0
char*
StringBitBoard(BitBoard bitBoard)
{
  const int LINE_LENGTH = 36;
  const int LINE_COUNT = 18;

  // TODO: Reduce duplication from StringChessSet.

  // Include space for newlines.
  char ret[LINE_LENGTH * LINE_COUNT + 1 + 1000];
  int file, offset, rank;
  Position pos;
  Side lineSide = Black;

  char *topLine    = "    A   B   C   D   E   F   G   H  \n";
  char *dottedLine = "  ---------------------------------\n";
  char *blackLine  = "  |   |...|   |...|   |...|   |...|\n";
  char *whiteLine  = "  |...|   |...|   |...|   |...|   |\n";

  // Add top lines.
  strncpy(ret, topLine, LINE_LENGTH);
  strncpy(ret+LINE_LENGTH, dottedLine, LINE_LENGTH);

  for(rank = Rank8; rank >= Rank1; rank--) {
    offset = 2*LINE_LENGTH + 2*LINE_LENGTH*(Rank8-rank);

    // Add line.
    strncpy(ret + offset, lineSide == White ? whiteLine : blackLine, LINE_LENGTH);

    // Add number.
    ret[offset] = '1'+rank;

    // Add pieces.

    // For the sake of debugging, avoid PieceAt() in case it is buggy.

    offset += 4;
    for(file = FileA; file <= FileH; file++) {
      pos = POSITION(rank, file);

      if((bitBoard&POSBOARD(pos)) == POSBOARD(pos)) {
        ret[offset] = 'X';
      }

      offset += 4;
    }

    // Add dotted line.
    strncpy(ret + offset, dottedLine, LINE_LENGTH);

    lineSide = OPPOSITE(lineSide);
  }

  ret[LINE_LENGTH * LINE_COUNT] = '\0';

  return strdup(ret);
}
Example #7
0
//Text einlesen
void getText(unsigned char *text)
{
    *text = 0;
    do
    {
        POSITION(10, 1);
        scanf("%150[^\n]", text);
        clearBuffer();
    }while (Strlen(text) == 0);
}
Example #8
0
BoundingBox::BoundingBox(Entity *entity) :
  AComponent(entity, T_BOUNDING_BOX),
  width_(0),
  height_(0),
  collidable_(true),
  marginX_(0),
  marginY_(0)
{
  POSITION(entity);
}
Example #9
0
void getMatrix(int Row, int Col, int RowCount, int ColCount, int Matrix[MaxRows][MaxColumns])
{
  int i,j,k;

  for(i = 0; i < RowCount; i++)
  {
    POSITION( (Row+i),(Col));
    CLEAR_LINE;
    printf("| ");
    for(j = 0; j < ColCount; j++)
    {
      printf("---- ");
    }
    printf("|\n");
  }

  for(i = 0; i < RowCount; i++)
  {
    for(j = 0; j < ColCount; j++)
    {
      POSITION( (Row + i),(Col + 2 + (5*j)) );
      while( !(scanf("%i", &Matrix[i][j])) )  //Einlesen aktuelles Element
      {  //Bei Falscheingabe:
	POSITION( (Row + i),Col );
	printf("| ");
	for (k = 0; k < j; k++)  //Neuschreiben der bisherigen Eingaben der Zeile
	{
	  printf("%4i ", Matrix[i][k]);
	}
	for (k = k; k < ColCount; k++)  //Neuschreiben der Platzhalter für einzuschreibende Elemente der Zeile
	{
	  printf("---- ");
	}
	printf("|");
	clearBuffer();
	POSITION( (Row + i),(Col + 2 + (5 * j)) );  //Zurück an Position aktuell einzulesenden Elements springen
      }
      POSITION( (Row + i),(Col + 2 + (5 * j)) );
      printf("%4i", Matrix[i][j]);
    }
  }
}
/*----------------------------------------------------------------*/
void input_analyze_data_range_load_next(input_data_t *uf)
{
    Data_header *d;
    char *c, field_name[3];
    int i; /*, rvalue, index; */
    signed short *spt;
    Field_header *f;
    Mandatory_header_block *m;

    m = (Mandatory_header_block *)uf->data;
    d = (Data_header *)(POSITION(uf->data, m->data_header));
    c = (char *)d + sizeof(Data_header);
    for (i=0; i<d->num_flds_rec; ++i, c+=4)
    {
	memcpy(field_name, c, 2);
	field_name[2] = 0;
	spt = (signed short *)(c + 2);
	f = (Field_header *)(POSITION(uf->data, *spt));
	add_to_fields(uf->data, m, f, field_name);
    }
}
Example #11
0
int getNumberOfColumns(int Row, int Col, int MatrixNo)
{
    int number;
    POSITION(Row, Col);
    printf("Geben Sie bitte die Spaltenzahl  der %i. Matrix ein (1...%i):____", MatrixNo, MaxRows);
    getNumber(Row, 62, &number);
   while( number < 1 || number > MaxColumns)
    {
        getNumber(Row, 62, &number); 
    }

   return number;
}
Example #12
0
int getNumberOfRows(int Row, int Col, int MatrixNo)
{
  int number;
  POSITION(Row,Col);
  printf("Geben Sie bitte die Zeilenanzahl  der %i. Matrix ein (1..%i): ", MatrixNo, MaxRows);

  getNumber(Row, 62, &number);
  while( (number < 1) || (number > MaxRows))
  {
    getNumber(Row, 62, &number);
  }

  return number;
}
Example #13
0
int askAgain(int Row, int Col)
{
char W;
while(!scanf("%[jJnN]", &W))
{
      POSITION(Row, Col);
      CLEAR_LINE;
      printf("Moechten Sie noch einmal (j/n) "); // Eingabeaufforderung
      clearBuffer();
}
    if (W == 'j' || W == 'J')
    {
        return 1;
    }
    return 0;
}
Example #14
0
void printMatrix(int Row, int Col, int RowCount, int ColCount, int Matrix[MaxRows][MaxColumns])
{
  int i,j;
  

  for (i = 0; i < RowCount; i++)
  {
    POSITION( (Row+i),Col);
    printf("| ");
    for (j = 0; j < ColCount; j++)
    {
      printf("%4i ", Matrix[i][j]);
    }
    printf("|");
  }
}
Example #15
0
void					Image::draw()
{
  Position				*position = POSITION(this->entity);
  unsigned char				opacity = VISIBILITY(this->entity)->opacity;
  float					angle = ROTATION(this->entity)->angle;

  if (this->bitmap)
    al_draw_tinted_rotated_bitmap(this->bitmap,
				  al_map_rgba(opacity, opacity, opacity, opacity),
				  angle == 0 ? 0 : al_get_bitmap_width(this->bitmap) / 2,
				  angle == 0 ? 0 : al_get_bitmap_height(this->bitmap) / 2,
				  angle == 0 ? position->x : position->x + al_get_bitmap_width(this->bitmap) / 2,
				  angle == 0 ? position->y : position->y + al_get_bitmap_height(this->bitmap) / 2,
				  angle,
				  0);
}
Example #16
0
void printMatrix(int Row, int Col, int RowCount, int ColCount, int Matrix[MaxRows][MaxColumns])
{
drawEmptyMatrix(0,0, Row, Col, RowCount, ColCount);


    for(i=0; i < RowCount; i++)
    {
        for (j = 0; j < ColCount; j++)
        {

            BACKCOLOR_BLUE;
            POSITION((Row + i), Col + 2 +(7*j));
            printf("%4i",Matrix[i][j]);
            ATTRIBUTE_OFF;
        }
    }
}
Example #17
0
void prData(Agnode_t * n, int pass)
{
    char *pname;
    char *bname;
    char *tname;
    char *name1;
    char *name2;
    int dist1, dist2;

    if (PARENT(n))
	pname = agnameof(PARENT(n));
    else
	pname = "<P0>";
    if (BLOCK(n))
	bname = agnameof(BLOCK(n)->sub_graph);
    else
	pname = "<B0>";
    fprintf(stderr, "%s: %x %s %s ", agnameof(n), FLAGS(n), pname, bname);
    switch (pass) {
    case 0:
	fprintf(stderr, "%d %d\n", VAL(n), LOWVAL(n));
	break;
    case 1:
	if (TPARENT(n))
	    tname = agnameof(TPARENT(n));
	else
	    tname = "<ROOT>";
	dist1 = DISTONE(n);
	if (dist1 > 0)
	    name1 = agnameof(LEAFONE(n));
	else
	    name1 = "<null>";
	dist2 = DISTTWO(n);
	if (dist2 > 0)
	    name2 = agnameof(LEAFTWO(n));
	else
	    name2 = "<null>";
	fprintf(stderr, "%s %s %d %s %d\n", tname, name1, dist1, name2,
		dist2);
	break;
    default:
	fprintf(stderr, "%d\n", POSITION(n));
	break;
    }
}
Example #18
0
void CInsertControlDlg::OnControlsSelChange()
{
   int iItem;
   POSITION posControl;
   CString strServerPath;
   CLSID clsid;
   CDC dc;
   CFont* pFont;
   LPTSTR pszServerPath;
   CRect rect;
   CFont* pOldFont;

   iItem = m_lbControls.GetCurSel();
   if( iItem != LB_ERR )
   {
	  m_butOK.EnableWindow( TRUE );
	  posControl = POSITION( m_lbControls.GetItemDataPtr( iItem ) );
	  clsid = m_lControls.GetAt( posControl );
	  GetClassServerPath( clsid, strServerPath );

	  dc.CreateCompatibleDC( NULL );

	  pFont = m_staticServerPath.GetFont();
	  pOldFont = dc.SelectObject( pFont );

	  // Workaround for SHLWAPI bug (in weird cases, PathCompactPath actually
	  // expands the pathname)
	  pszServerPath = strServerPath.GetBuffer( MAX_PATH+2 );
	  m_staticServerPath.GetWindowRect( &rect );
	  PathCompactPath( dc, pszServerPath, rect.Width() );
	  strServerPath.ReleaseBuffer();

	  dc.SelectObject( pOldFont );

	  m_staticServerPath.SetWindowText( strServerPath );
   }
   else
   {
	  m_butOK.EnableWindow( FALSE );
	  m_staticServerPath.SetWindowText( NULL );
   }
}
/*----------------------------------------------------------------*/
static void add_to_fields(char *uf,
			  Mandatory_header_block *m,
			  Field_header *f, char *name)
{
    data_range_t *d;
    signed short *spt;        /* pointer to short */
    int i; /*, j, j0, j1;*/
    double value;

    d = find_field(name);
    if (d == NULL)
        d = add_field(name);

    spt = (signed short *)(POSITION(uf, f->position));
    for (i=0; i<f->num_samples; ++i, ++spt)
    {
	if (*spt == m->missing)
	    continue;
	value = (double)(*spt)/(double)(f->scale_factor);
	add_to_field(d, value);
    }
    return;
}
Example #20
0
int					BoundingBox::getCenterX() const
{
  return (this->width_ / 2) + this->marginX_ + POSITION(this->entity)->x;
}
Example #21
0
int					BoundingBox::getYY() const
{
  return POSITION(this->entity)->y + this->marginY_ + this->height_;
}
Example #22
0
int					BoundingBox::getXX() const
{
  return POSITION(this->entity)->x + this->marginX_ + this->width_;
}
Example #23
0
// ASCII-art representation of chessboard.
char*
StringChessSet(ChessSet *chessSet)
{
  const int LINE_LENGTH = 36;
  const int LINE_COUNT = 18;

  // Include space for newlines.
  char ret[LINE_LENGTH * LINE_COUNT + 1 + 1000];
  char pieceChr;
  int file, offset, rank;
  Piece piece;
  Position pos;
  Side side;
  Side lineSide = Black;

  char *topLine    = "    A   B   C   D   E   F   G   H  \n";
  char *dottedLine = "  ---------------------------------\n";
  char *blackLine  = "  |   |...|   |...|   |...|   |...|\n";
  char *whiteLine  = "  |...|   |...|   |...|   |...|   |\n";

  // Add top lines.
  strncpy(ret, topLine, LINE_LENGTH);
  strncpy(ret+LINE_LENGTH, dottedLine, LINE_LENGTH);

  // Outputs chess set as ascii-art.
  // pieces are upper-case if white, lower-case if black.
  // P=pawn, R=rook, N=knight, B=bishop, Q=queen, K=king, .=empty square.

  // e.g., the initial position is output as follows:-

  //     A   B   C   D   E   F   G   H
  //   ---------------------------------
  // 8 | r |.n.| b |.q.| k |.b.| n |.r.|
  //   ---------------------------------
  // 7 |.p.| p |.p.| p |.p.| p |.p.| p |
  //   ---------------------------------
  // 6 |   |...|   |...|   |...|   |...|
  //   ---------------------------------
  // 5 |...|   |...|   |...|   |...|   |
  //   ---------------------------------
  // 4 |   |...|   |...|   |...|   |...|
  //   ---------------------------------
  // 3 |...|   |...|   |...|   |...|   |
  //   ---------------------------------
  // 2 | P |.P.| P |.P.| P |.P.| P |.P.|
  //   ---------------------------------
  // 1 |.R.| N |.B.| Q |.K.| B |.N.| R |
  //   ---------------------------------

  for(rank = Rank8; rank >= Rank1; rank--) {
    offset = 2*LINE_LENGTH + 2*LINE_LENGTH*(Rank8-rank);

    // Add line.
    strncpy(ret + offset, lineSide == White ? whiteLine : blackLine, LINE_LENGTH);

    // Add number.
    ret[offset] = '1'+rank;

    // Add pieces.

    // For the sake of debugging, avoid PieceAt() in case it is buggy.

    offset += 4;
    for(file = FileA; file <= FileH; file++) {
      pos = POSITION(rank, file);

      pieceChr = '\0';

      for(side = White; side <= Black; side++) {
        for(piece = Pawn; piece <= King; piece++) {
          if((chessSet->Sets[side].Boards[piece]&POSBOARD(pos)) == POSBOARD(pos)) {
            switch(piece) {
            case Pawn:
              pieceChr = 'P';
              break;
            case Rook:
              pieceChr = 'R';
              break;
            case Knight:
              pieceChr = 'N';
              break;
            case Bishop:
              pieceChr = 'B';
              break;
            case Queen:
              pieceChr = 'Q';
              break;
            case King:
              pieceChr = 'K';
              break;
            default:
              panic("Impossible.");
            }
            goto loop;
          }
        }
      }
    loop:
      if(pieceChr != '\0') {
        if(side == Black) {
          pieceChr += 32;
        }
        ret[offset] = pieceChr;
      }

       offset += 4;
    }

    // Add dotted line.
    strncpy(ret + offset, dottedLine, LINE_LENGTH);

    lineSide = OPPOSITE(lineSide);
  }

  ret[LINE_LENGTH * LINE_COUNT] = '\0';

  return strdup(ret);
}
Example #24
0
nodelist_t *layout_block(Agraph_t * g, block_t * sn, double min_dist)
{
    Agnode_t *n;
    Agraph_t *copyG, *tree, *subg;
    nodelist_t *longest_path;
    nodelistitem_t *item;
    int N, k;
    double theta, radius, largest_node;
    largest_node = 0;

    subg = sn->sub_graph;
    block_graph(g, sn);		/* add induced edges */

    copyG = remove_pair_edges(subg);

    tree = spanning_tree(copyG);
    longest_path = find_longest_path(tree);
    place_residual_nodes(subg, longest_path);
    /* at this point, longest_path is a list of all nodes in the block */

    /* apply crossing reduction algorithms here */
    longest_path = reduce_edge_crossings(longest_path, subg);

    N = sizeNodelist(longest_path);
    largest_node = largest_nodesize(longest_path);
    /* N*(min_dist+largest_node) is roughly circumference of required circle */
    if (N == 1)
	radius = 0;
    else
	radius = (N * (min_dist + largest_node)) / (2 * PI);

    for (item = longest_path->first; item; item = item->next) {
	n = item->curr;
	if (ISPARENT(n)) {
	    /* QUESTION: Why is only one parent realigned? */
	    realignNodelist(longest_path, item);
	    break;
	}
    }

    k = 0;
    for (item = longest_path->first; item; item = item->next) {
	n = item->curr;
	POSITION(n) = k;
	PSI(n) = 0.0;
	theta = k * ((2.0 * PI) / N);

	ND_pos(n)[0] = radius * cos(theta);
	ND_pos(n)[1] = radius * sin(theta);

	k++;
    }

    if (N == 1)
	sn->radius = largest_node / 2;
    else
	sn->radius = radius;
    sn->rad0 = sn->radius;

    /* initialize parent pos */
    sn->parent_pos = -1;

    agclose(copyG);
    return longest_path;
}
Example #25
0
int main()
{
    double Op1, Op2, Erg; //Operanden und Ergebnisvariabeln
    int Menuewahl, GueltigeEingabe;
    char Dummy;

    do
    {
        //Menue anzeigen
        CLEAR;
        HOME;
        printf("Einfacher Taschenrechner\n");
        printf("========================\n");
        POSITION(3, 4);
        printf("1. Addition\n");
        POSITION(4, 4);
        printf("2. Subtraktion\n");
        POSITION(5, 4);
        printf("3. Multiplikation\n");
        POSITION(6, 4);
        printf("4. Division\n");
        POSITION(7, 4);
        printf("9. Programmende\n");
        
        CLEAR_LINE;
        POSITION(9, 1);
        INVERSE;
        printf("Ihre wahl: ");
        ATTRIBUTE_OFF;
        GueltigeEingabe = scanf("%i", &Menuewahl);
        do
        {
            scanf("%c", &Dummy);
        }while (Dummy != '\n');
        
        //Wahl Rechenart oder Programmende
        if (GueltigeEingabe)        //if true
        {
            POSITION(11,1);
            switch(Menuewahl)
            {
                case 1: printf("Addition\n");
                        printf("--------\n");
                        break;
                case 2: printf("Subtraktion\n");
                        printf("-----------\n");
                        break;
                case 3: printf("Multiplikation\n");
                        printf("--------------\n");
                        break;
                case 4: printf("Division\n");
                        printf("--------\n");
                        break;
                default: GueltigeEingabe = 0;
                        break;
            }
            
            if (GueltigeEingabe) //ausser bei Programmende
            { 
                    do
                    {
                        scanf("%c", &Dummy);
                    }while (Dummy != '\n');
                //Operand 1 erfragen
                do
                {
                    POSITION(14, 1); //Eingabezeile loeschen
                    printf("Geben Sie bitte den ersten Operanden ein: ");
                    GueltigeEingabe = scanf("%lf", &Op1);
                    do
                    {
                        scanf("%c", &Dummy);
                    } while (Dummy != '\n');
                    if (GueltigeEingabe == 0)
                    {
                        POSITION(15, 1);
                        printf("falsche Eingabe!\n");
                    }
                } while (!GueltigeEingabe);
                //Operand 2 erfragen
                do
                {
                    POSITION(15, 1);
                    printf("Geben Sie bitte den zweiten Operanden ein: ");
                    GueltigeEingabe = scanf("%lf", &Op2);
                    do
                    {
                        scanf("%c", &Dummy);
                    } while (Dummy != '\n');
                    if (GueltigeEingabe == 0)
                        printf("falsche Eingabe\n");
                    else if (Menuewahl == 4 && Op2 == 0.0)
                    {
                        printf("Division durch 0");
                        GueltigeEingabe  = 0;;
                    }
                } while (!GueltigeEingabe);
            }
            //Werte ausgeben
            POSITION(18,1);
            switch(Menuewahl)
            {  
                case 1: Erg = Op1 + Op2;
                        printf("%lf + %lf = %lf\n", Op1, Op2, Erg);
                        break;
                case 2: Erg = Op1 - Op2;
                        printf("%lf - %lf = %lf\n", Op1, Op2, Erg);
                        break;
                case 3: Erg = Op1 * Op2;
                        printf("%lf * %lf = %lf\n", Op1, Op2, Erg);
                        break;
                case 4: Erg = Op1 / Op2;
                        printf("%lf / %lf = %lf\n", Op1, Op2, Erg);
                        break;
                case 9: break;
                default: printf("falsche Eingabe!\n");
                         break;
            }
        }
        else
        {
            printf("falsche Eingabe!");
        } 
        POSITION(20, 1);
        INVERSE;
        FORECOLOR_KOBALT;
        printf("Bitte druecken Sie die Eingabetaste ...\n");
        ATTRIBUTE_OFF;
        do
        {
         scanf("%c",&Dummy);
        } while (Dummy != '\n');
    } while (Menuewahl != 9); // Programmaustieg

    printf("ciao ciao\n");
    return 0;
}
Example #26
0
int					BoundingBox::getCenterY() const
{
  return (this->height_ / 2) + this->marginY_ + POSITION(this->entity)->y;
}
Example #27
0
void clearScreen()
{
CLEAR;
POSITION(1, 1);
}
Example #28
0
// aus dem Skript "Grundlagen der Informatik", Kap. 6.3
int main()
{
  char Dummy; // für Tastaturpuffer-Löschen
  int Menuewahl; // Benutzereingabe Menüauswahl
  int Eingabe; // Ergebnis von scanf
  double X; // Laufvariable
  double X_Von, X_Bis; // Ausgabegrenzen
  double X_Schrittweite; // Ausgabeschrittweite
  do
  {
    // Menue ausgeben
    CLEAR; // Bildschirm löschen
    HOME;
    printf("Sinus & Co.\n");
    printf("===========\n\n");
    printf("1. sin(x)\n");
    printf("2. cos(x)\n");
    printf("3. tan(x)\n");
    printf("9. Programmende\n\n");
    // Benutzereingabe Menue
    do
    {
      POSITION(9, 1); // Eingabezeile löschen
      CLEAR_LINE;
      POSITION(9, 1);
      printf("Ihre Wahl: ");
      Eingabe = scanf("%i", &Menuewahl);
      do // Tastaturpuffer loeschen
	scanf("%c", &Dummy);
      while (Dummy != '\n');
      if (Eingabe) // wenn Zahl eingegeben
      { // dann pruefen, ob gueltig
	POSITION(11, 1);
	switch(Menuewahl)
	{
	case 1: printf("SINUS\n-----\n"); break;
	case 2: printf("COSINUS\n-------\n"); break;
	case 3: printf("TANGENS\n-------\n"); break;
	case 9: printf("PROGRAMMENDE\n\n"); break;
	default: Eingabe = 0;
	}
      }
    } while (!Eingabe); // solange bis gültiger
    // Menüpunkt gewählt wurde
    if (Menuewahl != 9) // außer bei Programmende
    {
      // Startwert erfragen
      do
      {
	POSITION(14, 1); // Eingabezeile löschen
	CLEAR_LINE;
	POSITION(14, 1);
	printf("Von x = ");
	Eingabe = scanf("%lf", &X_Von);
	Seite
	  2
	  von
	  3
	  G. Kempfer, BHT Berlin, TI-B IN1, Übungsblatt 6
	  do // Tastaturpuffer loeschen
	    scanf("%c", &Dummy);
	  while (Dummy != '\n');
      } while (!Eingabe); // solange bis gültige Eingabe
      // Endwert erfragen
      do
      {
	POSITION(15, 1); // Eingabezeile löschen
	CLEAR_LINE;
	POSITION(15, 1);
	printf("Bis x = ");
	Eingabe = scanf("%lf", &X_Bis);
	do // Tastaturpuffer loeschen
	  scanf("%c", &Dummy);
	while (Dummy != '\n');
	if (Eingabe)
	  if (X_Von > X_Bis) // Ausgabegrenzen prüfen
	    Eingabe = 0;
      } while (!Eingabe); // solange bis gültige Eingabe
      // Schrittweite erfragen
      do
      {
	POSITION(16, 1); // Eingabezeile löschen
	CLEAR_LINE;
	POSITION(16, 1);
	printf("Schrittweite = ");
	Eingabe = scanf("%lf", &X_Schrittweite);
	do // Tastaturpuffer loeschen
	  scanf("%c", &Dummy);
	while (Dummy != '\n');
      } while (!Eingabe); // solange bis gültige Eingabe
      // Werte ausgeben
      POSITION(18, 1);
      printf(" X | f(x)\n");
      printf("---------|---------\n");
      for (X = X_Von; X <= X_Bis; X += X_Schrittweite)
      {
	switch(Menuewahl)
	  {
	  case 1: printf("%f | %f\n", X, sin(X)); break;
	  case 2: printf("%f | %f\n", X, cos(X)); break;
	  case 3: printf("%f | %f\n", X, tan(X)); break;
	  }
      }
      // Eingabetaste abwarten
      printf("\nBitte Eingabetaste druecken ...");
      do
	scanf("%c", &Dummy);
      while (Dummy != '\n');
    }
  } while (Menuewahl != 9); // solange bis Programmende
  return 0;
}
// this is run after all the clicking and decision to move are made
void CHUZZLE_BOARD::logic(CP_OBJECT_MANAGER<TILE> &manager)
{
    std::list<counted_ptr<TILE> > nukable;
    GRID_DATA temp = data;

    int rotate_count = 0;

    bool no_nukable = true;

    if ((direction == N) || (direction == S))
    {
        for (int c = 0; c < data.height(); c++)
        {
            rotate_count = c;
            temp.rotate(selection.x, direction);
            //nukable =

            int nukable_size = temp.find_nukable();
//            nukable = temp.remove_nukable();
            if (nukable_size > 0)
            {
/*
                // add all nuked to the manager
                for (std::list<counted_ptr<TILE> >::iterator i = nukable.begin(); i != nukable.end(); i++)
                {
//                    (*i)->ungrid();
                    manager.add(counted_ptr<TILE>(*i));
                }
*/
                no_nukable = false;
                break;
            }
        }
        if (!no_nukable)
        {
            rotate_count++;
            for (int c = 0; c < rotate_count; c++)
            {
                data.rotate(selection.x, direction);
            }
            data.shove_line(selection.x, direction);
            data.shove_all();
        }
    }
    else if ((direction == E) ||(direction == W))
    {
        for (int c = 0; c < data.width(); c++)
        {
            rotate_count = c;
            temp.rotate(selection.y, direction);
            //nukable =
            int nukable_size = temp.find_nukable();
//            nukable = temp.remove_nukable();
            if (nukable_size > 0)
            {
/*
                // add all nuked to the manager
                for (std::list<counted_ptr<TILE> >::iterator i = nukable.begin(); i != nukable.end(); i++)
                {
//                    (*i)->ungrid();
                    manager.add(counted_ptr<TILE>(*i));
                }
*/
                no_nukable = false;
                break;
            }
        }
        if (!no_nukable)
        {
            rotate_count++;
            for (int c = 0; c < rotate_count; c++)
            {
                data.rotate(selection.y, direction);
            }
            data.shove_line(selection.y, direction);
            data.shove_all();
        }
    }

    if ((direction == N) || (direction == S))
    {
        for(int y = 0; y < data.height(); y++)
        {
            counted_ptr<TILE> &t  = data.at(POSITION(selection.x, y));
            if (no_nukable)
                t->shove(t->pos, direction, false);
        }
    }
    else if ((direction == E) ||(direction == W))
    {
        for(int x = 0; x < data.width(); x++)
        {
            counted_ptr<TILE> &t  = data.at(POSITION(x, selection.y));
            if (no_nukable)
                t->shove(t->pos, direction, false);
        }
    }
}