コード例 #1
0
void loop(){
	//This function is called once per second.  Use it to control the satellite.
	updateVariables();
	
	facePos(center); //Always face the center
	
	if((timeToFlare>2||timeToFlare==-1)&&!on){ //Turn sphere back on
	    game.turnOn();
	    on=true;
	}
	else if(timeToFlare!=-1&&timeToFlare<=2&&on){ //Auto Shutdown, doesn't let sphere be on during solar flare
	    game.turnOff();
	    on=false;
	}
	if(game.getMemoryFilled()<2&&poiZone<2&&(timeToFlare>12||timeToFlare==-1)&&time<230){ //If we have memory space and no incoming solar flare
    	switch(poiZone){
	        case 0: //Outer Ring
                calcPoiEntry(spherePoi,tP1,.4425f);//.430f
	            safeSetPosition(tP1,.2f);//.15
	            break;
    	    case 1: //Inner Ring
	            calcPoiEntry(spherePoi,tP1,.3725f);//.370f
	            safeSetPosition(tP1,.2f);//.15
	            break;
	    }
	    mathVecSubtract(tempVec,center,myState,3);
	    if(distance(myState,tP1)<.025f&&mathVecInner(tP1,tempVec,3)<.05f){ //If in range, take picture
	        game.takePic(spherePoi);
	        picTries++;
	        if(game.getMemoryFilled()>lastMem||picTries>7){ //Successfully taken picture or stuck taking pic, go to next poi
	            poiZone++;
	        }
	    }
	}else{ //Solar Flare incoming
	    if(game.getMemoryFilled()>0){ //Upload pictures in memory
	        //float memPack[] = {-.5,sphere*.6,0};
            calcPoiEntry(spherePoi,tP1,.7);
	        safeSetPosition(tP1,.15f);
	        game.uploadPic();
    	    if(distance(myState,center)>.5){
	            game.uploadPic();
	            picTries=0;
	            poiZone=0;
	        }
    	}else{ //Stop
    	    api.setVelocityTarget(center);
    	    game.takePic(spherePoi);
    	}
	}
}
コード例 #2
0
void
Albany::MpasSTKMeshStruct::constructMesh(
                                               const Teuchos::RCP<const Epetra_Comm>& comm,
                                               const Teuchos::RCP<Teuchos::ParameterList>& params,
                                               const unsigned int neq_,
                                               const Albany::AbstractFieldContainer::FieldContainerRequirements& req,
                                               const Teuchos::RCP<Albany::StateInfoStruct>& sis,
                                               const std::vector<int>& indexToVertexID, const std::vector<int>& indexToMpasVertexID, const std::vector<double>& verticesCoords, const std::vector<bool>& isVertexBoundary, int nGlobalVertices,
                                               const std::vector<int>& verticesOnTria,
                                               const std::vector<bool>& isBoundaryEdge, const std::vector<int>& trianglesOnEdge, const std::vector<int>& trianglesPositionsOnEdge,
                                               const std::vector<int>& verticesOnEdge,
                                               const std::vector<int>& indexToEdgeID, int nGlobalEdges,
                                               const std::vector<int>& indexToTriangleID,
                                               const unsigned int worksetSize,
                                               int numLayers, int Ordering)
{
	this->SetupFieldData(comm, neq_, req, sis, worksetSize);

    int elemColumnShift = (Ordering == 1) ? 3 : elem_map->NumGlobalElements()/numLayers;
    int lElemColumnShift = (Ordering == 1) ? 3 : 3*indexToTriangleID.size();
    int elemLayerShift = (Ordering == 0) ? 3 : 3*numLayers;

    int vertexColumnShift = (Ordering == 1) ? 1 : nGlobalVertices;
    int lVertexColumnShift = (Ordering == 1) ? 1 : indexToVertexID.size();
    int vertexLayerShift = (Ordering == 0) ? 1 : numLayers+1;

    int edgeColumnShift = (Ordering == 1) ? 2 : 2*nGlobalEdges;
    int lEdgeColumnShift = (Ordering == 1) ? 1 : indexToEdgeID.size();
    int edgeLayerShift = (Ordering == 0) ? 1 : numLayers;


  metaData->commit();

  bulkData->modification_begin(); // Begin modifying the mesh

  stk::mesh::PartVector nodePartVec;
  stk::mesh::PartVector singlePartVec(1);
  stk::mesh::PartVector emptyPartVec;
  std::cout << "elem_map # elments: " << elem_map->NumMyElements() << std::endl;
  unsigned int ebNo = 0; //element block #???

  singlePartVec[0] = nsPartVec["Bottom"];

  AbstractSTKFieldContainer::IntScalarFieldType* proc_rank_field = fieldContainer->getProcRankField();
  AbstractSTKFieldContainer::VectorFieldType* coordinates_field = fieldContainer->getCoordinatesField();

  for(int i=0; i< (numLayers+1)*indexToVertexID.size(); i++)
  {
	  int ib = (Ordering == 0)*(i%lVertexColumnShift) + (Ordering == 1)*(i/vertexLayerShift);
	  int il = (Ordering == 0)*(i/lVertexColumnShift) + (Ordering == 1)*(i%vertexLayerShift);

	  stk::mesh::Entity node;
	  if(il == 0)
		  node = bulkData->declare_entity(stk::topology::NODE_RANK, il*vertexColumnShift+vertexLayerShift * indexToVertexID[ib]+1, singlePartVec);
	  else
		  node = bulkData->declare_entity(stk::topology::NODE_RANK, il*vertexColumnShift+vertexLayerShift * indexToVertexID[ib]+1, nodePartVec);

      double* coord = stk::mesh::field_data(*coordinates_field, node);
	  coord[0] = verticesCoords[3*ib];   coord[1] = verticesCoords[3*ib+1]; coord[2] = double(il)/numLayers;
  }

  int tetrasLocalIdsOnPrism[3][4];

  for (int i=0; i<elem_map->NumMyElements()/3; i++) {

	 int ib = (Ordering == 0)*(i%(lElemColumnShift/3)) + (Ordering == 1)*(i/(elemLayerShift/3));
	 int il = (Ordering == 0)*(i/(lElemColumnShift/3)) + (Ordering == 1)*(i%(elemLayerShift/3));

	 int shift = il*vertexColumnShift;

	 singlePartVec[0] = partVec[ebNo];


     //TODO: this could be done only in the first layer and then copied into the other layers
     int prismMpasIds[3], prismGlobalIds[6];
     for (int j = 0; j < 3; j++)
	 {
    	 int mpasLowerId = vertexLayerShift * indexToMpasVertexID[verticesOnTria[3*ib+j]];
    	 int lowerId = shift+vertexLayerShift * indexToVertexID[verticesOnTria[3*ib+j]];
    	 prismMpasIds[j] = mpasLowerId;
		 prismGlobalIds[j] = lowerId;
		 prismGlobalIds[j + 3] = lowerId+vertexColumnShift;
	 }

     tetrasFromPrismStructured (prismMpasIds, prismGlobalIds, tetrasLocalIdsOnPrism);


     for(int iTetra = 0; iTetra<3; iTetra++)
     {
    	 stk::mesh::Entity elem  = bulkData->declare_entity(stk::topology::ELEMENT_RANK, elem_map->GID(3*i+iTetra)+1, singlePartVec);
		 for(int j=0; j<4; j++)
		 {
			 stk::mesh::Entity node = bulkData->get_entity(stk::topology::NODE_RANK, tetrasLocalIdsOnPrism[iTetra][j]+1);
			 bulkData->declare_relation(elem, node, j);
		 }
		 int* p_rank = (int*)stk::mesh::field_data(*proc_rank_field, elem);
		 p_rank[0] = comm->MyPID();
     }


  }


  singlePartVec[0] = ssPartVec["lateralside"];

  //first we store the lateral faces of prisms, which corresponds to edges of the basal mesh
  int tetraSidePoints[4][3] = {{0, 1, 3}, {1, 2, 3}, {0, 3, 2}, {0, 2, 1}};
  std::vector<int> tetraPos(2), facePos(2);

  std::vector<std::vector<std::vector<int> > > prismStruct(3, std::vector<std::vector<int> >(4, std::vector<int>(3)));
  for (int i=0; i<indexToEdgeID.size()*numLayers; i++) {
	 int ib = (Ordering == 0)*(i%lEdgeColumnShift) + (Ordering == 1)*(i/edgeLayerShift);
	 if(isBoundaryEdge[ib])
	 {
		 int il = (Ordering == 0)*(i/lEdgeColumnShift) + (Ordering == 1)*(i%edgeLayerShift);
		 int lBasalElemId = trianglesOnEdge[2*ib];
		 int basalElemId = indexToTriangleID[lBasalElemId];

		 //TODO: this could be done only in the first layer and then copied into the other layers
		 int prismMpasIds[3], prismGlobalIds[6];
		 int shift = il*vertexColumnShift;
		 for (int j = 0; j < 3; j++)
		 {
			 int mpasLowerId = vertexLayerShift * indexToMpasVertexID[verticesOnTria[3*lBasalElemId+j]];
			 int lowerId = shift+vertexLayerShift * indexToVertexID[verticesOnTria[3*lBasalElemId+j]];
			 prismMpasIds[j] = mpasLowerId;
			 prismGlobalIds[j] = lowerId;
			 prismGlobalIds[j + 3] = lowerId+vertexColumnShift;
		 }

		  tetrasFromPrismStructured (prismMpasIds, prismGlobalIds, tetrasLocalIdsOnPrism);


		for(int iTetra = 0; iTetra<3; iTetra++)
		  {
			 std::vector<std::vector<int> >& tetraStruct =prismStruct[iTetra];
			 stk::mesh::EntityId tetraPoints[4];
			 for(int j=0; j<4; j++)
			 {
                           tetraPoints[j] = tetrasLocalIdsOnPrism[iTetra][j]+1;
				// std::cout<< tetraPoints[j] << ", ";
			 }
			 for(int iFace=0; iFace<4; iFace++)
			 {
				 std::vector<int>&  face = tetraStruct[iFace];
				 for(int j=0; j<3; j++)
				 	 face[j] = tetraPoints[tetraSidePoints[iFace][j]];
			 }
		  }



		 int basalVertexId[2] = {indexToVertexID[verticesOnEdge[2*ib]]*vertexLayerShift, indexToVertexID[verticesOnEdge[2*ib+1]]*vertexLayerShift};
		 std::vector<int> bdPrismFaceIds(4);

		 bdPrismFaceIds[0] = indexToVertexID[verticesOnEdge[2*ib]]*vertexLayerShift+vertexColumnShift*il+1;
		 bdPrismFaceIds[1] = indexToVertexID[verticesOnEdge[2*ib+1]]*vertexLayerShift+vertexColumnShift*il+1;
		 bdPrismFaceIds[2] = bdPrismFaceIds[0]+vertexColumnShift;
		 bdPrismFaceIds[3] = bdPrismFaceIds[1]+vertexColumnShift;

		 //std::cout<< "bdPrismFaceIds: (" << bdPrismFaceIds[0] << ", " << bdPrismFaceIds[1] << ", " << bdPrismFaceIds[2] << ", " << bdPrismFaceIds[3] << ")"<<std::endl;



		 setBdFacesOnPrism (prismStruct, bdPrismFaceIds, tetraPos, facePos);

		 int basalEdgeId = indexToEdgeID[ib]*2*edgeLayerShift;
		 for(int k=0; k< tetraPos.size(); k++)
		 {
			 int iTetra = tetraPos[k];
			 int iFace = facePos[k];
			 stk::mesh::Entity elem = bulkData->get_entity(stk::topology::ELEMENT_RANK, il*elemColumnShift+elemLayerShift * basalElemId +iTetra+1);
			 std::vector<int>& faceIds = prismStruct[iTetra][iFace];
			 stk::mesh::Entity side = bulkData->declare_entity(metaData->side_rank(), edgeColumnShift*il+basalEdgeId+k+1, singlePartVec);
			 bulkData->declare_relation(elem, side,  iFace );
			 for(int j=0; j<3; j++)
			 {
				 stk::mesh::Entity node = bulkData->get_entity(stk::topology::NODE_RANK, faceIds[j]);
				 bulkData->declare_relation(side, node, j);
			 }
		 }
	 }
  }

  //then we store the lower and upper faces of prisms, which corresponds to triangles of the basal mesh

  edgeLayerShift = (Ordering == 0) ? 1 : numLayers+1;
  edgeColumnShift = 2*(elemColumnShift/3);

  singlePartVec[0] = ssPartVec["basalside"];

  int edgeOffset = 2*nGlobalEdges*numLayers;
  for (int i=0; i<indexToTriangleID.size(); i++)
  {
	  stk::mesh::Entity side = bulkData->declare_entity(metaData->side_rank(), indexToTriangleID[i]*edgeLayerShift+edgeOffset+1, singlePartVec);
	  stk::mesh::Entity elem  = bulkData->get_entity(stk::topology::ELEMENT_RANK,  indexToTriangleID[i]*elemLayerShift+1);
	  bulkData->declare_relation(elem, side,  3);
	  for(int j=0; j<3; j++)
	  {
		 stk::mesh::Entity node = bulkData->get_entity(stk::topology::NODE_RANK, vertexLayerShift*indexToVertexID[verticesOnTria[3*i+j]]+1);
		 bulkData->declare_relation(side, node, j);
	  }
  }

  singlePartVec[0] = ssPartVec["upperside"];

  for (int i=0; i<indexToTriangleID.size(); i++)
  {
	stk::mesh::Entity side = bulkData->declare_entity(metaData->side_rank(), indexToTriangleID[i]*edgeLayerShift+numLayers*edgeColumnShift+edgeOffset+1, singlePartVec);
	stk::mesh::Entity elem  = bulkData->get_entity(stk::topology::ELEMENT_RANK,  indexToTriangleID[i]*elemLayerShift+(numLayers-1)*elemColumnShift+1+2);
	bulkData->declare_relation(elem, side,  1);
	for(int j=0; j<3; j++)
	{
	  stk::mesh::Entity node = bulkData->get_entity(stk::topology::NODE_RANK, vertexLayerShift*indexToVertexID[verticesOnTria[3*i+j]]+numLayers*vertexColumnShift+1);
	  bulkData->declare_relation(side, node, j);
	}
  }

  bulkData->modification_end();
}
コード例 #3
0
void GameCharaSelectMenu::renderPlayerInfo(kuto::Graphics2D& g, int index) const
{
	rpg2k::model::Project const& proj = field_.project();
	rpg2k::model::DataBase const& ldb = proj.getLDB();
	unsigned playerID = proj.getLSD().member(index);
	char temp[256] = "\0";
	// face
	kuto::Vector2 facePos(8.f + position_.x, index * 58.f + 8.f + position_.y);
	// TODO: field_.players()[index]->renderFace(g, facePos);
	// status
	const kuto::Color color(1.f, 1.f, 1.f, 1.f);
	kuto::Vector2 windowPosition(position_.x + 64.f, position_.y);
	rpg2k::model::Project::Character const& character = proj.character(playerID);
	const char* conditionStr = NULL;
	const std::vector<uint8_t>& badConditions = character.condition();
	unsigned cond = 0;
	std::vector<uint8_t>::const_iterator cond_it = badConditions.begin();
	while ( ( cond_it = std::find( cond_it, badConditions.end(), true ) ) != badConditions.end() ) {
		unsigned const nextCond = cond_it - badConditions.begin() + 1;
		if (ldb.condition()[nextCond][4].to<int>() > ldb.condition()[cond][4].to<int>()) {
			cond = nextCond;
		}
	}
	if(cond == 0) { conditionStr = ldb.vocabulary(126).toSystem().c_str(); }
	else { conditionStr = ldb.condition()[cond][1].to_string().toSystem().c_str(); }

	if (size_.x < 200.f) {	// short version
		kuto::Vector2 pos = windowPosition;
		pos.y += (rowHeight_ + lineSpace_) * index + 8.f + 2.f;
		g.drawText(character.name().c_str(), pos, color, fontSize_, kuto::Font::NORMAL);

		pos = windowPosition;
		pos.y += (rowHeight_ + lineSpace_) * index + 16.f + 8.f;
		g.drawText(ldb.vocabulary(128).toSystem().c_str(), pos, color, fontSize_, kuto::Font::NORMAL);
		pos.x += 12.f;
		sprintf(temp, "%2d", character.level());
		g.drawText(temp, pos, color, fontSize_, kuto::Font::NORMAL);
		pos.x += 48.f;
		g.drawText(ldb.vocabulary(129).toSystem().c_str(), pos, color, fontSize_, kuto::Font::NORMAL);
		pos.x += 12.f;
		sprintf(temp, "%3d/%3d", character.hp(), character.param(rpg2k::Param::HP) );
		g.drawText(temp, pos, color, fontSize_, kuto::Font::NORMAL);

		pos = windowPosition;
		pos.y += (rowHeight_ + lineSpace_) * index + 16.f * 2.f + 8.f;
		g.drawText(conditionStr, pos, color, fontSize_, kuto::Font::NORMAL);
		pos.x += 60.f;
		g.drawText(ldb.vocabulary(130).toSystem().c_str(), pos, color, fontSize_, kuto::Font::NORMAL);
		pos.x += 12.f;
		sprintf(temp, "%3d/%3d", character.mp(), character.param(rpg2k::Param::MP));
		g.drawText(temp, pos, color, fontSize_, kuto::Font::NORMAL);
	} else {
		kuto::Vector2 pos = windowPosition;
		pos.y += (rowHeight_ + lineSpace_) * index + 8.f + 2.f;
		g.drawText(character.name().c_str(), pos, color, fontSize_, kuto::Font::NORMAL);
		pos.x += 86.f;
		g.drawText(character.title().c_str(), pos, color, fontSize_, kuto::Font::NORMAL);

		pos = windowPosition;
		pos.y += (rowHeight_ + lineSpace_) * index + 16.f + 8.f;
		g.drawText(ldb.vocabulary(128).toSystem().c_str(), pos, color, fontSize_, kuto::Font::NORMAL);
		pos.x += 12.f;
		sprintf(temp, "%2d", character.level());
		g.drawText(temp, pos, color, fontSize_, kuto::Font::NORMAL);
		pos.x += 30.f;
		g.drawText(conditionStr, pos, color, fontSize_, kuto::Font::NORMAL);
		pos.x += 50.f;
		g.drawText(ldb.vocabulary(129).toSystem().c_str(), pos, color, fontSize_, kuto::Font::NORMAL);
		pos.x += 22.f;
		sprintf(temp, "%3d/%3d", character.hp(), character.param(rpg2k::Param::HP));
		g.drawText(temp, pos, color, fontSize_, kuto::Font::NORMAL);

		pos = windowPosition;
		pos.y += (rowHeight_ + lineSpace_) * index + 16.f * 2.f + 8.f;
		g.drawText(ldb.vocabulary(127).toSystem().c_str(), pos, color, fontSize_, kuto::Font::NORMAL);
		pos.x += 12.f;
		sprintf(temp, "%6d/%6d", character.levelExp(), character.nextLevelExp());
		g.drawText(temp, pos, color, fontSize_, kuto::Font::NORMAL);
		pos.x += 80.f;
		g.drawText(ldb.vocabulary(130).toSystem().c_str(), pos, color, fontSize_, kuto::Font::NORMAL);
		pos.x += 22.f;
		sprintf(temp, "%3d/%3d", character.mp(), character.param(rpg2k::Param::MP));
		g.drawText(temp, pos, color, fontSize_, kuto::Font::NORMAL);
	}
}
コード例 #4
0
ファイル: Photobomber.cpp プロジェクト: Bender97/Alliance-8
void loop()
{
    DEBUG(("\n# of Captured POIs: %d", countPOI));
    //DEBUG(("\nPOIs Visited 1: %d", pastPOIs[0]));
    //DEBUG(("\nPOIs Visited 2: %d", pastPOIs[1]));
    //DEBUG(("\nPOIs Visited 3: %d", pastPOIs[2]));
    DEBUG(("\n  targetPOI: %d", targetPOI));
    
    //----Base Functions----//
    time = api.getTime();
    stayInBounds();
    
    api.getMyZRState(myState);
    for (int i = 0; i<3; i++) {
        myPos[i] = myState[i];
    }
    
    if (game.getFuelRemaining() <= 0)
    {
        game.turnOff();
        //DEBUG(("\nGame over man, game over!"));
    }
    /*else if (game.getNextFlare() != -1 && game.getNextFlare() < 5)
    {
        game.turnOff();
        DEBUG(("Flare incoming"));
    }
    else
    {
        game.turnOn();
    }*/
    
    /*while (game.getScore() > 14)
    {
        api.setPositionTarget(safetyZone);
    }*/
    
    if (0.9*game.getScore() > game.getOtherScore())
    {
        strategyType = 1;
    }
    else
    {
        if (time > 200)
        {
            if (game.getScore() < game.getOtherScore())
            {
                strategyType = 1;
            }
            else
            {
                strategyType = 0;
            }
        }
        else
        {
            strategyType = 0;
        }
    }
    if (time > 16)
    {
            if (strategyType == 0) {
                //----TargetPOI----//
                if (time == 60 || time % 60 == 0)
                {
                    DEBUG(("\n  POIs Updated..."));
                    pastPOIs[0] = -1;
                    pastPOIs[1] = -1;
                    pastPOIs[2] = -1;
                    countPOI = 0;
                    
                    targetPOI = findClosestPOI(myPos, pastPOIs);
                    DEBUG(("\ntargetPOI: %d", targetPOI));
                    pastPOIs[countPOI] = targetPOI;
                    countPOI++;
                    
                    picturesTaken = 0;
                    
                }
                /*if (targetPOI > 2 || countPOI >= 3)
                {
                    pastPOIs[0] = -1;
                    pastPOIs[1] = -1;
                    pastPOIs[2] = -1;
                    countPOI = 0;
                    
                    targetPOI = findClosestPOI(myPos, pastPOIs);
                    pastPOIs[countPOI] = targetPOI;
                    countPOI++;
                }*/
                
                game.getPOILoc(poiPos, targetPOI);
                
                for (int i = 0; i<3; i++) 
                { //Reset POI vector to half its original magnitude
                    poiPos[i] *= 0.5;
                }
                
                float posTarget[3] = {poiPos[0]*3.9, poiPos[1]*3.9, poiPos[2]*3.9}; 
                //Find coordinates for SPHERE to be at while taking pictures
                float uploadTarget[3] = {poiPos[0]*7.25, poiPos[1]*7.25, poiPos[2]*7.25};
                //Find coordinates for SPHERE to be at while uploading
                
                if (picturesTaken > 3)// && time > 60) 
                { 
                //If SPHERE has attempted more than 3 pictures (valid or not), move to next POI
                    if (countPOI == 3)
                    {
                        DEBUG(("\n  All POIs captured"));
                        pastPOIs[0] = -1;
                        pastPOIs[1] = -1;
                        pastPOIs[2] = -1;
                        countPOI = 0;
                    
                        targetPOI = findClosestPOI(myPos, pastPOIs);
                        pastPOIs[countPOI] = targetPOI;
                        countPOI++;
                        picturesTaken = 0;
                        DEBUG(("\n  Moving on~~"));
                        DEBUG(("\n  New targetPOI: %d", targetPOI));
                    }
                    else
                    {
                        targetPOI = findClosestPOI(myPos, pastPOIs);
                        pastPOIs[countPOI] = targetPOI;
                        countPOI++;
                    
                        picturesTaken = 0;
                        DEBUG(("\n Moving on~~"));
                        DEBUG(("\n targetPOI: %d", targetPOI));
                    }
                }
                else { 
                //Otherwise, continue taking pictures
                    facePos(poiPos, myPos);
                }
                
                //----Collision Avoidance & Positioning----//
                //float midpoint[3] = {(myPos[0]+posTarget[0])/2, (myPos[1]+posTarget[1])/2, (myPos[2]+posTarget[2])/2};
                //float qtl1[3] = {(myPos[0]+midpoint[0])/2, (myPos[1]+midpoint[1])/2, (myPos[2]+midpoint[2])/2};
                //float qtl3[3] = {(posTarget[0]+midpoint[0])/2, (posTarget[1]+midpoint[1])/2, (posTarget[2]+midpoint[2])/2};
                
                arcMove(posTarget);
                /* if (mathVecMagnitude(midpoint,3) < 0.35) { 
                // this part is really rough - with some tweaking of magnitudes and such, it might work better.
                    arcMove(midpoint, posTarget);
                }
                else { //Proceed to target coordinates as usual
                    /*if(mathVecMagnitude(qtl3, 3)>0.35)
                    {
                		 if (mathVecMagnitude(qtl1,3)>0.35)
                		 {
                		 	api.setPositionTarget(posTarget);
                		 }
                		 else
                		 {
                		     arcMove(midpoint, posTarget);
                		 }	
                    }
                    else
                    {
                    	arcMove(midpoint, posTarget);
                    }
                    */
        //        }
                
                if (game.getMemoryFilled()>0 && game.getScore() < targetScore) { //If SPHERE has a valid picture
                    DEBUG(("\n  Moving to upload"));
                    
                    float attTarget[3];
                    attTarget[0] = 0.64 -myPos[0]; // [0.64,0,0] is the position of Earth
                    attTarget[1] = 0 -myPos[1];
                    attTarget[2] = 0 -myPos[2];
                    mathVecNormalize(attTarget,3);
                    api.setAttitudeTarget(attTarget);
                    
                    api.setPositionTarget(uploadTarget); //Move to upload position
                    if (distanceVec(myPos, zero)> 0.53 && distanceVec(myPos,attTarget)> 0.05) //When SPHERE is out of both orbits, upload
                    {
                        float oldScore = game.getScore();
                        game.uploadPic();
                        if (oldScore < game.getScore())
                        {
                            //DEBUG(("Upload was successful!"));
                        }
                        if (oldScore >= game.getScore())
                        {
                            //DEBUG(("Upload failed!"));
                        }
                        
                    }
                }
            }
            else if (strategyType == 1) {
                api.getOtherZRState(otherState);
                
                for (int i = 0; i<3; i++) {
                    otherPos[i] = 0.5*otherState[i];
                }
                
                if (distanceVec(myPos,otherPos) < 0.38) {
                    arcMove(otherPos);
                    DEBUG((" | Heading to otherPos | "));
                }
                else {
                    arcMove(otherState);
                    DEBUG((" | Heading to otherState | "));
                }
            }
    }
    else
    {
        float initialShotTarget[3] = {-0.2, 0.0, -0.35};
        api.setPositionTarget(initialShotTarget);
    }
}