…is always light

The numbers as distances — and the entire number theory is geometry

Let us examine numbers as distances from some number.

If we choose as starting point the zero (0), we have the usual case.

0 = |0 – 0|
1 = |0 – 1|
2 = |0 – 2|

n = |0 – n|

Each distance can be divided into parts, let’s think the number space as the familiar set R. For example the distance from zero to two can be divided in n parts, we get distances 2 / n between zero and two.

The point from which we started isn’t a distance but — like said — a point, that can’t be divided into smaller parts. Philosophically speaking this point is now in words of Democritus “atomos”, the smallest unit.

In the book “The way to geometry” it is said: “The magnitude of a point is zero.”

When we founded the numbers as distances in relation to zero, the zero point is indivisible; because in question is a point not a distance, dividing zero (a point) by any number, we get zero. Zero doesn’t get smaller by dividing.

Of course zero can’t be divided by itself. In distance interpretation philosophically speaking indivisible would be divided by indivisible.

Now zero is different from other numbers so that it is a point, the other numbers are distances from this point.

geometry-1044090_640

As distance interpretation we could start the numbers also in relation for example to number eight (8).

Now eight is a point, we get the other numbers as distances to number eight.

0 = ||8 – 8| – 0||
1 = ||8 – 8| – 1||
2 = ||8 – 8| – 2||

n = ||8 – 8| – n||

Here from number eight is “created new zero”. First we determine the distance of number eight from itself, then the distance of examined number from the determined distance earlier..

We could get the numbers (distances) and the zero point also by denoting:

0 = |8 – (8 + 0)|
1 = |8 – (8 + 1)|
2 = |8 – (8 + 2)|

n = |8 – (8 + n)|

When we see the numbers as distances from some number, we notice, that the distance can be divided into smaller parts, but the point from which we started, we can’t divide into smaller parts.

In our example when we started from eight, we examine first the distance of eight from itself, |8 – 8| = 0, which is and remains as zero.

The distance can be even or uneven, but the point from which the distance is determined can’t be even or uneven, that is the whole point of this post.

If we want also the negative numbers as distance interpretation, we simply put the minus sign before the determined distance, for example -2 = -|0 – 2| and this is how we can get the entire set R so that the distances from zero point can be divided into smaller parts, but zero point is and remains zero and is not a distance but a point. In the words of Euclid that which has no part. In my own words: “Indivisible”.

In this way the specialty of zero can be seen better.

Advertisements

The distance of zero from itself

The title is a bit absurd, we could examine the distance of any number from itself..

In the previous post I examined the property of distance being even or uneven. Let’s go back to distance of zero from itself. Formally the distance of zero from itself is |0 – 0| = 0. 0 mod 2 = 0, why isn’t this distance even?

The distance doesn’t exist, instead of distance we have a point. Euclid’s definition to a point is: “A point is that which has no part.” In Euclid words the “distance” of zero from itself, |0 – 0| = 0 has no part. Something like this isn’t even or uneven.

In an e-book called “The Way To Geometry” it says, that magnitude of a point is zero.

Philosophically speaking a point is what Democritus called “atomos” applied to geometry.

In short, there isn’t distance of zero from itself. The meaning of distance |0 – 0| = 0 is geometrically a point, something that has no part.

My view on zero so far

The main point is, that I see zero as a neutral number. What does that mean?

  • Zero isn’t even or uneven
  • Zero isn’t negative or positive
  • Zero doesn’t have numerical opposite

The meaning of the video clip: “..achievements: Zero.”
Probably zero is my greatest achievement too… 🙂

Semantically zero is none, not nothing.

In multiplication zero overrides the neutral element property of one: 1 * a, but if = 0, zero “zeroes” one. The number one doesn’t keep the identity of zero, but zero “zeroes” number 1’s neutral element property and keeps the identity of its own.

Let us examine the even and uneven property of zero from point of view of distances.

