Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/GAP/pkg/simpcomp/src/   (Algebra von RWTH Aachen Version 4.15.1©)  Datei vom 18.2.2022 mit Größe 1 kB image not shown  

Quelle  randomize_complex.cpp   Sprache: C

 
//
//  randomize_complex.cpp
//  Bistellar
//
//  Created by Alexander Thumm on 19.10.11.
//  Copyright 2011 -. All rights reserved.
//

#include "randomize_complex.h"

#include <stdlib.h>
#include <time.h>

void randomize_complex(MovableComplex & complex, const std::vector< unsigned int > & ;allowedMoves, unsigned int rounds)
{
    // initialize the RNG
    srand(static_cast<unsigned int>(time(0)));
    
    for (int currentRound = 0; currentRound < rounds; currentRound++)
    {
        int numberOfCodimensions = 0;
        for (int i = 0; i < allowedMoves.size(); i++)
        {
            if (complex.hasValidMoves(allowedMoves[i]))
                numberOfCodimensions++;
        }
        
        if (numberOfCodimensions == 0)
            break;
        
        int codimension = 0;
        for (int i = 0, r = rand() % numberOfCodimensions; i < allowedMoves.size() && r >= 0; i++)
        {
            if (complex.hasValidMoves(allowedMoves[i]))
            {
                codimension = allowedMoves[i];
                r--;
            }
        }
        
        bistellar_move_list_t validMoves = complex.validMoves(codimension);
        BistellarMove move = validMoves.at(rand() % validMoves.size());
        complex.moveComplex(move);
    }
}

81%


¤ Dauer der Verarbeitung: 0.8 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung ist noch experimentell.