Evolution 10 by Marco Spedaletti

Add to
My games
Add to
Wishlist
Save to
Collection
No reviews
Exceptional
Meh
Skip

About

INSTRUCTIONS HOW TO LOAD THE GAME

In order to play "Evolution 10" you need a COMMODORE 64 or an emulator of this computer, because the game does not work on modern computers. The game has been tried and it works correctly with "VICE - the Versatile Commodore Emulator" ver. 3.5. You can download it for free by clicking here.

Once the emulator software has been installed, follow the instructions below:

  • start x64sc.exe program;
  • click on File > Attach disk image > Drive 8;
  • select evolution10.d64 file (click here to download);
  • click on Attach;
  • type LOAD "EVOLUTION10",8,1;
  • when finished loading, type RUN
HOW TO PLAY

The game is turn-based. At the beginning of each round it is shown which individual (phenotype) is to be obtained from the genetic combination, and the available individuals are shown:

The player must indicate the pair of individuals that they want to "mix" to obtain two more. The player must choose two (different) numbers in the 1..4 interval. The player's choice should be such as to reward those individuals who individually, or combined, most closely resemble the target individual. The program therefore performs both genetic blending and phenotypic regeneration. For a more extensive explanation we recommend to read this article.

The game repeats itself from generation to generation, until the player gets the wanted individual.

The greater the number of generations, the worse the result the player has achieved.

SOURCE CODE (EXPLAINED)

Below you will find the source code of the video game. The source code has been written extensively (without abbreviations), in order to make it easier to understand. Each line has been commented to illustrate how the code works.

INITIALIZATION (LINE 1)

0 x=53280:pokex,0:pokex+1,0

Now we set the background and border color of the screen (here for a complete map). The best is to use the black color (0) for both. This is "classic" color of my games.

x=rnd(-TI*peek(x-14))

We carry out a first and deep initialization of the random number generator. This form of initialization is necessary because the game relies heavily on a random component and, in the absence of this formulation, the game is likely to be repetitive with the use of emulators. So, in addition to using the internal clock (TI) we will also use the least significant byte of the electron beam position.

print"{clear}{down}{down}{down}{down}{red}e{green}v{yellow}o{blue}l{red}u{green}t{yellow}i{blue}o{red}n {white}10";

We print the game title.

e=5

We use this variable to maintain the number of individuals present for each generation. Individuals are made up of the four presented to the player, and which vary, plus a fifth representing the goal to be achieved.

g=5

Instead, this variable contains the number of genes that make up the genome of each individual. Each gene encodes a different aspect, and it takes 5 to draw an individual.

n$="1234t"

This variable contains the title (label) of each individual. We use this technique instead of printing a number as in BASIC V2 it is not possible to print a number without having it followed by a space, which is not aesthetically acceptable.

h$="{red}{green}{yellow}{blue}"

This is the set of colors encoded by gene 1.

t$="{171}{166}{113}#"

This is the set of tails encoded by gene 5.

b$="{99}{219}{178}{177}"

This is the set of intermediate elements of the body, including those encoded by genes 3 and 4.

1 print

We print an empty line (empty lines are interleaved with the logic for a matter of occupation and respect for the length of the BASIC lines).

rk=1

We initialize the number of the gene that will undergo a random mutation. This gene is reset at each turn.

dimc(e,g)

This array contains the genes of all existing individuals.

dimd(e,g)

This is an auxiliary array, which contains a copy of the genes that will take the place of those contained in the previous array when the transition to a new generation is complete.

for i=1 to e:for j=1 to g:c(i,j)=1+int(rnd(1)*3):nextj:nexti

This routine initializes the gene of all individuals to a random value.

print"{white}choose phenotypes!"

We print the game's pay off.

print:print:

We print empty lines (empty lines are interleaved with the logic for a matter of occupation and respect for the length of the BASIC lines).

i=e:gosub9:ff$=f$

In order to pre-calculate the target phenotype (the fifth), we render its genotype as a string by calling the function on line 9 and put the result into the ff$ variable.

x=1

This variable contains the number of the generation reached.

GAME LOOP (LINE 2-7) PHENOTYPES PRESENT (LINE 2)

2 print "{white}target: ";ff$;

We give the player an indication of which phenotype we want to achieve.

print:print

We print empty lines (empty lines are interleaved with the logic for a matter of occupation and respect for the length of the BASIC lines).

print "{white}generation ";x;":"

We give the player indications of which generation we are showing.

for i=1 to e-1: gosub9 : print"{white}";mid$(n$,i,1);"]";f$;" ";:nexti:

We do a loop for each individual (minus the last one, which is the goal). For each one we call the function to render the genotype and print it on the screen, with an identification number.

print

We print empty line (empty lines are interleaved with the logic for a matter of occupation and respect for the length of the BASIC lines).

