Skip to content

general refactoring of rock paper scissors game#1

Open
oskarz1234 wants to merge 4 commits intojohnneijzen:masterfrom
oskarz1234:patch-1
Open

general refactoring of rock paper scissors game#1
oskarz1234 wants to merge 4 commits intojohnneijzen:masterfrom
oskarz1234:patch-1

Conversation

@oskarz1234
Copy link

sorta tried to make it a bit more neater

@johnneijzen
Copy link
Owner

johnneijzen commented Jul 27, 2018

Hmm I can't compile using C99 Standard Compilers I tried using TCC and GCC and TDM-GCC MinGW
there is a small mistake at line 89 character array initializer must be a literal, optionally enclosed in braces

what compiler are you using?

Copy link
Owner

@johnneijzen johnneijzen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So far problems i can see

for (int i =0;i<3;i++)
{
if(key == keys1[i])
playerTwoMoves = i+1;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where are playerOneMoves store since now the while loop forever since playerOneMoves are never stored

void playerKeyEvent()
{
{
char keys1[] = ['q','w','e','a','s','d','x','\0'];
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change [] to {}

{
{
char keys1[] = ['q','w','e','a','s','d','x','\0'];
char keys2[] = ['u','i','o','j','k','l','m','\0'];
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change [] to {}

printf("Player Two Pick Gun\n");
else if (playerTwoMoves == 7)
printf("Player Two Pick Dog\n");
char* choices [] = ["Rock\n","Paper\n","Scissors\n","Lisard\n","Spock\n","Gun\n","Dog\n"];
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change [] to {}

// Player 2 Win
for (int i=0;i<21;i++) {
if((playerTwoMoves == posiblePlayerMoves[i]) && (playerOneMoves==loseConditions[i])){
printf("Player 1 Win");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is i think is typo this is when player 2 win not player 1 win

@johnneijzen
Copy link
Owner

i not sure what is causing this but move display is a bit broken it display every move but the code now compiles

@johnneijzen
Copy link
Owner

image

}
for (int i=1;i<=7;i++){
if (playerTwoMoves == i)
printf("Player One Pick ");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change to player two picks

@johnneijzen johnneijzen self-assigned this Jul 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants