Code Monkey home page Code Monkey logo

alan-stdliblab's Introduction

ALAN StdLibLab

This project is Tristano Ajmone's personal experimental playground for the ALAN Standard Library by Anssi Räisänen. It's an unofficial fork for carrying out tests, bugs fixes and enhancements, for personal use.

Creation date: 2019/06/13.


Table of Contents


Introduction

Since April 2018 I've been working on the Alan Italian project, the Italian translation/port of Anssi Räisänen's ALAN StdLib. During this extended work I had a chance to study in depth Anssi's StdLib, and to contribute to its upstream development with some fixes and improvements.

For the Italian port, I've changed some aspects of the upstream library, either due to language and grammar differences between English and Italian, or because I wanted to tweak the library code and behaviour in slightly different directions.

This project is my personal playground where I test tweaks to the StdLib, in order to experiment new approaches and features — which might be also proposed on the upstream project if they turn out useful, but not necessarily so.

My main goal is to maintain a version of the StdLib which mirrors the changes I've introduced in the Italian Library, so that I have almost identical libraries to create adventures in both Italian and English.

Many of the changes I'll be introducing here reflect my own needs and likings, and some of these changes were rejected on the upstream StdLib project, when proposed, for they'd constitute a divergence from the philosophy of the original project. This also means that the StdLibLab project will eventually end up diverging from its upstream source in a manner that might render cross-integration between the two unmanageable — this being a side-effect of experimentation and exploring new paths, and only time can really tell if this is going to be useful or not.

Project Status

The StdLibLab will be in Alpha stage until all known bugs of the StdLib are fixed, and until all the proposed milestones are implemented.

CodeBase Info

This project is built on top of the upstream StdLib taken from commit 137b3cc — the latest development branch for the upcoming v2.2 of the StdLib, which includes various enhancements to the code, especially regarding the clothing system which was rewritten almost from scratch by me, to solve some bugs that had recently surfaced.

License

The Alan Standard Library v2 is © Copyright by Anssi Räisänen, distributed under the Artistic License 2.0. The same license terms apply to this project.

alan-stdliblab's People

Contributors

tajmone avatar

Watchers

 avatar  avatar

alan-stdliblab's Issues

Optimize Verbs With Implicit Taking

Remove useless IF clause to check that implicit-take went well in various verbs, for it's not needed.

  • Find all verbs that have implicit-take and an IF clause to check that it succeeded.
  • Remove the IF clause surrounding the code to be executed after the implicit take.
  • Find if other verbs have similar redundant IF clauses, in contexts other than implicit taking.

Rationale

Various verbs that carry out implicit-taking use an IF clause to check that the implicit take succeeded. E.g. from lib_classes.i, verb give on liquid:

  VERB give -- LIQUID
    WHEN obj
    DOES ONLY
      -- >>> implicit take >>>
      IF THIS NOT IN hero
        THEN
          IF vessel OF THIS = null_vessel OR vessel OF THIS IS NOT takeable
            THEN "You can't carry" SAY THE THIS. "around in your bare hands."
            ELSE LOCATE vessel OF THIS IN hero.
              "(taking" SAY THE vessel OF THIS. "of" SAY THIS. "first)$n"
          END IF.
      END IF.
      -- <<< implicit take <<<

      IF THIS IN hero
        -- i.e. if the implicit taking was successful
        THEN
          "You give" SAY THE vessel OF THIS. "of" SAY THIS. "to" SAY THE recipient. "."
          LOCATE vessel OF THIS IN recipient.
      END IF.

The problem here is that there's no need to carry out that check, for if the LOCATE statement in the implicit-take action were to fail for any reason (e.g. the object is held by an actor) then the rest of the verb execution would be aborted, so there's no risk (nor chance) that the rest of the DOES body is executed anyhow — therefore the whole IF clause surrounding the final part of the verb is unneeded.

Unfortunately, this aspect of Alan VERBs is not covered clearly in the Alan Manual, but here is a proof of this:

--==============================================================================
-- "Test Verb Execution Abortion" by Tristano Ajmone
--==============================================================================

THE room IsA LOCATION
END THE room.

THE box IsA object AT room.
  CONTAINER
    EXTRACT CHECK
      "You can't take things from Bruno's box, he'd be mad at you!"
END THE box.

THE ball IsA object IN box.
END THE ball.

SYNTAX take = take (obj)
  WHERE obj IsA object
    ELSE "You can only take objects."


ADD TO EVERY object
  VERB take
    DOES
      locate obj in Hero.
      "You take $+1." --> If the previous line fails this is not executed!
  END VERB take.
END ADD TO object.

Start at room.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.