brigitte 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2228722d9c033c53c916023eea2a577f9b96b615e763136a6a0c23c5fa9f8ef5
4
- data.tar.gz: c32388757c68e5d7d7c5911806e6770424d2b9d1ac358e52bec1de987cfff248
3
+ metadata.gz: 2639c1b8f96714b341bd58a912330a2a13c56fd7398b25a2335c9698533263d6
4
+ data.tar.gz: d8c9fe893c4ca56f4ec212f24c275132b95ff90ff3bffdfe8645896025607b35
5
5
  SHA512:
6
- metadata.gz: 47e6b37f9e4099a4f221a30c8719d8caabc642a8570ed7208f01364f4f141b5948b9746e57e1fa95cf01f73dfa54c7f78005ef4f5e6136eee308c514eedd48d1
7
- data.tar.gz: 0b753335a563be014518afc1bd93c29cfa7ca0d5339b95875cbf0373f64fca8fad13115f58c3dbfe5282b136d5029e2d39e03309fef6cf67bf0f701e9767a1ab
6
+ metadata.gz: fc72233255acdc7757df5f08af1d4c3209cc9ebd9d45e756258ced1190ef4df12776d8cf582c35f2ee7bdc1c07991691090a367e897080fb82d2d12efc7a2f2d
7
+ data.tar.gz: e6eec0b563287f02ad81184fa1d8c3f090a3b9c6e7f0a5d58ec8f75b11d9084fbc12c244d7d4a09ff3f46fa4bb5ccedbe44941ec4af68b2e5c62e07bb535616a
@@ -3,6 +3,8 @@ name: Ruby
3
3
  on:
4
4
  push:
5
5
  branches: [ develop, master ]
6
+ tags:
7
+ - 'v*'
6
8
  pull_request:
7
9
  branches: [ develop, master ]
8
10
 
@@ -0,0 +1 @@
1
+ ruby-2.7.2
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.1.5] 2020-12-12
4
+
5
+ ### Changed
6
+
7
+ - rename 'hidden_card' to more know term 'blind_card'
8
+
3
9
  ## [0.1.4] 2020-11-26
4
10
 
5
11
  ### Changed
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- brigitte (0.1.4)
4
+ brigitte (0.1.5)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -4,6 +4,31 @@ Welcome to your new gem! In this directory, you'll find the files you need to be
4
4
 
5
5
  TODO: Delete this and the text above, and describe your gem
6
6
 
7
+ ## Game rules
8
+ Card game against max 4 players where you need to get rid of your cards as soon as possible.
9
+
10
+ ### Game steps
11
+ 1) You have a chance to swap the any cards in your hand with your cards that lays on the table.
12
+ Usually you put up your best card on table. So you can move on fast to your blind cards behind it.
13
+ When you have swapped your cards you push ready. When everyone is ready. The game starts with the player with the lowest card in hand.
14
+ Turn runs clockwise.
15
+
16
+ 2) In this phase a hand should always have minimum 3 cards when there is still cards on the deck. When you hand has less cards there will be cards automatically added in your hand from the deck.
17
+ Everybody plays untill the deck and hands are empty.
18
+
19
+ 3) The visible cards are taken into your hand. Now you play your hand untill it's empty.
20
+
21
+ 4) You take one blind card when it's your turn. When you clear all the blind cards you won the game.
22
+
23
+ ### Special cards
24
+ Usually you put an equal card or higher on the pile.
25
+ Except if 7 is on top of the pile. Then you can only put cards lower or equal to 7.
26
+ There are other special cards
27
+ 10 clears the pile and you stay in turn. You can always throw 10
28
+ It has the same effect if there are 4 consecutive equal cards on the pile.
29
+ You can always throw 2.
30
+ Ace is the highest Card.
31
+
7
32
  ## Installation
8
33
 
9
34
  Add this line to your application's Gemfile:
@@ -93,13 +93,13 @@ module Brigitte
93
93
  select_next_player(force: true) unless @game_over
94
94
  end
95
95
 
96
- def take_hidden_card(player, hidden_card_index)
96
+ def take_blind_card(player, blind_card_index)
97
97
  return false if player != @current_player
98
98
  return false if @cards.any?
99
99
  return false if player.visible_cards.any?