etisyyskuva

The distance of number 2 from zero is |0 – 2|= 2. 2 mod 2 = 0; 2 is even.

The distance of number 3 from zero is |0 – 3|= 3. 3 mod 2 = 1; 3 is uneven.

The distance of number 4 from zero is |0 – 4|= 4. 4 mod 2 = 0; 4 is even.

But what about our friend zero?

The distance of number zero from itself is |0 – 0| = 0. 0 mod 2 = 0, but now the meaning of zero is, that the distance doesn’t exist. There isn’t distance from zero to zero. The distance that doesn’t exist isn’t even or uneven. Therefore now zero can’t be considered even or uneven.

 

 

 

Fractal of my own

I came up last sleepless night with a fractal of my own. There are two versions of it. The first version has the following rules:

  • Build a circle with radius of r
  • Draw inside the previous circle a circle of radius of / 2
  • Draw circles below, above and sides of the previous circle, the radius of these smaller circles being / 4

Choose for a new circle the circle that’s radius is r / 2. Repeat the previous steps ad infinitum.

Unfortunately on WordPress.com I can’t add the JavaScript-code where you could change the amount of iterations, so let’s just settle for pictures.

fraktaali 1

 

This kind of fractal might be invented already, but I haven’t seen one ever before.

Version 2 of this fractal:

fraktaali 2

The previous has a bit more complicated rules.

I made two color version of the previous too:

oma fraktaali jatko värill1

The second one:

oma fraktaali jatko värill2

Last night I was a bit playing with these fractal images in JavaScript, below is one more picture:

jatkokehitys fraktaali kikkailu

Perhaps this fractal of mine has at least some value of curiosity.

I try to find the time sometime in September to come back to this topic.

Deducing the solution formula to equation of second degree

The general form of a equation of second degree is

axbx + = 0

In this post we’ll deduce the general solution formula to that.

The constant just shifts the curve vertically in the xy-plane.

Let’s start by determining the slope of the general case, which is given by the derivative of the general case: 2ax + b.

The zero point of the derivative gives the symmetry point of the general case. Let’s examine parabola x – 2and its derivative 2x – 2:

parabeli ja derivaatta 2

The zero point of the derivative is at x = 1. We notice that the symmetry point of the parabola lies at this x-position, the roots of the parabola are at x = 0 and x = 2.

In general the symmetry point of equation of second degree lies at the zero point of its derivative.

Now we are ready to deduce the general solution formula.

Let us solve the zero point of the derivative: = –b / 2a.

Next we put this in the general equation, and we get:

ax– b/ 2a+ c = 0

By solving the x, we get

osakaavaa

The formula isn’t ready yet, but we know how the derivative is related to this and how it behaves.

The zero point of the derivative behaves symmetrically to the previous, so all we have to do is subtract the solved from the symmetry point and add the solved to the symmetry point. We get:

kokokaava.jpg

That’s it! We have general solution formula of the equation of the second degree.

* * *

I hope I haven’t chosen any funny words in this article. I don’t have my Finnish-Swedish-English math dictionary with me right now… 🙂

Amiga nostalgia: C language source code to Quest of Love

Quest of Love is an Amiga project that I never finished, but always wanted to create…

The project started as an assembly language project, but it was too much work, so I switched to C language. The video below shows, what I managed to do:

For curiosity and historical — on the other hand educational — reasons, I’ve decided to publish the C language source I have for this project. The assembly version is published in this old blog post..

The comments and names of some variables are in Finnish..

#include <math.h>
#include <exec/types.h>
#include <exec/memory.h>
#include <graphics/gfx.h>
#include <graphics/displayinfo.h>
#include <graphics/modeid.h>
#include <intuition/intuition.h>
#include <dos/stdio.h>
#include <dos/dos.h>
#include <proto/exec.h>
#include <clib/dos_protos.h>
#include <clib/graphics_protos.h>
#include <clib/intuition_protos.h>
#include <libraries/iff.h>

