View Single Post
Old 05-04-2014, 02:27 PM   #13
PeterT
Grand Sorcerer
PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.
 
Posts: 13,585
Karma: 79436940
Join Date: Nov 2007
Location: Toronto
Device: Libra H2O, Libra Colour
Possibly a slightly "cleaner" way of coding this might be
Code:
program: 
words=raw_field('#words');
shelf_name='Short Story';
shelf_name=cmp(words, 7500, shelf_name, 'Novelette', 'Novelette');
shelf_name=cmp(words, 17500, shelf_name, 'Novella', 'Novella');
shelf_name=cmp(words, 40000, shelf_name, 'Novel', 'Novel');
shelf_name=cmp(words, 50000, shelf_name, 'Long', 'Long');
shelf_name=cmp(words, 75000, shelf_name, 'Epic', 'Epic');
The major difference here is that all the calls to cmp are coded the same way;
shelf_name=cmp(word, number, shelf_name, 'Name to Use', 'Name to Use');
where number is the upper limit on the PREVIOUS book's length
and Name to Use is the name to assign to books LONGER than number words long.
PeterT is offline   Reply With Quote