minesweeper-curses 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 72a271c6a7011e3729fe7f9afc4ad0300e511dff
4
- data.tar.gz: 2bbefb3ff25068f81b003bec8e2c995f4e941e54
3
+ metadata.gz: 46549184e142f079bb77874cbe35b4b82ee80f82
4
+ data.tar.gz: fc5dd237f3a052473c6f85395632c8f7624616c4
5
5
  SHA512:
6
- metadata.gz: 66916578e24ee520662ee5c69f4f55da5f7403602d7177a265d443aa4695b05cb7657fea7a20a766bbe67e056841556824fdb30d676a9d6a3fa74c47167ce7a4
7
- data.tar.gz: 226ffa6c95f0ff892dfefd11db791e858789cc1be5a58ee3ccd35590a4ca31a4a9090fb93e0f634343c642b30a1db47c1b1004ae664d88e5b4a8e3b57496e534
6
+ metadata.gz: fb826dd21e2512fb6b03c1eddfde73eba42773686f2811dd82c1e7a450b4ca21fffcb6af5565470321f99e315047528b66468a36ea714dfae1e9cce265ee31c9
7
+ data.tar.gz: 8c8dd51a2a0b80c7d71db83e1e0b8901d55fde6555c965f4d67ba7a0254d7ee12a70e413552156fdaea8ec7ee6ebb88d480394e1dab2a3dc55c07066db4f7164
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- minesweeper-curses (0.3.0)
4
+ minesweeper-curses (0.3.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -3,6 +3,6 @@
3
3
  lib = File.expand_path(File.dirname(__FILE__) + '/../lib')
4
4
  $LOAD_PATH.unshift(lib) if File.directory?(lib) && !$LOAD_PATH.include?(lib)
5
5
 
6
- load './lib/minesweeper.rb'
6
+ require_relative './../lib/minesweeper.rb'
7
7
 
8
8
  Minesweeper::GameInitializer.new.start
@@ -66,13 +66,15 @@ module Minesweeper
66
66
  window.setpos(0, 1)
67
67
  end
68
68
 
69
+ def cell_x
70
+ curx / STEP
71
+ end
72
+
69
73
  def open_cell
70
- cell_x = curx / STEP
71
74
  open_original(cury, cell_x)
72
75
  end
73
76
 
74
77
  def toggle_bomb_flag
75
- cell_x = curx / STEP
76
78
  cell = cells[cury][cell_x]
77
79
  cell.toggle_bomb_flag!
78
80
  raise GameWon if game_won?
@@ -132,9 +134,9 @@ module Minesweeper
132
134
  found_bombs_count = found_bombs.count
133
135
  reveal_bombs
134
136
  draw_board
135
- window.setpos(height + 3, 0)
137
+ window.setpos(height + 1, 0)
136
138
  window.addstr e.message
137
- window.setpos(height + 5, 0)
139
+ window.setpos(height + 3, 0)
138
140
  window.addstr <<~STR
139
141
  Game Stats: you have found #{found_bombs_count} out of #{bombs.count} bombs
140
142
 
@@ -215,7 +217,7 @@ module Minesweeper
215
217
  end
216
218
 
217
219
  def number_of_cells
218
- height * width
220
+ cells.flatten.count
219
221
  end
220
222
  end
221
223
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Minesweeper
4
- VERSION = '0.3.0'
4
+ VERSION = '0.3.1'
5
5
  end
data/readme.md CHANGED
@@ -1,12 +1,13 @@
1
1
  [![Build Status](https://travis-ci.org/ruba-ruba/minesweeper.svg?branch=master)](https://travis-ci.org/ruba-ruba/minesweeper)
2
2
  [![Coverage Status](https://coveralls.io/repos/github/ruba-ruba/minesweeper/badge.svg?branch=master)](https://coveralls.io/github/ruba-ruba/minesweeper?branch=master)
3
+ [![Gem Version](https://badge.fury.io/rb/minesweeper-curses.svg)](https://badge.fury.io/rb/minesweeper-curses)
3
4
 
4
5
  ### Minesweeper Terminal
5
6
  > Console version of [minesweeper game](https://en.wikipedia.org/wiki/Microsoft_Minesweeper) written in [ruby](https://www.ruby-lang.org/en/) & [curses gem](https://github.com/ruby/curses)
6
7
 
7
8
  #### Requirements
8
9
 
9
- - ruby 2.4.1
10
+ - ruby 2.4.1 or higher
10
11
 
11
12
  #### Setup
12
13
 
@@ -20,13 +21,13 @@
20
21
 
21
22
  #### Launching
22
23
 
23
- - minesweeper-curses
24
+ - `minesweeper-curses`
24
25
 
25
26
  #### Controls
26
27
 
27
- - use arrow keys to move over the mineboard
28
- - use space to mark cell as a bomb
29
- - use enter to open the cell
28
+ - ←↑→↓ to move over the mineboard
29
+ - to mark cell as a bomb
30
+ - to open the cell
30
31
 
31
32
  #### License
32
33
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minesweeper-curses
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mykhailo Rybak
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-26 00:00:00.000000000 Z
11
+ date: 2017-06-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler