Programming with Python. Part 6. First Demo Extended

emerging-mind.org
eJournal ISSN 2567-6466
(info@emerging-mind.org)
Author: Gerd Doeben-Henisch
gerd@doeben-henisch.de

ZIP-SW

VIDEO

Abstract

Part 4 was the first Milestone. For details see that document. In part 5 only small modifications and extensions happened.

Modifying Control Window Calls

There is only one simple call to start the control window without any other functions, this is ctrlWinStart(). All other calls do operate on features of the control window.

Extending Control Options With Percentage of Objects

A new control feature has been introduced: asking for the percentage of objects to be placed in the environment: ctrlWinLocateAct(winC). This allows a number between 1-100. The percentage of food-objects is still kept fixed with ’nfood = 1′.

The Whole Story Now

  1. A 7 x 7 grid is offered with empty cells.
  2. The user is asked for the percentage of objects in the environment (nobj) which shall randomly be distributed (black cells).
  3. 1% of cells is randomly occupied by food (i.e. here one cell) (green cell).
  4. The start position of an actor (red circle) can be selected by pointing into the grid.
  5. The number of cycles can be entered how often the environment shall be repeat the event loop.
  6. The type of behavior function of the actor can be selected: manually (:= 0), fixed (:= 1) as well as random (:= 2). With option 1 or 2 the demo is running by its own. With option 0 you have to select the next direction manually by clicking into the grid.
  7. While the demo is running it reports the actual energy level of the actor as well as the actual ‚Time of the environment‘ (which corresponds closely to the number of cycles).
  8. If either the maximum number of cycles is reached or the energy of the actor is below 0 the application will stop and after clicking into the grid  vanishes from the screen.

Asking for Percentage of Objects

ae5-Control Window asking for Percentage of Obstacles in Environment
ae5-Control Window asking for Percentage of Obstacles in Environment

Asking for Number of Cycles

AE5 - Control Window Asking for Number of Cycles to Run
AE5 – Control Window Asking for Number of Cycles to Run

ASKING FOR POINTING INTO THE GRID TO LOCATE ACTOR

AE5 - Control Window askeds to point into Grid to locate the actor
AE5 – Control Window askeds to point into Grid to locate the actor

Showing Env With Obstacles and Food

AE5 - Control Window Showing Actual Distribution of Obstacles (black), Food (green), as well as an Actor (green)
AE5 – Control Window Showing Actual Distribution of Obstacles (black), Food (green), as well as an Actor (green)

Select Behavior Type

AE5 - Control Window asking for Wanted Behavior Type of Actor (0-2)
AE5 – Control Window asking for Wanted Behavior Type of Actor (0-2)

Final Stage

AE5 - windows shows Grid with final state
AE5 – windows shows Grid with final state
AE5 - Control Windows Comments Final Stage with no moe Energy for Actor
AE5 – Control Windows Comments Final Stage with no moe Energy for Actor

The Importance of Freedom and Creativity

Although this environment is very simple, it can demonstrate a lot of basic ‚verities‘. It shows directly the inappropriateness of a fixed behavior even in a static environment. This implies that a non-fixed behavior realized as a random behavior is in principle strong enough to find a solution (if there is any). Whether a solution is possible or not depends from the available time which in turn depends form the available energy.

If one interprets‚random behavior‘ as a behavior based on freedom and creativity then one has here a strong motivation that a society based on freedomand creativityhas (other ‚bad‘ factors neutralized) the best chances to master an unknown future.

How to Continue

You can continue with Part 1 ‚How to Program with Python under ubuntu 14.04?‘