Start day21
This commit is contained in:
parent
2b00f9fc17
commit
179fcef3db
1 changed files with 32 additions and 0 deletions
32
day21/day21Part1.cpp
Normal file
32
day21/day21Part1.cpp
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
int main (void)
|
||||||
|
{
|
||||||
|
int player1Position = 4; //This is for both test and true input
|
||||||
|
int player1Score = 0;
|
||||||
|
int player2Position = 8; //This is 5 for true, 8 for test
|
||||||
|
int player2Score = 0;
|
||||||
|
int dieRoll = 0;
|
||||||
|
int dieRollover = 0;
|
||||||
|
int turnAdd = 0;
|
||||||
|
bool player1Add = true;
|
||||||
|
while (player1Position >= 1000 || player2Position >= 1000)
|
||||||
|
{
|
||||||
|
if ((dieRoll % 3) == 0)
|
||||||
|
{
|
||||||
|
if (player1Add)
|
||||||
|
{
|
||||||
|
player1Position = player1Position + ((turnAdd % 10) + 1);
|
||||||
|
player1Score += player1Position;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO : Multiply loserScore by (100 * dieRollover) + dieRoll
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue