Git Product home page Git Product logo

smackfeebs's Introduction

Planet of the Feebs is a game based on the original version available here. Quoting the Cliki: "Planet of the Feebs was originally developed at the beginning of the nineties[?] by Scott Falhman, Skef Wholey and others at Carnegie-Mellon University, and it was placed in the public domain." This game also takes inspiration from The Feebs War by Gustavo Henrique Milaré. This version is purely repl/web based and uses a separate smacklisp interpreter for each feeb. That is, each feeb is programmed in smacklisp with a separate programming space. The game itself still runs in Common Lisp. The web version is at smacklisp.com.

The game is rather simple. A feeb needs to traverse the maze searching and killing other feebs. The feeb also needs to search for mushrooms or carcasses to eat to maintain its energy. If energy runs out, the feeb starves and dies. If the feeb is flamed, he dies. The carcass of the feeb will last for a random number of turns, and then the feeb will be reincarnated at a random entry point. Each turn cost the feeb energy and flaming costs energy. After a feeb flames, he will need to recover before flaming again.

The user will need to write a function named "brain" to control his feeb. The "brain" function must have this name and needs to return a keyword symbol from the list: :turn-left, :turn-right, :turn-around, :move-forward, :flame, :eat-mushroom, :eat-carcass, :peek-left, :peek-right, :noop, :wait. The feeb has his own smacklisp environment and can define whatever helper functions or global variables he wishes. The feeb has no direct access to the game or access to the smacklisp environment of other feebs. Access to the game and maze environment is done through API functions defined in the SmackFeebs API Reference in the SmackRef tab.

After defining his brain, the user can play the game by calling the function "play-game" from the repl. The user can also test his brain with the functions "play-cycle", "play-restart", "test-feeb-brain". Also all API functions are available to the user through the repl.

The advanced user can modify the game by changing parameters and changing the maze layout. Use the function "set-parm". The parameters are also defined in the API. "maze-layouts" lists the mazes available and "change-maze-layout" allows the user to change the maze.

You need to create "planet-create" or join "planet-join" a planet. Use "set-feeb-name" to personalize your name.

It is advisable to create scripts that you can load.

The following is a brain used by the system feebs:

;; smacklisp code for auto-brain
(defun feeb-in-sight ()
  (find-if (lambda (sq) (member-if #'feeb-image-p sq))
           (vision-ahead)))

(defun fireball-in-sight ()
  (find-if (lambda (sq) (member-if #'fireball-image-p sq))
           (vision-ahead)))

(defun brain ()
  (let ((here (current-square)))
    (cond ((and (member :mushroom here)
                (< (feeb-energy)
                   (get-parm :maximum-energy)))
           :eat-mushroom)
          ((and (member :carcass here)
                (< (feeb-energy)
                   (get-parm :maximum-energy)))
           :eat-carcass)
          ((and (ready-to-fire-p)
                (> (- (feeb-energy)
                      (get-parm :flame-energy))
                   10)
                (feeb-in-sight))
           :flame)
          ((and (not (member :rock (left-square)))
                (not (eq :turn-right (feeb-last-move)))
                (not (find-if #'fireball-image-p (left-square)))
                (or (member :mushroom (left-square))
                    (> 0.3 (random 1.0))))
           :turn-left)
          ((and (not (member :rock (right-square)))
                (not (eq :turn-left (feeb-last-move)))
                (not (find-if #'fireball-image-p (right-square)))
                (or (member :mushroom (right-square))
                    (> 0.3 (random 1.0))))
           :turn-right)
          ((and (> (length (vision-ahead)) 0)
                (not (fireball-in-sight)))
           :move-forward)
          ((not (member :rock (rear-square)))
           :turn-around)
          ((not (member :rock (right-square)))
           :turn-right)
          ((not (member :rock (left-square)))
           :turn-left)
          (t :wait))))

smackfeebs's People

Contributors

aarvid avatar

Watchers

 avatar  avatar

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.