-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsudoku.conf
56 lines (49 loc) · 1.41 KB
/
sudoku.conf
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
54
55
56
source-file sudoku-data.conf
new-session
new-window -d 'TMUX= tmux -L <%= socket %> attach -t "\$0"'
set -g status 5
set -g status-format[0] "top: <%= full_row 0 %> bottom: <%= full_row 5 %>"
set -g status-format[1] " <%= full_row 1 %> <%= full_row 6 %>"
set -g status-format[2] " <%= full_row 2 %> <%= full_row 7 %>"
set -g status-format[3] " <%= full_row 3 %> <%= full_row 8 %>"
set -g status-format[4] " <%= full_row 4 %> press q to quit."
bind -n q { kill-server }
bind -n C-c { kill-server }
set -g @quit_on_finish "$TMUX_QUIT_ON_FINISH"
bind -n o { set -g @quit_on_finish 1 }
bind -n n {
# check if we've solved it yet
if -F '<%= grid_ok %>' {
display 'Solved!'
run -C "set-buffer '<%= show_state %>'"
if -F '#{@quit_on_finish}' {
save-buffer sudoku-solution
kill-server
} {
show-buffer
}
} {
# increment the next value by one
send-keys -t :1 G
}
}
bind -n G {
# increment current value
rename-window '@x<%= x_sub "@blanks", "#S" %>y<%= y_sub "@blanks", "#S" %>'
run -C "set '#W' '#{e|+:1,#{E:##{#W#}}}'"
if -F '#{e|>:#{E:##{#W#}},9}' {
# reset to 1
run -C "set '#W' '1'"
# point to next cell
rename-session '#{e|+:1,#S}'
if -F '<%= more_array? "@blanks", "#S" %>' {
send-keys -t :1 G
} {
display 'FAILED! oh no!'
}
} {
rename-session '0'
send-keys -t :1 n
}
}
send-keys -t :1 n