Project
Reverse Dependencies for rspec
The projects listed here declare rspec as a runtime or development dependency
0.0
Players embark on a journey to score the highest out of all their friends.
Along the way, players will encounter danger and assistance, and find many treasures, increasing their points.
Good Luck and Happy Playing!!!
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
Activity
0.0
My first Ruby gem!!
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
Activity
0.0
Gem file from Pragmatic Studio Ruby Course
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
Activity
0.0
# StudioGame (Alec)
Jogo de terminal em Ruby com **jogadores, dados, tesouros e variações de jogadores** (Clumsy e Berserk), empacotado como gem.
> Nome do gem (exemplo): `studio_game_alec`
---
## 🚀 Instalação e execução
### Rodando direto do código-fonte
No diretório do projeto:
```bash
ruby bin/studio_game
```
Se você não passar um arquivo de jogadores via CLI, o script usa o `players.csv` que fica em `bin/` por padrão.
Também funciona passando um CSV na linha de comando:
```bash
ruby bin/studio_game my_favorite_players.csv
```
### Como gem (local)
Empacote e instale localmente:
```bash
gem build studio_game.gemspec
gem install studio_game_alec-<versao>.gem
```
Depois rode:
```bash
studio_game
```
> No Windows, o executável será resolvido pelo RubyGems. Se preferir, rode: `ruby bin/studio_game`.
---
## 📁 Estrutura do projeto
```
games/
├─ bin/
│ ├─ studio_game # script principal (tem shebang)
│ └─ players.csv # CSV padrão (nome,vida)
├─ lib/
│ └─ studio_game/
│ ├─ auditable.rb
│ ├─ berserk_player.rb
│ ├─ clumsy_player.rb
│ ├─ die.rb
│ ├─ game.rb
│ ├─ game_turn.rb
│ ├─ loaded_die.rb
│ ├─ playable.rb
│ ├─ player.rb
│ └─ treasure_trove.rb
├─ spec/
│ └─ studio_game/ # specs RSpec
├─ LICENSE
├─ README.md
└─ studio_game.gemspec
```
- **Namespace:** todo o código vive dentro do módulo `StudioGame` para evitar colisões.
- **bin/studio_game:** script CLI com shebang (`#!/usr/bin/env ruby`). Faz _fallback_ do `$LOAD_PATH` para `lib` quando usado fora da gem.
- **lib/studio_game/**: código da biblioteca (classes/módulos).
- **spec/**: testes RSpec.
---
## 🧩 Conceitos principais
- **Player** (`player.rb`): representa um jogador com `name`, `health`, coleta tesouros e calcula `score` (= `health` + `points`). Inclui o mixin **Playable**.
- **Playable** (`playable.rb`): mixin com `w00t`, `blam` e `strong?` (altera/consulta `health` via getters/setters).
- **TreasureTrove** (`treasure_trove.rb`): define `Treasure = Struct.new(:name,:points)` e a constante `TREASURES`; possui `.random`.
- **Die/LoadedDie** (`die.rb`, `loaded_die.rb`): rolam valores (o carregado favorece 1,1,2,5,6,6). Ambos incluem **Auditable**.
- **Auditable** (`auditable.rb`): imprime “Rolled a X (DieClass)” após cada rolagem.
- **Game** (`game.rb`): agrega jogadores, carrega CSV, executa rodadas, soma pontos e salva _high scores_.
- **GameTurn** (`game_turn.rb`): executa a lógica de um turno para um jogador (rola dado, aplica `blam/w00t/skip` e concede tesouro).
- **ClumsyPlayer / BerserkPlayer**: variações de `Player` que modificam comportamento de `w00t` e de coleta de tesouros.
---
## 🧪 Testes
Rode todos os testes:
```bash
rspec
```
Principais coisas testadas:
- Ordenação de jogadores por `score` (usa `<=>` em `Player`).
- Cálculo de `points` e `score` (soma de tesouros + vida).
- Efeitos de `w00t`/`blam` e força (`strong?`).
- Lógica de turno com _stubs_ de dado (`allow_any_instance_of(LoadedDie).to receive(:roll).and_return(n)`).
- Comportamentos de `ClumsyPlayer` e `BerserkPlayer`.
---
## 📦 CSVs e caminhos
- `bin/studio_game` resolve o CSV padrão assim:
```ruby
default_player_file = File.join(File.dirname(__FILE__), 'players.csv')
game.load_players(ARGV.shift || default_player_file)
```
- Você pode passar um arquivo `.csv` via CLI como primeiro argumento.
Formato do CSV:
```
Moe,100
Larry,60
Curly,125
```
---
## 🧾 High Scores
Após sair do loop, o jogo grava `high_score.txt` com as entradas ordenadas. Cada linha é formatada por `Game#high_score_entry`:
```
<nome com padding de pontos> <score>
```
---
## 🛠️ Dicas de desenvolvimento
- Use `require 'studio_game/arquivo'` quando a gem estiver instalada.
- No script binário, o `begin/rescue LoadError` faz _fallback_ para `$LOAD_PATH` local, útil fora da gem.
- Para debugar I/O em testes, o spec redireciona `STDOUT` (`$stdout = StringIO.new`).
---
## 📚 Licença
MIT – veja o arquivo `LICENSE`.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
Activity
0.0
# GAMING
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
Activity
0.0
A simple text-based game from one of Pragmatic Studio's ruby courses.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
Activity
0.0
# Play a game with multiple players, roll a die, a player gets blammed or w00ted and finds treasures and points
# to run
./studio_game
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
Activity
0.0
This is the game from the Pragmatic Studio's Ruby course.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
Activity
0.0
Players start with a given score. Throughout the game they can find treasures which increase their score. The object of the game is to accumulate as many points as possible as the rounds continue. Whoever has the highest amount of points wins.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
Activity
0.0
This is an example application used in The Pragmatic Studio's
Ruby Programming course, as described at
http://pragmaticstudio.com
This code is Copyright 2012 Chip Ashby. See the LICENSE file.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
Activity
0.0
My first Ruby gem. Made a game to get the hang of Ruby once again. Game generate a number of users and they battle it out by finding treasure, blamming and w00ting each other.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
Activity
0.0
Hey! This is my first rubygem and I made it with the tutorial at pragmaticstudio.com.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
Activity
0.0
Pragmatic Studios ruby programing course
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
Activity
0.0
Just play the best game
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
Activity
0.0
w00t and blam the Three Stooges.
Run the game and enter the number of rounds you want to play, or 'quit' to exit.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
Activity
0.0
INSERT SUMMARY HERE
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
Activity
0.0
Play!
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
Activity
0.0
Multiplayer treasurehunt game
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
Activity
0.0
StudioGame allows the user to play a game in which players can get w00ted or blammed
on each turn. In addition they find and accrue treasures for points.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
Activity
0.0
A simple command line game created as a guided project for the Pragmatic Studio Ruby course.
To run the game type: ./bin/app
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
Activity