Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tom O'Neill rps challenge #2120

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Conversation

tomoneill32
Copy link

No description provided.

Copy link

@archiemartini archiemartini left a comment

Choose a reason for hiding this comment

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

Nice work, bro!

visit("/")
expect(page.status_code).to eq(200)
end

Choose a reason for hiding this comment

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

Ahh nice to see an example of a test for this

def random_move
ALLOWED_MOVES.sample
end

Choose a reason for hiding this comment

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

All of these .rb's are so CLEAN, so TIGHT, every function has a clear and distinct role. V tasty.

"paper scissors" => false,
"paper paper" => nil,
}

Choose a reason for hiding this comment

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

Ha much cleaner than mine. I saw some smart ones on codewars I was meaning to implement.

def check_move_allowed(move)
fail 'Incorrect move' if !ALLOWED_MOVES.include?(move)
end

Choose a reason for hiding this comment

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

So have you implemented this in such a way as it requires the player enters another choice?

expect(game.calculate_result('paper','scissors')).to eq false
end
end
end

Choose a reason for hiding this comment

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

All tests are comprehensive, v nice

<% if @result == nil %>

It's a draw

Choose a reason for hiding this comment

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

Oooooo interesting, I totally forgot about how to place if/else logic within the html page. This opens it up a lot. Nice work

<form action="/calculate_results" method="post">
<button class= "selection" type="submit" value = "rock" name="choice"><img src='rock.png' alt="Rock" width="300" height="500" ></button>
<button class= "selection" type="submit" value = "paper" name="choice"><img src='paper.png' alt="Paper" width="300" height="500" ></button>
<button class= "selection" type="submit" value = "scissors" name="choice"><img src='scissors.png' alt="Scissors" width="300" height="500" ></button>

Choose a reason for hiding this comment

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

Ohhhhh that's why the pics were there :') hahahaa

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.

None yet

2 participants