Page 2 of 2 FirstFirst 1 2
Results 11 to 11 of 11

Thread: -Request- Script to choose cheapest TPS drink

  1. #11
    Join Date
    Aug 2009


    Well, the ridiculously overengineered solution, which I can now suggest because of Veracity's efforts to simplify syntax for map initialization (and to fix records in map literals), looks something like this:
    PHP Code:
    record TpsDrink {
    item drink;
    item booze;
    item fruit;

    TpsDrink[intdrinks {
    0: new TpsDrink($item[vesper], $item[jumbo olive], $item[dry vodka martini]),
    1: new TpsDrink($item[dirty martini], $item[jumbo olive], $item[dry martini]),
    2: new TpsDrink($item[sangria del diablo], $item[cherry], $item[sangria]),
    3: new TpsDrink($item[cherry bomb], $item[cherry], $item[old-fashioned]),
    4: new TpsDrink($item[bodyslam], $item[lime], $item[tequila with training wheels]),
    5: new TpsDrink($item[grogtini], $item[lime], $item[grog]),

    int price(TpsDrink value) {
    mall_price(value.booze) + mall_price(value.fruit);

    void main() {
    sort drinks by price(value);
    "We should drink 1 " drinks[0].drink " for " price(drinks[0]));

    Last edited by heeheehee; 01-12-2017 at 01:01 PM. Reason: cases

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts