Test fill in for day21

This commit is contained in:
Blizzard Finnegan 2021-12-21 15:10:55 -05:00
parent 992492f14d
commit dd28f1a81a
2 changed files with 35 additions and 8 deletions

BIN
day21/day21Part1 Executable file

Binary file not shown.

View file

@ -1,4 +1,5 @@
#include <cmath>
#include <iostream>
using namespace std;
@ -8,28 +9,54 @@ int main (void)
int player1Score = 0;
int player2Position = 8; //This is 5 for true, 8 for test
int player2Score = 0;
int dieRoll = 0;
int dieRollover = 0;
int dieRoll = 1;
int turnAdd = 0;
int rollCount = 0;
bool player1Add = true;
//
while (player1Position >= 1000 || player2Position >= 1000)
//Run the game loop until someone has the highest score
while (player1Position < 1000 || player2Position < 1000)
{
if ((dieRoll % 3) == 0)
//If there's three values in the roll
if ((rollCount % 3) == 0)
{
//If its player 1s turn, add their score
if (player1Add)
{
//
player1Position = player1Position + turnAdd;
player1Position = ((player1Position - 1) % 10) + 1;
player1Score += player1Position;
}
//It its player 2s turn, add their score
else
{
player2Position = player2Position + turnAdd;
player2Position = ((player2Position - 1) % 10) + 1;
player2Score += player2Position;
}
}
//Add until 3 values have been rolled
else
{
rollCount++;
//Implement rollover
if(dieRoll > 100) dieRoll = 1;
turnAdd += dieRoll;
dieRoll++;
}
}
if(player1Add)
{
bool test;
test = (player1Position >= 1000 || player2Position >= 1000);
cout << player1Position << endl;
cout << player2Position << endl;
cout << test << endl;
}
else
{
cout << "Player 2 Wins" << endl;
}
}
}
// TODO : Multiply loserScore by (100 * dieRollover) + dieRoll
// TODO : Multiply loserScore by rollCount
return 0;
}