generated from sigonasr2/CPlusPlusProjectTemplate
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
73 lines
2.0 KiB
73 lines
2.0 KiB
#define OLC_PGE_APPLICATION
|
|
#include "pixelGameEngine.h"
|
|
#include "olcutils.h"
|
|
|
|
int main()
|
|
{
|
|
std::ifstream file("input");
|
|
int points=0;
|
|
while (file.good()) {
|
|
std::string line;
|
|
std::getline(file,line);
|
|
/*
|
|
A,X = Rock 1
|
|
B,Y = Paper 2
|
|
C,Z = Scissors 3
|
|
X Loss 0
|
|
Y Draw 3
|
|
Z Wins 6
|
|
*/
|
|
char s1 = line[0];
|
|
char s2 = line[2];
|
|
if (s2=='Z') { //Win
|
|
switch (s1) {
|
|
case 'A':{ //Rock
|
|
points+=6+2;
|
|
std::cout<<points<<std::endl;
|
|
}break;
|
|
case 'B':{ //Paper
|
|
points+=6+3;
|
|
std::cout<<points<<std::endl;
|
|
}break;
|
|
case 'C':{ //Scissors
|
|
points+=6+1;
|
|
std::cout<<points<<std::endl;
|
|
}break;
|
|
}
|
|
}
|
|
if (s2=='Y') { //Draw
|
|
switch (s1) {
|
|
case 'A':{ //Rock
|
|
points+=3+1;
|
|
std::cout<<points<<std::endl;
|
|
}break;
|
|
case 'B':{ //Paper
|
|
points+=3+2;
|
|
std::cout<<points<<std::endl;
|
|
}break;
|
|
case 'C':{ //Scissors
|
|
points+=3+3;
|
|
std::cout<<points<<std::endl;
|
|
}break;
|
|
}
|
|
}
|
|
if (s2=='X') { //Lose
|
|
switch (s1) {
|
|
case 'A':{ //Rock
|
|
points+=0+3;
|
|
std::cout<<points<<std::endl;
|
|
}break;
|
|
case 'B':{ //Paper
|
|
points+=0+1;
|
|
std::cout<<points<<std::endl;
|
|
}break;
|
|
case 'C':{ //Scissors
|
|
points+=0+2;
|
|
std::cout<<points<<std::endl;
|
|
}break;
|
|
}
|
|
}
|
|
}
|
|
std::cout<<"Total:"<<points<<std::endl;
|
|
return 0;
|
|
}
|
|
|