print"{white}choose (1-4 1-4):";

Now let's give the player the option to indicate the two individuals that will be combined, to produce the next generation.

ASK FOR INDIVIDUALS TO MIX (LINE 3)

3 r=rnd(1): rm=rnd(1)

We pre-calculate two random values, which will be used later.

gosub 8: x$=k$

We call the subroutine that waits for the pressing of a key from 1 to 4 (on line 8) and we retrieve the key pressed, assigning it to the variable x$.

print "{white} + ";

We print the plus symbol to indicate that the first indicated individual will be added to the second that will be typed.

gosub 8: y$=k$

We call the subroutine that waits for the pressing of a key from 1 to 4 (on line 8) and we retrieve the key pressed, assigning it to the variable y$.

print:print:

We print empty lines (empty lines are interleaved with the logic for a matter of occupation and respect for the length of the BASIC lines).

on -(x{{ APP_CONTENT }}lt;>y$) goto 4: print"{red}you have to choose different phenotypes!{white}": goto 3

If the player has indicated two equal numbers, then it is a mistake because it is not possible to combine an individual with himself. So we report it with an error message and go back to waiting for a key to be pressed.

FEEDBACK ON INDIVIDUALS MIXED (LINE 4)

4 print

We print empty line (empty lines are interleaved with the logic for a matter of occupation and respect for the length of the BASIC lines).

i=val(x$): gosub 9: print "{white}";mid$(n$,i,1);"]";f$;

Now we call the function to render the genotype and print it on the screen, as the first individual to mix.

print"{white} + ";

We print the plus symbol to indicate that the first individual will be added to the second.

i=val(y$):gosub9:print"{white}";mid$(n$,i,1);"]";f$

Now we call the function to render the genotype and print it on the screen, as the second individual to mix.

print

We print empty line (empty lines are interleaved with the logic for a matter of occupation and respect for the length of the BASIC lines).

PRODUCE NEXT GENERATION (LINES 4-6)

for i=1 to g:d(1,i)=c(val(x$),i)

5 d(2,i)=c(val(y$),i) : next i

With this loop we copy the genotype of the two selected individuals as the first two (progenitors) of the others that will be generated.

for i=3 to e-1: for j=1 to g: d(i,j)=d(1-(rnd(1)>.5),j) : next j : next i

All children will randomly take one of the genes from the first or second parent.

on -(r>.8) goto 6: d(3-(rm>.5),rk) = 1 + int(rnd(1)*3)

Sometimes, quite by chance, one of the genes of one of the children will undergo a mutation, which will cause it to be different from both the first and the second parent.

6 rk=int(rnd(1)*4)

We reload the number of the gene that will eventually undergo the random modification.

for i=1 to e-1: for j=1 to g: c(i,j)=d(i,j) : next j : gosub 9 : on-(f$=ff$) goto 7: next i

We copy the genes stored in the supporting array into the main one, in order to give rise to the new generation of individuals. In doing this, we will generate the phenotype for each and compare it with the target one. If there is an identity, the game will end and the player will be taken to line 7.

x = x + 1 : goto 2

Let's move on to the next generation, and go back to line 2.

THE PLAYER WINS! (LINE 7)

7 print "{white}you win in ";x;"generations with: ";: gosub 9 : print f$;"{white}" : end

In the event that the player has managed, after a certain number of generations, to obtain the requested specimen, a message will be shown on the screen showing the result and the number of generations produced.

SUBROUTINES (LINES 8-9) KEYBOARD INPUT ROUTINE (LINE 8)

8 k$="" : get k$ : on -(k$="" or val(k$)<1 or val(k$)>4 ) goto 8: print "{white}";k$; : return

This routine takes care of keeping the player pressing one of the keys. The expected keys range from 1 to 4 inclusive and indicate which of the individuals will be selected for the next generation.

GENOTYPE TO PHENOTYPE CONVERSION (LINE 9)

9 f$=mid$(h$,c(i,1),1) : for j=1 to c(i,2): f$=f$+mid$(b$,c(i,3),1) : next j : f$=f$+mid$(b$,c(i,4),1)+mid$(t$,c(i,5),1) : return

This routine deals with converting each individual's genotype into a phenotype. This conversion is not straightforward because the genotype contains only a "recipe" of how the individual should look, ie how it should be rendered on screen. This routine is responsible for converting the genotype (a set of numbers) into a phenotype (a string). For a details information please refer to the EVOLUTION 10'S GENOTYPE AND PHENOTYPE article on author's retroprogramming website.

 

Platforms
Release date
Developer
BASIC 10Liner
Age rating
Not rated

System requirements for PC

Read more...
Evolution 10 by Marco Spedaletti screenshot, image №2752343 - RAWG
Edit the game info
Last Modified: Mar 12, 2021

Where to buy

itch.io