cliptic 0.1.2 → 0.1.3

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
  SHA256:
3
- metadata.gz: bed7e4167bd109d3595030a840bfa5295f7fefea8306db6a8843e09feb5bf1c5
4
- data.tar.gz: 76c18f65f31077f7611d37e94025a2133f272553291a0a1cda68eebb3428966a
3
+ metadata.gz: 5c15d9b0f8ee2715ed5b6bbfb6a0abde640380518e4ae10394189d1d7c5b938c
4
+ data.tar.gz: 8bb8ad98ae095391b859af404aa91640f00b72beabec64cfe1cf717280ed828f
5
5
  SHA512:
6
- metadata.gz: 26e80fd00217904ed0d081cf8a676c339e82d2c586667ebf8f47daa542fb9b3ec427b8b89bb4860b087b28f555624d03ccfa56fd1d9050bd28dfe4dcaff1968f
7
- data.tar.gz: 8c29f4b0fa7ef0c25db0256854917de5b868f3068099588dc423c1aa4aa8f23715c7124d15e5175577b161cf0e2e0109a5587f049aaba6ad9e8960618cba79e7
6
+ metadata.gz: 64d058d05dae4b2fde66d0d47cddef98104396ee26dda9a4484a1e2b5541a203211741d0ddc715f8d42c78db6ca4d41623da3f4ab6361ece44558661ec9eab22
7
+ data.tar.gz: d3594c6af426c9306becf1c53fedf901bad49b95a0369763f97b377ac7bd1603f4796bf1a4d94e5783e6e6d5c1ee8b5f06f9f9d5728539f4a963fc0af2dd2276
data/README.md CHANGED
@@ -7,16 +7,15 @@
7
7
  - Puzzles are sourced from the free crosswords uploaded daily to [Lovatt's][1].
8
8
  - cliptic is written in Ruby using the ncurses library
9
9
 
10
- ## New to 0.1.2
10
+ ## New to 0.1.3
11
11
 
12
12
  ### Bug Fixes
13
- - Screen setup/config file bug fix
14
- * Previously screen resize prompt would not show if screen was too small due to inability to source default colours
15
- - Fix earliest date bug (thank you `samtell21` for pointing this out)
16
- - Center the resize prompt
13
+ - Fix the ssl certificate bug that prevents fetching puzzles
14
+ - Fix the "out of range" bug when moving to an undefined index using `g`
17
15
 
18
16
  ### Features
19
- - Add menu recolour feature
17
+ - Add manual redraw feature to the main puzzle view. Called with `^L` (useful for terminal resize)
18
+ - Add exit controls to the resize interface (`q` or `^C`)
20
19
 
21
20
  ## Features
22
21
  - VIM-like keybindings
@@ -108,14 +107,15 @@ rake build install
108
107
 
109
108
  ### Global Commands
110
109
 
111
- | Command | Action |
112
- |---------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
113
- | `^S` | Save current progress (note that progress is saved when exiting puzzles by default) |
110
+ | Command | Action |
111
+ |---------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
112
+ | `^S` | Save current progress (note that progress is saved when exiting puzzles by default) |
114
113
  | `^R` | Reveals solution for focussed clue (note that this forfeits adding this puzzle to high scores) |
115
- | `^C` | Exit puzzle |
116
- | `^E` | Resets timer and progress for puzzle |
117
- | `^G` | Mark current progress (only relevant if auto_mark is set to 0) |
118
- | `^P` | Pause game |
114
+ | `^C` | Exit puzzle |
115
+ | `^E` | Resets timer and progress for puzzle |
116
+ | `^G` | Mark current progress (only relevant if auto_mark is set to 0) |
117
+ | `^P` | Pause game |
118
+ | `^L` | Redraws the screen (useful on resizing terminal window) |
119
119
 
120
120
  ### Navigation (Normal Mode)
121
121
  - There are several ways to navigate the cells of the cliptic grid in **NORMAL MODE**.
@@ -91,7 +91,8 @@ module Cliptic
91
91
  end
92
92
  def show
93
93
  while Screen.too_small?
94
- draw; getch
94
+ draw
95
+ exit if (c = getch) == ?q || c == 3
95
96
  end
96
97
  end
97
98
  def prompt
@@ -179,6 +180,7 @@ module Cliptic
179
180
  def enter(pre_proc:->{hide}, post_proc:->{show})
180
181
  pre_proc.call if pre_proc
181
182
  opts.values[selector.cursor]&.call
183
+ reset_pos
182
184
  post_proc.call if post_proc
183
185
  end
184
186
  def back(post_proc:->{hide})
@@ -230,6 +232,7 @@ module Cliptic
230
232
  def enter
231
233
  hide
232
234
  Main::Player::Game.new(date:stat_date).play
235
+ reset_pos
233
236
  show
234
237
  end
235
238
  def reset_pos
data/lib/cliptic/main.rb CHANGED
@@ -144,7 +144,9 @@ module Cliptic
144
144
  .dig(:cells, 0, :meta, :data).length > 0
145
145
  end
146
146
  def raw
147
- @raw || Curl.get(URL, data).body
147
+ @raw || Curl.get(URL, data) do |curl|
148
+ curl.ssl_verify_peer = false
149
+ end.body
148
150
  end
149
151
  end
150
152
  class Cache < Request
@@ -422,17 +424,18 @@ module Cliptic
422
424
  end
423
425
  class Board
424
426
  include Puzzle, Windows
425
- attr_reader :puzzle, :grid, :box, :cursor, :clue, :dir
426
- def initialize(date:Date.today)
427
+ attr_reader :puzzle, :grid, :box, :cursor, :clue, :dir, :state
428
+ def initialize(date:Date.today)#, state:)
427
429
  @puzzle = Puzzle::Puzzle.new(date:date)
428
430
  @grid = Grid.new(puzzle:puzzle)
429
431
  @box = Cluebox.new(grid:grid)
430
432
  @cursor = Cursor.new(grid:grid)
433
+ #@state = state
431
434
  end
432
435
  def setup(state:nil)
433
436
  grid.draw
434
437
  load_state(state:state)
435
- set_clue(clue:puzzle.first_clue, mv:true)
438
+ set_clue(clue:puzzle.first_clue, mv:true) if !@clue
436
439
  update
437
440
  self
438
441
  end
@@ -556,7 +559,7 @@ module Cliptic
556
559
  puzzle.get_clue(y:y, x:x, dir:dir)
557
560
  end
558
561
  def get_clue_by_index(i:)
559
- puzzle.get_clue_by_index(i:i, dir:dir)
562
+ puzzle.get_clue_by_index(i:i, dir:dir) || clue
560
563
  end
561
564
  def addch(char:)
562
565
  current_cell.write(char.upcase)
@@ -605,16 +608,13 @@ module Cliptic
605
608
  attr_accessor :mode, :continue, :unsaved
606
609
  def initialize(date:Date.today)
607
610
  @date = date
608
- @state = State.new(date:date)
609
- @board = Board.new(date:date)
610
- @top_b = Top_Bar.new(date:date)
611
- @bot_b = Bottom_Bar.new
611
+ init_windows
612
612
  @timer = Timer.new(time:state.time, bar:top_b,
613
613
  callback:->{board.update})
614
614
  @ctrls = Controller.new(game:self)
615
615
  @unsaved = false
616
616
  @continue = true
617
- setup
617
+ draw
618
618
  end
619
619
  def play
620
620
  if state.done
@@ -624,10 +624,11 @@ module Cliptic
624
624
  game_and_timer_threads.map(&:join)
625
625
  end
626
626
  end
627
- def setup
628
- [top_b, bot_b].each(&:draw)
629
- self.mode = :N
630
- board.setup(state:state)
627
+ def redraw
628
+ save
629
+ Screen.clear
630
+ init_windows
631
+ draw
631
632
  end
632
633
  def unsaved=(bool)
633
634
  @unsaved = bool
@@ -676,6 +677,17 @@ module Cliptic
676
677
  Screen.clear
677
678
  end
678
679
  private
680
+ def init_windows
681
+ @state = State.new(date:date)
682
+ @board = Board.new(date:date)
683
+ @top_b = Top_Bar.new(date:date)
684
+ @bot_b = Bottom_Bar.new
685
+ end
686
+ def draw
687
+ [top_b, bot_b].each(&:draw)
688
+ self.mode = :N
689
+ board.setup(state:state)
690
+ end
679
691
  def completed
680
692
  save
681
693
  log_score
@@ -789,6 +801,7 @@ module Cliptic
789
801
  5 => ->{game.reset_menu.choose_opt},
790
802
  7 => ->{game.board.puzzle.check_all},
791
803
  9 => ->{game.board.swap_direction},
804
+ 12 => ->{game.redraw},
792
805
  16 => ->{game.pause},
793
806
  18 => ->{game.reveal},
794
807
  19 => ->{game.save}
@@ -1,3 +1,3 @@
1
1
  module Cliptic
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cliptic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christian Welham
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-07-15 00:00:00.000000000 Z
11
+ date: 2021-10-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: curses