Chevening House Maze NetLogo Model

Produced for the book series "Artificial Intelligence";

Author: W. J. Teahan; Publisher: Ventus Publishing Aps, Denmark.

powered by NetLogo

view/download model file: Chevening-House-Maze.nlogo

WHAT IS IT?

This model draws a schematic of the Chevening House maze in the United Kingdom. The entrance is at the middle bottom of the maze, and the goal is to get to the centre. The maze has been designed to specifically thwart the hand-on-the-wall behaviour for reaching the centre. In this case, the centre occurs on an island which is not directly connected to the outside walls.


THE INTERFACE

The setup-chevening-maze button will redraw the maze.

The sliders are defined as follows:
- row-patches-width : the width between horizontal walls in the maze;
- col-patches-width : the width between vertical walls in the maze.


HOW IT WORKS

It uses one ask patches command to set the patches blue that define the walls, and to set the remaining patches white. The code uses two procedures that are similar, setup-row and setup-col, to draw the walls in a horizontal row or vertical column respectively. These procedures take the row or column number as the first parameter, the colour that the walls are to be drawn with, and a list containing two-numbered range lists that define the segments where the walls are to be drawn in the row or column.


HOW TO USE IT

You can't really use it for anything, except for changing the values in the sliders to create different sized mazes. To have the model draw the maze, press the setup-chevening-maze button.


WHAT IS ITS PURPOSE?

Its purpose is to create a virtual maze that has a corresponding maze in real-life to demonstrate how virtual environments can mirror real-life environments but where the reflection can often be distorted in the process.


THINGS TO TRY

See what happens when you change the value of the sliders.

Try changing the Settings of the environment such as the Patch size and the maximum and minimum x and y co-ordinates.

Try drawing the middle island in another colour to show that it is indeed an island.


EXTENDING THE MODEL

Try adding a turtle agent to move around the maze.


RELATED MODELS

See the Empty Maze and Hampton Court Maze models.


CREDITS AND REFERENCES

To refer to this model in publications, please use:

Teahan, W. J. (2010). Chevening House Maze NetLogo model.
Artificial Intelligence. Ventus Publishing Aps.


PROCEDURES

; Hampton Court Maze model
; 
; Draws a schematic map of the Hampton Court Maze.

; Copyright 2010 William John Teahan. All Rights Reserved.
        
to setup-row [row colour segments]
  foreach segments
  [
      if pycor = row * row-patches-width and
        (pxcor >= col-patches-width * (item 0 ?)) and (pxcor <= col-patches-width * (item 1 ?))
          [set pcolor colour]
  ]
end

to setup-col [col colour segments]
  foreach segments
  [
      if pxcor = col * col-patches-width and
        (pycor >= row-patches-width * (item 0 ?)) and (pycor <= row-patches-width * (item 1 ?))
          [set pcolor colour]
  ]
end

to setup-chevening-house-maze
  ca ;; clear everything
  
  ask patches
  [
      if (pxcor >= min-pxcor and pxcor <= max-pxcor and
        pycor >= min-pycor and pycor <= max-pycor)
          [set pcolor white] ;; make background full of white patches
      
      setup-row  12 blue [[-11 12]]
      setup-row  11 blue [[-10 11]]
      setup-row  10 blue [[-9 10]]
      setup-row   9 blue [[-8 0] [1 9]]
      setup-row   8 blue [[-7 -1] [2 8]]
      setup-row   7 blue [[-6 0] [1 7]]
      setup-row   6 blue [[-5 0] [1 6]]
      setup-row   5 blue [[-4 -1] [2 5]]
      setup-row   4 blue [[-3 0] [1 4]]
      setup-row   3 blue [[-2 3]]
      setup-row   2 blue [[-1 2]]
      setup-row   1 blue [[-9 -5] [-4 -2] [3 5] [6 8] [10 11]]
      setup-row  -0 blue [[-9 -7] [3 5] [6 10]]
      setup-row  -1 blue [[-1 0] [1 2] [7 9]]
      setup-row  -2 blue [[-2 0] [1 3]]
      setup-row  -3 blue [[-3 -1] [1 4]]
      setup-row  -4 blue [[-4 -2] [2 5]]
      setup-row  -5 blue [[-5 -3] [2 6]]
      setup-row  -6 blue [[-6 -3] [1 7]]
      setup-row  -7 blue [[-7 -2] [0 8]]
      setup-row  -8 blue [[-8 1] [3 9]]
      setup-row  -9 blue [[-9 0] [3 10]]
      setup-row -10 blue [[-10 -1] [2 11]]
      setup-row -11 blue [[-11 0] [1 12]]

      setup-col  12 blue [[-11 12]]
      setup-col  11 blue [[-10 1] [2 11]]
      setup-col  10 blue [[-9 0] [1 10]]
      setup-col   9 blue [[-8 -1] [0 9]]
      setup-col   8 blue [[-7 -2] [1 8]]
      setup-col   7 blue [[-6 -1] [2 7]]
      setup-col   6 blue [[-5 0] [1 6]]
      setup-col   5 blue [[-4 0] [1 5]]
      setup-col   4 blue [[-3 -1] [2 4]]
      setup-col   3 blue [[-2 0] [1 3]]
      setup-col   2 blue [[-10 -7] [-1 2]]
      setup-col   1 blue [[-11 -8] [-6 -1] [4 6] [7 9]]
      setup-col   0 blue [[-11 -9] [-7 -1] [4 6] [7 9]]
      setup-col  -1 blue [[-8 -3] [-1 2]]
      setup-col  -2 blue [[-7 -4] [-2 0] [1 3]]
      setup-col  -3 blue [[-3 1] [2 4]]
      setup-col  -4 blue [[-4 0] [1 5]]
      setup-col  -5 blue [[-5 6]]
      setup-col  -6 blue [[-6 0] [2 7]]
      setup-col  -7 blue [[-7 0] [1 8]]
      setup-col  -8 blue [[-8 -1] [2 9]]
      setup-col  -9 blue [[-9 0] [1 10]]
      setup-col -10 blue [[-10 11]]
      setup-col -11 blue [[-11 12]]
  ]
end
;
; Copyright 2010 by William John Teahan.  All rights reserved.
;
; Permission to use, modify or redistribute this model is hereby granted,
; provided that both of the following requirements are followed:
; a) this copyright notice is included.
; b) this model will not be redistributed for profit without permission
;    from William John Teahan.
; Contact William John Teahan for appropriate licenses for redistribution for
; profit.
;
; To refer to this model in publications, please use:
;
; Teahan, W. J. (2010).  Chevening House Maze NetLogo model.
;   Artificial Intelligence. Ventus Publishing Aps.
;