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

minor improvements #27

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions git-game
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,16 @@ committers = commits.map { |c| c[:author] }.compact.uniq
system('clear')

print_header

if commits.empty?
puts "Couldn't find any commits :("
exit 0
end

puts "You're playing in a repo with #{commits.size} commits and #{committers.size}"
puts "distinct committers.\n\n"

committers.each do |committer|
committers.sort.each do |committer|
puts committer
end

Expand All @@ -67,11 +73,17 @@ gets

system('clear')

# -- Game loop --
NUM_CHOICE = 4

# -- Game loop --
commit = commits.shuffle!

Choose a reason for hiding this comment

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

Shouldn't this be commits = commits.shuffle!?

Copy link
Author

Choose a reason for hiding this comment

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

bullseye!
EDIT:
actually it should be just
commts.shuffle!
but still thanks for pointing that out

loop do
commit = commits.shuffle.pop
if commits.empty?
puts "Looks like there are no more commits left :("
break
end
commit = commits.pop

message = commit[:message]
author = commit[:author]

Expand Down