#define INTUI_V38_NAMES_ONLY

#define LIBVER 39

#define TURN 83

struct IntuitionBase *IntuitionBase=NULL;
struct GfxBase *GfxBase=NULL;
struct Library *IFFBase=NULL;

struct Screen *screen=NULL;
struct Window *window=NULL;

struct ViewPort *viewport;
struct RastPort *rastport;

ULONG   errorcode;

unsigned char *BM_block=NULL, *BM0, *BM1;
unsigned char *source0, *source1, *source2, *source3, *source4;
unsigned char *dest0, *dest1, *dest2, *dest3, *dest4;

struct BitMap blockbitmap = {2, 1088, 0, 5, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
struct BitMap myBitMap0 = {40, 256, 0, 5, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
struct BitMap myBitMap1 = {40, 256, 0, 5, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
struct BitMap *DrawBitMap=NULL,*ShowBitMap=NULL;

struct Monster {
    int x,y;
    WORD block;
    WORD vital;
    WORD exp;
    char frame;
    char delay;
    char elossa;
};

struct Monster Monsters[21];
struct Monster MonType[1];

int Blocked(int x, int y, short suunta);
void    DoubleBuffering(short *);
void    DrawMap(UWORD *Map);
void    DrawBlock(int,int,int);
void    Cycle(void);
void  HandleMonsters(void);
void  InitMonsters(void);
void    SetDelay(WORD,WORD);
void  DeAllocateResources();
char  ReadMapFile(char [], UWORD *buffer, int lkm);

int cind, block, k, j;
UWORD colortable[32];
UWORD copytable[4];
UWORD *buffer=NULL;
LONG  count;

UWORD *Map = NULL;
UWORD *WorldMap = NULL;
int   map_width, map_heigth;

WORD MapX=0, MapY=0,isoX=0,isoY=0;
char delay=-1;
char turn=TURN;



int main(void) {

    short   keepgoing=TRUE;
    struct  IntuiMessage *msg;
    ULONG       class;
    UWORD       code,qualifier;
    IFFL_HANDLE iff=NULL;
    short       *Which;

    if((GfxBase=(struct GfxBase *)
    OpenLibrary("graphics.library",LIBVER))==NULL)
    {
      printf("graphics open failed (V39 kickstart required)\n");
      DeAllocateResources();
      exit(1);
    }

    if((IntuitionBase=(struct IntuitionBase *)
    OpenLibrary("intuition.library",LIBVER))==NULL)
    {
      printf("intuition open failed (V39 mkickstart required)\n");
      DeAllocateResources();
      exit(1);
    }

    IFFBase=(struct Library*)OpenLibrary(IFFNAME, IFFVERSION);
    if (IFFBase == NULL) {
      printf("Can not open iff.library\n");
      DeAllocateResources();
      exit(1);
    }
    
    BM_block = (unsigned char *)AllocMem(11520, MEMF_CHIP);
    if (!BM_block) {
      printf("Memory allocation failed\n");
      DeAllocateResources();
      exit(1);
    }
    
    BM0 = (unsigned char *)AllocMem(51200,MEMF_CHIP|MEMF_CLEAR);
    if (!BM0) {
      printf("Memory allocation failed\n");
      DeAllocateResources();
      exit(1);
    }
     
    BM1 = (unsigned char *)AllocMem(51200,MEMF_CHIP|MEMF_CLEAR);
    if (!BM1) {
      printf("Memory allocation failed\n");
      DeAllocateResources();
      exit(1);
     }

    buffer=(UWORD *)AllocMem(40, MEMF_CHIP);
    if (!buffer) {
      printf("Memory allocation failed\n");
      DeAllocateResources();
      exit(1);
    }
       
    InitMonsters();

    blockbitmap.Planes[0]=&BM_block[0];
    blockbitmap.Planes[1]=&BM_block[2176];
    blockbitmap.Planes[2]=&BM_block[4352];
    blockbitmap.Planes[3]=&BM_block[6528];
    blockbitmap.Planes[4]=&BM_block[8704];

    myBitMap0.Planes[0]=&BM0[0];
    myBitMap0.Planes[1]=&BM0[10240];
    myBitMap0.Planes[2]=&BM0[20480];
    myBitMap0.Planes[3]=&BM0[30720];
    myBitMap0.Planes[4]=&BM0[40960];

    myBitMap1.Planes[0]=&BM1[0];
    myBitMap1.Planes[1]=&BM1[10240];
    myBitMap1.Planes[2]=&BM1[20480];
    myBitMap1.Planes[3]=&BM1[30720];
    myBitMap1.Planes[4]=&BM1[40960];

    *Which=1;

    if((screen=OpenScreenTags(NULL,
        SA_Width, 320,
        SA_Height, 256,
        SA_Depth, 5,
        SA_Overscan, FALSE,
        SA_AutoScroll, TRUE,
        SA_Type, CUSTOMSCREEN|CUSTOMBITMAP,
        SA_DisplayID,PAL_MONITOR_ID,
        SA_PubName, "My Screen",
        SA_BitMap, &myBitMap0,
        TAG_END, NULL)
    )==NULL)
    {
        printf("Screen open failed\n");
      DeAllocateResources();
      exit(1);
    }

    if((window=OpenWindowTags(NULL,
        WA_Left, 0,
        WA_Top, 0,
        WA_Width, screen->Width,
        WA_Height, screen->Height,
        WA_IDCMP,IDCMP_VANILLAKEY,
        WA_Flags,WFLG_ACTIVATE|WFLG_RMBTRAP|WFLG_BORDERLESS,
        WA_ReportMouse, TRUE,
        WA_MinWidth,    50,
        WA_MinHeight,   20,
        WA_MaxWidth,    ~0,
        WA_MaxHeight,   ~0,
        WA_PubScreen,   screen,
        TAG_END, NULL)
    )==NULL)
    {
        printf("Window open failed\n");
        DeAllocateResources();
        exit(1);
    }

    viewport=&screen->ViewPort;
    rastport=window->RPort;

/* Bittikartoille on aiemmin varattu tila, mikä pitää laskea uudestaan, jos koko muuttuu */

    iff = IFFL_OpenIFF("Work:MyProjects/QoL/New/gfx/blocks16x1152.iff",IFFL_MODE_READ);
    if (!iff) {
      printf("IFF file open failed\n");
      DeAllocateResources();
      exit(1);
    }
  
    if (!(IFFL_DecodePic(iff, &blockbitmap))) {
      printf("IFF file decoding failed\n");
      DeAllocateResources();
      exit(1);
    }
 
    count = IFFL_GetColorTab(iff, colortable);
    LoadRGB4(&(screen->ViewPort), colortable, count);
    IFFL_CloseIFF(iff);

    iff = IFFL_OpenIFF("Work:MyProjects/QoL/IFFs/NewFrame.iff",IFFL_MODE_READ);
    if (!iff) {
      printf("IFF file open failed\n");
      DeAllocateResources();
      exit(1);
    }
    
    if (!(IFFL_DecodePic(iff,&myBitMap0))) {
      printf("IFF file decoding failed\n");
      DeAllocateResources();
      exit(1);
    }
       
    IFFL_CloseIFF(iff);

    for (int i=0; i<4; i++) copytable[i]=colortable[16+i];     BltBitMap(&myBitMap0,0,0,&myBitMap1,0,0,320,256,0xc0,0x1f,&buffer);     source0 = blockbitmap.Planes[0];     source1 = blockbitmap.Planes[1];     source2 = blockbitmap.Planes[2];     source3 = blockbitmap.Planes[3];     source4 = blockbitmap.Planes[4];     dest0 = screen->BitMap.Planes[0]+1001;
    dest1 = screen->BitMap.Planes[1]+1001;
    dest2 = screen->BitMap.Planes[2]+1001;
    dest3 = screen->BitMap.Planes[3]+1001;
    dest4 = screen->BitMap.Planes[4]+1001;

   WorldMap=(UWORD *)AllocMem(9920,MEMF_PUBLIC);
   if (WorldMap == NULL) {
      printf("Could not allocate memory for WorldMap\n");
      DeAllocateResources();
      exit(1);
   }
   
   if ((ReadMapFile("Work:Myprojects/QoL/Gamefield/Map11.gamefield",WorldMap,9920)) == 1) {
      DeAllocateResources();
      exit(1);
   }
    
   Map = WorldMap;
   map_width = 80;
   map_heigth = 62;

/* -------------------------------------------------------------------------- */
                                      
    while(keepgoing)
    {
        WaitTOF();
        DoubleBuffering(&Which);
        DrawMap(Map);
        HandlePlayer();
        HandleMonsters();
        GeneralRoutines();
        Cycle();
/*      printf("Delay %d ; Turn %d\n",delay,turn); */

/*      printf("Blocked %d\n",Blocked(MapX, MapY, 8)); */

        while(msg=(struct IntuiMessage *)GetMsg(window->UserPort))
       {
        class=msg->Class;
            code=msg->Code;
            qualifier=msg->Qualifier;
            ReplyMsg((struct Message *)msg);
/*          printf("%d\n",code); */

            switch(class) {
                case IDCMP_VANILLAKEY :
                     switch (code) {
                        case 27 : /* ESC */
                                    keepgoing=FALSE;
                                    DeAllocateResources();
                                    break;

/***
* Pelaajan ohjaus pääkartalla. Aluksi katsotaan, onko kulkusuunta blokattu;
* jos ei ole ja delay == -1 (eli maastotyypin viive on suoritettu), niin
* liikutaan
* painettuun kulkusuuntaan ja asetetaan uusi delay. Lisäksi tulostetaan
* joko kulkusuunta tai "Slow progress", jos viiveen takia kulkusuuntaan
* ei voinut mennä. Jos tulostettiin "Slow progress", niin delay-arvoa
* vähennetään yhdellä.

***/
                        case '2' : if (!Blocked(MapX, MapY, 2) && delay<0) {                                             MapY++;                                             isoY++;                                             if (MapY> map_heigth - 1) MapY=0;
                                            SetDelay(MapX,MapY);
                                            Print("South.",6);
                                     } else if (delay>-1) {
                                          Print("Slow progress.",14);
                                          delay--;
                                       }
                                    turn=TURN;
                                    break;

                        case '8' : if (!Blocked(MapX, MapY, 8) && delay<0) {
                                            MapY--;
                                            isoY--;
                                            if (MapY<0) MapY= map_heigth - 1;                                             SetDelay(MapX,MapY);                                             Print("North.",6);                                      } else if (delay>-1) {
                                          Print("Slow progress.",14);
                                          delay--;
                                       }
                                    turn=TURN;
                                    break;

                        case '6' : if (!Blocked(MapX, MapY, 6) && delay<0) {                                             MapX++;                                             isoX++;                                             if (MapX> map_width - 1) MapX=0;
                                            SetDelay(MapX,MapY);
                                            Print("East.",5);
                                        } else if (delay>-1) {
                                             Print("Slow progress.",14);
                                             delay--;
                                          }
                                    turn=TURN;
                                    break;

                        case '4' : if (!Blocked(MapX, MapY, 4) && delay<0) {
                                            MapX--;
                                            isoX--;
                                            if (MapX<0) MapX= map_width - 1;                                             SetDelay(MapX,MapY);                                             Print("West.",5);                                         } else if (delay>-1) {
                                             Print("Slow progress.",14);
                                             delay--;
                                    }
                                    turn=TURN;
                                    break;

                        case ' ' :  turn=TURN;
                                    Print("Pass.",5);
                                    break;
                }
          }

       }
    }
} /* END main */
 
void DeAllocateResources() {
    if (buffer) FreeMem(buffer,40);
/*  if (iff) IFFL_CloseIFF(iff); */
/*  if (BM0) FreeMem(BM0,51200);
    if (BM1) FreeMem(BM1,51200); */
    if (BM_block) FreeMem(BM_block,11520);
    if (window) CloseWindow(window);
    if (screen) CloseScreen(screen);
    if (BM0) FreeMem(BM0,51200);
    if (BM1) FreeMem(BM1,51200);
    if (GfxBase) CloseLibrary((struct Library *)GfxBase);
    if (IntuitionBase) CloseLibrary((struct Library *)IntuitionBase);
    if (IFFBase) CloseLibrary(IFFBase);
   if (WorldMap) FreeMem(WorldMap,9920);
}

void HandlePlayer(void) {
    DrawBlock(5,6,10);
}


void SetDelay(WORD x,WORD y) {
    x+=5; y+=6;
    if (x > map_width - 1) x=x - map_width;
    if (y > map_heigth - 1) y=y - map_heigth;
/*  printf("%d;%d; %d\n",x,y,Map[x+y*80]); */

    switch(Map[x+y*map_width]) {
      case 5 : delay=(char)Random(0,4); break;
      case 16: delay=(char)Random(0,2); break;
      default: delay=-1;
    }
/*  printf("%d\n",delay); */
}

void DoubleBuffering(short *Which) {
    switch(*Which) {
        case 0 : viewport->RasInfo->BitMap=&myBitMap0; *Which=1;
                    rastport->BitMap=&myBitMap1;
                    dest0 = myBitMap1.Planes[0]+1001;
                    dest1 = myBitMap1.Planes[1]+1001;
                    dest2 = myBitMap1.Planes[2]+1001;
                    dest3 = myBitMap1.Planes[3]+1001;
                    dest4 = myBitMap1.Planes[4]+1001;
                    DrawBitMap=&myBitMap1;
                    ShowBitMap=&myBitMap0;
                    break;
        case 1 : viewport->RasInfo->BitMap=&myBitMap1; *Which=0;
                    rastport->BitMap=&myBitMap0;
                    dest0 = myBitMap0.Planes[0]+1001;
                    dest1 = myBitMap0.Planes[1]+1001;
                    dest2 = myBitMap0.Planes[2]+1001;
                    dest3 = myBitMap0.Planes[3]+1001;
                    dest4 = myBitMap0.Planes[4]+1001;
                    DrawBitMap=&myBitMap0;
                    ShowBitMap=&myBitMap1;
                    break;
    }
    ScrollVPort(viewport);
}


/***
* Blocked-rutiini: Parametreina saadaan näkymän vasen yläkulma, mihin lisätään
* arvot, joilla saadan pelaajan sijainti eli näkymän keskikohta. Jos suunnassa,
* johon ollaan menossa on blocki, jonka päälle ei voi mennä palautetaan 1,
* mikä on merkkinä siitä, että hahmoa ei liikuteta, muutoin 0.
***/
int Blocked (int x, int y, short suunta) {
    int arvo;

    x+=5; y+=6;

    if (x > map_width - 1) x=x-map_width;
    if (y> map_heigth - 1) y=y- map_heigth;

/*  printf("Block: %d\n", Map[x+y*map_width]); */

    switch (suunta) {
        case 2 : y+=1; break;
        case 8 : y-=1; break;
        case 6 : x+=1; break;
        case 4 : x-=1; break;
    }

/*  printf("Block: %d\n", Map[x+y*map_width]); */

    switch (Map[x+y*map_width]) {
        case 3 :        arvo = 1; break;
        case 8 :        arvo = 1; break;
        case 12 :   arvo = 1; break;
        case 14 :   arvo = 1; break;
        default :   arvo = 0;
    }
    return arvo;
}


void DrawMap (UWORD *Map) {

/*  printf("DrawMap"); */

    int x,y,xg=0,yg=0,xx,yy;

    for (y=MapY,yg=0;y<MapY+14;y++,yg++) {
        for (x=MapX,xg=0;x<MapX+11;x++,xg++) { /*          printf("xx: %d", xx); */             if (x > map_width - 1) xx=x-map_width; else xx=x;
            if (y> map_heigth - 1) yy=y-map_heigth; else yy=y;

            if (x > map_width - 1 || y>map_heigth - 1) block = Map[xx+yy*map_width];
            else block = Map[x+y*map_width];

            block = block << 5;

            j=yg*640;
            for (int i=block; i<32+block; i++) {
                k=xg*2;
                dest0[k+j]=source0[i];
                i++; k++;
                dest0[k+j]=source0[i];
                j+=40;
            }

            j=yg*640;
            for (int i=block; i<32+block; i++) {
                k=xg*2;
                dest1[k+j]=source1[i];
                i++; k++;
                dest1[k+j]=source1[i];
                j+=40;
            }
    
            j=yg*640;
            for (int i=block; i<32+block; i++) {
                k=xg*2;
                dest2[k+j]=source2[i];
                i++; k++;
                dest2[k+j]=source2[i];
                j+=40;
            }

            j=yg*640;
            for (int i=block; i<32+block; i++) {
                k=xg*2;
                dest3[k+j]=source3[i];
                i++; k++;
                dest3[k+j]=source3[i];
                j+=40;
            }

            j=yg*640;
            for (int i=block; i<32+block; i++) {
                k=xg*2;
                dest4[k+j]=source4[i];
                i++; k++;
                dest4[k+j]=source4[i];
                j+=40;

            }

        }
    }
}


/* Koordinaatit blockeina */

void DrawBlock (int x, int y, int block) {

    block = block << 5;             /* kerrotaan 32:lla */

    j=y*640;                                /* kerrottaan 40 x 16:a */
    for (int i=block; i<32+block; i++) {
        k=x*2;
        dest0[k+j]=source0[i];
        i++; k++;
        dest0[k+j]=source0[i];
        j+=40;
    }

    j=y*640;
    for (int i=block; i<32+block; i++) {
        k=x*2;
        dest1[k+j]=source1[i];
        i++; k++;
        dest1[k+j]=source1[i];
        j+=40;
    }
    
    j=y*640;
    for (int i=block; i<32+block; i++) {
        k=x*2;
        dest2[k+j]=source2[i];
        i++; k++;
        dest2[k+j]=source2[i];
        j+=40;
    }

    j=y*640;
    for (int i=block; i<32+block; i++) {
        k=x*2;
        dest3[k+j]=source3[i];
        i++; k++;
        dest3[k+j]=source3[i];
        j+=40;
    }

    j=y*640;
    for (int i=block; i<32+block; i++) {
        k=x*2;
        dest4[k+j]=source4[i];
        i++; k++;
        dest4[k+j]=source4[i];
        j+=40;
    }

}

void Cycle (void) {
    int Rs = cind;

    for (int i=0; i<4; i++, Rs++) {         if (Rs > 3) Rs=0;
        colortable[i+16]=copytable[Rs];
    }
    cind++;
    if (cind > 3) cind = 0;

    LoadRGB4(&(screen->ViewPort), colortable, count);
}

void Print(char teksti[], int pituus) {
    ScrollRaster(rastport,0,8,195,119,300,245);
    Move(rastport,195,243);
    Text(rastport,teksti,pituus);
    BltBitMap(DrawBitMap,195,119,ShowBitMap,195,119,105,127,0xc0,0x1f,NULL);
}

char BlockedMonster(WORD x, WORD y, WORD count) {
    char i;

    for (i=0; i<21; i++) {
        if (Monsters[i].x==x && count!=i && Monsters[i].elossa==1)
            if (Monsters[i].y==y) return 1;
    }

    switch (Map[x+y*map_width]) {
        case 3 : return 1;
        case 8 : return 1;
        case 12 : return 1;
        case 14 : return 1;
        default : return 0;
    }

}

void HandleMonsters(void) {
    int i,apuX,apuY,RS;

    if (turn==TURN) {
        for(i=0; i<21; i++) {             if (Monsters[i].elossa) { /* 75% TN:llä lähdetään liikkeelle */                 RS=Random(0,4);                 if (RS>=1) {
                    apuX=Monsters[i].x;
                    apuY=Monsters[i].y;
                    RS=Random(0,2);
                    if (RS==0) {
                        if (isoX+5>apuX) apuX++; 
                        else apuX--; 
                        if (!BlockedMonster(apuX, apuY, i)) Monsters[i].x=apuX;
                    } else if (isoY+6>apuY) apuY++;
                         else apuY--; 
                    if (!BlockedMonster(apuX,apuY, i)) Monsters[i].y=apuY;
                }

            }
        }
    }

/* Laskeskellaan, piirretäänkö monsteria näkyviin */

    for(i=0; i<21; i++) {
        apuX=Monsters[i].x-isoX;
        apuY=Monsters[i].y-isoY;
        Monsters[i].frame=Monsters[i].block+Random(0,4);
        if (apuX<=10 && apuX>=0)
            if (apuY<=13 && apuY>=0) {
/*              printf("%d;%d\n",apuX,apuY); */
                DrawBlock(apuX,apuY,Monsters[i].frame);
            }
    }
}

void InitMonsters (void) {
    short type;

    MonType[0].block=64;
    MonType[0].vital=10;
    MonType[0].exp=10;
    MonType[0].delay=0;
    MonType[0].frame=64;

    for (int i=0; i<21; i++) {
        Monsters[i].x=Random(0,map_width);
        Monsters[i].y=Random(0,map_heigth);
        switch (Map[Monsters[i].x+Monsters[i].y*map_width]) {
            case 3,8,12,14 : Monsters[i].elossa=0; break;
            default : Monsters[i].elossa=1;
        }
            
        Monsters[i].block=64;
        type=Monsters[i].block;
        Monsters[i].vital=MonType[type-64].vital;
        Monsters[i].exp=MonType[type-64].exp;
        Monsters[i].delay=0;
        Monsters[i].frame=0;
    }

}


void GeneralRoutines() {
    turn--;
    if (turn<=0) { 
        delay--;
/*        printf("%d\n",delay); */
        if (delay<-1) delay=-1;
        turn=TURN;
        Print("Pass.",5);
    }

}

char ReadMapFile(char nimi[], UWORD *buffer, int koko) {
   BPTR file;
   LONG length;

/*   printf("%s\n",nimi); */

   file=Open(nimi,MODE_OLDFILE);
   length=Read(file,buffer,koko);

   if (length != koko) {
      printf("Error in reading mapfile\n");
      Close(file);
      return 1;
   }
   return 0;
}

int Random (int alaraja, int ylaraja) {
    int Luku;
    Luku=rand();
    Luku=alaraja+Luku%(ylaraja-alaraja);
    return Luku;
}

Is the Empty Set a set Part II

Let us assume again, that a person has a collection of 100 books. The books are in a shelf in way that between some books there is an empty space. Probably we can say, that the empty space is part of the collection at least visually considering the whole, although that empty space is something different than a book.

bookcase-books-bookshelves-256541

In general an empty space can be filled with a book, so that the book is surrounded by an empty space. If no empty space existed, a book couldn’t be taken away from the collection of the books (or in this example put a book to the shelf).

Therefore empty space is part of every collection of books..