Esempio n. 1
0
BDDTestingSet1 getBDDTestingSet1(int pxmin, int pxmax, int qxmin, int qxmax) {
	BDDTestingSet1 result;
	auto manager = FOBDDManager::createManager();
	auto ts1 = getTestingSet1();
	result.ts1 = ts1;
	result.manager = manager;
	auto factory = FOBDDFactory(manager);
	result.truebdd = manager->truebdd();
	result.falsebdd = manager->falsebdd();
	result.x = manager->getVariable(ts1.x);
	result.px = factory.turnIntoBdd(ts1.px);
	result.qx = factory.turnIntoBdd(ts1.qx);
	result.pxandqx = manager->conjunction(result.px,result.qx);

	result.p0vq0 = factory.turnIntoBdd(ts1.p0vq0);
	result.Axpx = factory.turnIntoBdd(ts1.Axpx);
	result.nAxpx = factory.turnIntoBdd(ts1.nAxpx);
	result.nExqx = factory.turnIntoBdd(ts1.nExqx);

	auto prange = new IntRangeInternalSortTable(pxmin, pxmax);
	Universe u = Universe( { ts1.sorttable });
	auto ptp = new PredTable(prange, u);
	auto pxinter = new PredInter(ptp, true);

	auto qrange = new IntRangeInternalSortTable(qxmin, qxmax);
	auto ptq = new PredTable(qrange, u);
	auto qxinter = new PredInter(ptq, true);

	ts1.structure->changeInter(ts1.p, pxinter);
	ts1.structure->changeInter(ts1.q, qxinter);

	return result;
}
Esempio n. 2
0
int main() {

	Universe universe = Universe(1, 1, 2, 2);
	//universe.printUniverse();
	UniverseManager universeManager = UniverseManager(&universe);
	universeManager.runSim();
					
	return 0;
}
void Node::setNumUniverses(int _num)
{
    
    if (unis.size()) {
        std::cout<<"Error: Must call addUniverses() only once and before setup()."<<std::endl;
        return;
    }
    
    for (int i=0; i<_num; i++) {
        unis.push_back( Universe(i,i+1) );
    }
    
}
Esempio n. 4
0
void Interpreter::doPushField(long bytecodeIndex) {
    uint8_t fieldIndex = method->GetBytecode(bytecodeIndex + 1);
    vm_oop_t self = GetSelf();
    vm_oop_t o;

    if (unlikely(IS_TAGGED(self))) {
        o = nullptr;
        Universe()->ErrorExit("Integers do not have fields!");
    }
    else {
        o = ((VMObject*)self)->GetField(fieldIndex);
    }

    GetFrame()->Push(o);
}
Esempio n. 5
0
//main body of game
int main() {
    int width = 60;
    int height = width;
    int cursorX = 0;
    int cursorY = 0;
    std::vector< std::vector<bool> > Universe(height+2, std::vector<bool>(width+2));
    std::vector< std::vector<bool> > Next(height+2, std::vector<bool>(width+2));
    TCODConsole::initRoot(width+12, height, "Life", false);
    TCODRandom rnd = TCODRandom();
    int rndVal = 0;
    bool hidden = false;
    int time = 0;

//render initial state
    render(cursorX,cursorY,Universe,hidden,time);

//keeps game going
    while ( !TCODConsole::isWindowClosed() ) {
        TCOD_key_t key;
//check if key has been pressed
        TCODSystem::checkForEvent(TCOD_EVENT_KEY_PRESS, &key,NULL);
        switch(key.vk) {
//up
            case TCODK_UP :
                cursorY = (cursorY - 1);
            break;
//down
            case TCODK_DOWN :
                cursorY = (cursorY + 1);
            break;
//left
            case TCODK_LEFT :
                cursorX = (cursorX - 1);
            break;
//right
            case TCODK_RIGHT :
                cursorX = (cursorX + 1);
            break;

//not a special character
            case TCODK_CHAR :
//flip cell
                if(key.c == 'f'){
                    if(Universe[cursorX+1][cursorY+1])
                        Universe[cursorX+1][cursorY+1] = false;
                    else
                        Universe[cursorX+1][cursorY+1] = true;
                    time = 0;
                }
//step time
                else if(key.c == 's'){
                    update(Universe, Next);
                    time++;
                }
//clear Universe
                else if(key.c == 'c'){
                    for (int I = 1; I <= width; I++){
                        for (int J =1; J <=height; J++){
                            Universe[I][J] = false;
                        }
                    }
                    time = 0;
                }
//randomly fill Universe
                else if(key.c == 'r'){
                    for (int I = 1; I <= width; I++){
                        for (int J =1; J <=height; J++){
                            rndVal = rnd.getInt(1,100);
                            if (rndVal>50)
                                Universe[I][J] = false;
                            else
                                Universe[I][J] = true;
                        }
                    }
                    time = 0;
                }
//hide cursor
                else if(key.c == 'h'){
                    if(hidden)
                        hidden = false;
                    else
                        hidden = true;
                }
            break;

//default
            default:break;
        }

//handle cursor wrapping (% was giving issues when going to -1)
        if (cursorY >= height)
            cursorY = cursorY - height;
        else if (cursorY < 0)
            cursorY = cursorY + height;

        if (cursorX >= width)
            cursorX = cursorX - width;
        else if (cursorX < 0)
            cursorX = cursorX + width;

//render current state
        render(cursorX,cursorY,Universe,hidden,time);

//flush the screen buffer
        TCODConsole::flush();
    }

    return 0;
}