- Atributos (FOR, DES, CON, INT, SAB, CAR) com valores e modificadores clicáveis para rolagem
- Gerenciamento de PV (pontos de vida) com controles de incremento/decremento
- Gerenciamento de PM (pontos de mana) com controles
- Defesa: CA (Classe de Armadura) e DFM (Defesa de Manobra de Combate)
- Resistências: Fortitude, Reflexos e Vontade
Ruby prioriza flexibilidade e expressividade, permitindo múltiplas formas de resolver um problema.
Python enfatiza legibilidade e uma única maneira óbvia de fazer algo (Zen of Python).
Ruby: Dinâmico e Flexível
class Pessoa
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def traverse(from) | |
| Dir.chdir(from) if Dir.glob(from) | |
| files = Dir.glob('*').select { |fn| File.file?(fn)} | |
| process_files(files) | |
| subdirs = Dir.glob('./*/').reject{|i| i == from} | |
| if subdirs.empty? | |
| Dir.chdir('..') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| app/ | |
| ├── controllers | |
| │ └── books_controller.rb | |
| ├── helpers | |
| │ └── books_helper.rb | |
| ├── models | |
| │ └── book.rb | |
| └── views | |
| └── books | |
| └── ... my views ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| my_hash = Hash.new(foo: 1, bar:2) | |
| var_foo = my_hash[:foo] ? my_hash[:foo] : 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; a is set to 1 | |
| (define a 1) | |
| ;; Mutating a, beware! | |
| (set! a 2) | |
| ;; Prints 2 | |
| (print a) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ingredients = Set.new([ | |
| :avocado, | |
| :garlic, | |
| :onion, | |
| :lemon, | |
| :black_pepper, | |
| :coriander | |
| ]) #<Set: {:avocado, :garlic, :onion, :lemon, :black_pepper, :coriander}> | |
| if ingredients.add?(:tomato) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| my_hash = {} # => {} | |
| my_hash.merge id: 1 # => {id: 1} | |
| my_hash # => {} - my_hash did not change | |
| my_hash.merge! id: 1 # => {id: 1} | |
| my_hash # => {id: 1} - my_hash changed |
NewerOlder