RosettaCodeData/Task/ABC-Problem/Oforth/abc-problem.oforth

15 lines
398 B
Text
Raw Permalink Normal View History

2018-06-22 20:57:24 +00:00
import: mapping
["BO","XK","DQ","CP","NA","GT","RE","TG","QD","FS","JW","HU","VI","AN","OB","ER","FS","LY","PC","ZM"]
const: ABCBlocks
2016-12-05 23:44:36 +01:00
: canMakeWord(w, blocks)
| i |
2018-06-22 20:57:24 +00:00
w empty? ifTrue: [ true return ]
2016-12-05 23:44:36 +01:00
blocks size loop: i [
2018-06-22 20:57:24 +00:00
w first >upper blocks at(i) include? ifFalse: [ continue ]
canMakeWord( w right( w size 1- ), blocks del(i, i) ) ifTrue: [ true return ]
2016-12-05 23:44:36 +01:00
]
2018-06-22 20:57:24 +00:00
false
;