-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsb_ucd_anal.rb
70 lines (60 loc) · 2.65 KB
/
sb_ucd_anal.rb
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/usr/bin/env ruby
=begin
Strange Beta: An Assistance System for Indoor Rock Climbing Route Setting
Copyright (C) 2011 Caleb Philips, Lee Becker, Elizabeth Bradley
Website: http://strangebeta.com
Article: https://aip.scitation.org/doi/10.1063/1.3693047
Modifications are made by Lindsay Kempen (2019)
2019 January & February Modified and documented existing code
2019 January & February Used parts of (altered) code in other files
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
=end
#user_id | route_id | seq_no | hand | move | crux
#--------+----------+--------+------+---------------------------------------------------------------------------------------------------------------------------+------
# 1 | 1 | 1 | R | Matched on jug | f
spellcheck = {
"crip" => "crimp",
"bumb" => "bump",
"sixepull" => "sidepull",
"ladge" => "ledge",
"slopper" => "sloper",
"incutpinch" => "incut pinch",
"sidepullundercling" => "sidepull undercling",
"pinchslopper" => "pinch sloper",
"diagnol" => "diagonal",
"ledgematch" => "ledge match",
"crimppinch" => "crimp pinch",
"flakecling" => "flake cling",
"crimpslopper" => "crimp sloper",
"gastone" => "gaston",
"sidepul" => "sidepull",
"rignt" => "right",
"slop" => "sloper",
"crinp" => "crimp",
"crimpsidepull" => "crimp sidepull",
"slipper" => "sloper",
"knee drops" => "dropknee",
"thumbcatch" => "thumb catch",
"drop knee" => "dropknee"
}
n = 0
$stdin.each_line{ |l|
n += 1
next if n <= 2
break if l =~ /^\(\d+ rows\)/
uid,rid,mid,hand,move,crux = l.split(/\|/).collect{ |e| e.strip }
uid,rid,mid = [uid,rid,mid].collect{ |e| e.to_i }
hand = (hand == "R") ? :right : :left
crux = (crux == "f") ? false : true
move = move.downcase.tr('-',' ').tr('^a-z0-9 ','').split(/\s+/).collect{ |e| spellcheck[e].nil? ? e : spellcheck[e] }.join(" ")
puts [uid,rid,mid,hand,crux,move].join("|")
}