Fibonacci Number Generator

The Iterative Version

Last, but not least, we introduce a standard iterative solution. This example, would normally be one of the first discussed for a procedural language, but here, we have left it …

A Partial Plan-based Solution

Partial plans are an alternative to plan rules. The do a similar thing to goal rules, with the exception that no event is generated, and no rule matching takes place. …

A Better Recursive Solution

A better approach is to use recursion where you generate the numbers in their natural order. this makes the code look a little less elegant, but it does result in …

The Recursive Solution

This second program uses recursive subgoals to generate the fibonacci number. The intuitive idea when implementing a recursive solution is, for fib(i), to recursively generate fib(i-1) and fib(i-2). This would …

The Classical Solution

This version of the Fibonacci Number Generator is viewed as the “classic” version because it can be implemented in basic AgentSpeak(L), while the other versions cannot. package examples.fibonnacci; agent Fib …

Introduction

Fibonacci Numbers are numbers in the sequence: 1, 1, 2, 3, 5, 8, 13, … Each number is generated by adding together the two previous number in the sequence, with …