100
100
  return false if player.hand.any?
101
101
 
102
- player.pull_hidden_card(hidden_card_index)
102
+ player.pull_blind_card(blind_card_index)
103
103
  end
104
104
 
105
105
  def to_h
@@ -131,7 +131,7 @@ module Brigitte
131
131
 
132
132
  def deal_cards
133
133
  @active_players.each do |player|
134
- 3.times { player.hidden_cards << @cards.pop }
134
+ 3.times { player.blind_cards << @cards.pop }
135
135
  3.times { player.visible_cards << @cards.pop }
136
136
  3.times { player.hand << @cards.pop }
137
137
  end
@@ -167,7 +167,7 @@ module Brigitte
167
167
 
168
168
  def player_won(player)
169
169
  return if @winners.include? player
170
- return if player.hidden_cards.compact.any?
170
+ return if player.blind_cards.compact.any?
171
171
  return if player.hand.any?
172
172
 
173
173
  @winners << player
@@ -7,20 +7,20 @@ module Brigitte
7
7
  # A Player in Brigitte has a:
8
8
  # +hand+ where from player can only throw cards from
9
9
  # +visible_cards+ where from player can draw from if hands are empty
10
- # +hidden_cards+ cards that are face down where from player can take only one
10
+ # +blind_cards+ cards that are face down where from player can take only one
11
11
  # if all cards are played
12
12
  #
13
13
  # A player is ready if cards are swapped between it's +hand+
14
14
  # and +visible_cards+
15
15
  class Player
16
- attr_accessor :name, :hand, :hidden_cards, :visible_cards, :ready
16
+ attr_accessor :name, :hand, :blind_cards, :visible_cards, :ready
17
17
  attr_reader :id
18
18
 
19
19
  def initialize(name, id = nil)
20
20
  @id = id || SecureRandom.uuid
21
21
  @name = name
22
22
  @hand = []
23
- @hidden_cards = []
23
+ @blind_cards = []
24
24
  @visible_cards = []
25
25
  @ready = false
26
26
 
@@ -52,15 +52,15 @@ module Brigitte
52
52
  hand[hand_card_index] = visible_card
53
53
  end
54
54
 
55
- def pull_hidden_card(index)
55
+ def pull_blind_card(index)
56
56
  return false if hand.any?
57
57
  return false if visible_cards.any?
58
58
 
59
- hidden_card = hidden_cards[index]
60
- return false unless hidden_card
59
+ blind_card = blind_cards[index]
60
+ return false unless blind_card
61
61
 
62
- hidden_cards[index] = nil
63
- hand << hidden_card
62
+ blind_cards[index] = nil
63
+ hand << blind_card
64
64
  sort_hand!
65
65
  true
66
66
  end
@@ -78,7 +78,7 @@ module Brigitte
78
78
  id: id,
79
79
  name: name,
80
80
  hand: hand.map(&:to_h),
81
- hidden_cards: hidden_cards.map(&:to_h),
81
+ blind_cards: blind_cards.map(&:to_h),
82
82
  visible_cards: visible_cards.map(&:to_h),
83
83
  ready: ready
84
84
  }
@@ -89,7 +89,7 @@ module Brigitte
89
89
 
90
90
  new(hash[:name], hash[:id]) do |p|
91
91
  p.hand = hash[:hand].map { |h| Card.from_h(h) }
92
- p.hidden_cards = hash[:hidden_cards].map { |h| Card.from_h(h) }
92
+ p.blind_cards = hash[:blind_cards].map { |h| Card.from_h(h) }
93
93
  p.visible_cards = hash[:visible_cards].map { |h| Card.from_h(h) }
94
94
  p.ready = hash[:ready]
95
95
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Brigitte
4
- VERSION = '0.1.4'
4
+ VERSION = '0.1.5'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brigitte
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - youszef
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-11-26 00:00:00.000000000 Z
11
+ date: 2020-12-12 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Card game where player needs to get rid of all it's cards
14
14
  email:
@@ -23,6 +23,7 @@ files:
23
23
  - ".gitignore"
24
24
  - ".rspec"
25
25
  - ".rubocop.yml"
26
+ - ".ruby-version"
26
27
  - CHANGELOG.md
27
28
  - Gemfile
28
29
  - Gemfile.lock