void Photon::HopDropSpinInTissue(MCMLModel * model) { /* Set a step size, move the photon, drop some weight, choose a new photon direction for propagation. When a step size is long enough for the photon to hit an interface, this step is divided into two steps. First, move the photon to the boundary free of absorption or scattering, then decide whether the photon is reflected or transmitted. Then move the photon in the current or transmission medium with the unfinished stepsize to interaction site. If the unfinished stepsize is still too long, repeat the above process. */ StepSizeInTissue(model); if (HitBoundary(model)) { Hop(); // move to boundary plane CrossOrNot(model); } else { Hop(); Drop(model); Spin(model->layerObj.layer[layer].g); } }
int main(int argc, char **argv) { std::string board = std::string(BOARD_WIDTH*BOARD_HEIGHT, '='); int p1Move = 1; int p2Move = -1; int p1Score = 0; int p2Score = 0; int fruitPos = 0; std::vector<int> player1; std::vector<int> player2; ResetBoard(board, player1, player2, fruitPos, p1Move, p2Move); bool quit = false; while (!quit) { //REMOVE FOR FINAL CODE system("cls"); //REMOVE FOR FINAL CODE //Change to receive client comamnds if (_kbhit()) { switch (_getch()) { //Player 1 Movement case 'a': if(p1Move != 1) p1Move = -1; break; case 'd': if(p1Move != -1) p1Move = 1; break; case 'w': if(p1Move != BOARD_WIDTH) p1Move = BOARD_WIDTH*-1; break; case 's': if(p1Move != BOARD_WIDTH*-1) p1Move = BOARD_WIDTH*1; break; //Player 2 Movement case 75: if(p2Move != 1) p2Move = -1; break; case 77: if(p2Move != -1) p2Move = 1; break; case 72: if(p2Move != BOARD_WIDTH) p2Move = BOARD_WIDTH*-1; break; case 80: if(p2Move != BOARD_WIDTH*-1) p2Move = BOARD_WIDTH * 1; break; } } bool gameover = false; int p1Next = player1.front() + p1Move; player1.insert(player1.begin(),p1Next); int p2Next = player2.front() + p2Move; player2.insert(player2.begin(), p2Next); if (HitBoundary(player1.front(), p1Move)) { p2Score++; gameover = true; } if (HitBoundary(player2.front(), p2Move)) { p1Score++; gameover = true; } if (!gameover) { if (fruitPos != player1.front()) player1.pop_back(); else { RandomSpawn(fruitPos, board); p1Score++; } if (fruitPos != player2.front()) player2.pop_back(); else { RandomSpawn(fruitPos, board); p2Score++; } } ClearBoard(board); if(gameover || !UpdateBoard(board, player1,player2,fruitPos,p1Score,p2Score,p1Move,p2Move)) ResetBoard(board, player1, player2, fruitPos, p1Move, p2Move); //REMOVE FOR FINAL CODE DisplayState(board,p1Score,p2Score); Sleep(100); } return 0; }