about summary refs log tree commit diff stats
path: root/app/views/puzzles/about.html.haml
blob: f1f7aa099657684f42ea03c7ea07991916d36dd6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
%p.summary <strong>Wittle</strong> gives you daily randomly-generated puzzles in the style of those from the 2016 indie game, <a href="http://the-witness.net">The Witness</a>. There are three difficulties of puzzles to choose from:
%h2#current-date= @normal_puzzle.created_at.localtime.strftime("%B %-d, %Y")
%nav#choose-difficulty
  #normal-link
    = link_to "Normal", @normal_puzzle
    - if @normal_solved
      %p.puzzle-status Solved!
    - elsif @normal_started
      %p.puzzle-status Started
  #hard-link
    = link_to "Hard", @hard_puzzle
    - if @hard_solved
      %p.puzzle-status Solved!
    - elsif @hard_started
      %p.puzzle-status Started
  #expert-link
    = link_to "Expert", @expert_puzzle
    - if @expert_solved
      %p.puzzle-status Solved!
    - elsif @expert_started
      %p.puzzle-status Started
#new-puzzles
  - if @normal_puzzle.created_at.localtime.to_date != DateTime.now.localtime.to_date
    New puzzles are being generated...
  - else
    Time until new puzzles: <span id="hours">00</span>:<span id="minutes">00</span>:<span id="seconds">00</span>
    :javascript
      function pad(val) {
        var valString = val + ""
        if (valString.length < 2)
        {
          return "0" + valString
        } else {
          return valString
        }
      }
      function setTime() {
        --totalSeconds
        if (totalSeconds == 0)
        {
          $("#new-puzzles").text("Refresh the page for today's puzzles!")
          clearInterval(timerInterval)
        } else {
          $("#seconds").text(pad(totalSeconds%60))
          $("#minutes").text(pad(parseInt(totalSeconds/60)%60))
          $("#hours").text(pad(parseInt(parseInt(totalSeconds/60)/60)))
        }
      }
      var totalSeconds = #{(Time.now.tomorrow.beginning_of_day - Time.now).to_i + 1}
      setTime()
      var timerInterval = setInterval(setTime, 1000);
%p.summary Wittle was created by <a href="https://www.fourisland.com/">Hatkirby</a>, with major help from <a href="https://github.com/sigma144/witness-randomizer">Sigma144</a> (who wrote the puzzle generation code) and <a href="https://github.com/jbzdarkid/jbzdarkid.github.io">jbzdarkid</a> (who wrote the puzzle solving web interface). The source code is available <a href="https://code.fourisland.com/wittle">here</a>. If you encounter any bugs, or have feedback regarding puzzle difficulty level, feel free to contact me! I am <code>hatkirby</code> on Discord, and you can also find me in the <a href="https://discord.gg/0nJwyUyYIfTEgSz0">Witness Speedrunning server</a>.
%p.summary There is an <a href="#{ archive_path }">archive of past puzzles</a> for those interested.