原件存檔 Original files吳哲宇 Che-Yu Wu

高三上(2012 年 9 月到 10 月)Grade 12, first term (September to October 2012)

Evolution 2012:用 ATCG 基因跑的生態模擬Evolution 2012: an ecosystem simulation run on ATCG genes

說明視窗的第一行是「歡迎使用Evolution 2012 1.0.0.1版」,第二行是「本程式由Majer 與 Star共同製作」。Star 是他的高中同學。開場畫面也寫著同一句英文:Made by Majer & Star。

The first line of the help window reads "歡迎使用Evolution 2012 1.0.0.1版" (welcome to Evolution 2012 version 1.0.0.1) and the second "本程式由Majer 與 Star共同製作" (this program was made by Majer and Star). Star is a high school classmate. The splash screen carries the same sentence in English: Made by Majer & Star.

白底上散落彩色圓點,中間紅字 Evolution 2012,下面綠字 Made by Majer & Star 和 Loading
開場畫面,取自專案的 SplashScreen 資源The splash screen, taken from the project's SplashScreen resource

每個生物有一條 DNA,預設 4000 個字,用 A、T、G、C 四個字母。程式讀它的方式是「看某一段是什麼、某個片段出現幾次」:最前面的幾個字決定壽命,每個字母各乘一個係數(A 乘 1.5、T 乘 1.7、G 乘 1.9、C 乘 2.1)。紅、綠、藍各取 8 個字決定,每個字母乘 1、2、2.5、3,最多 255。

另有一批特定的片段當開關,名稱和序列寫在 Settings.txt:GCTATA 耐熱、ATGCAA 耐冷、TACTGGA 複製時間減半、CATGACA 生命加倍、AGTCGTA 獵食者(可以吃別人)、GTCGTAA 速度加倍、GATCAGA 溫度演化、GATAATAA 生產者、AGATAGCA 一次產生兩個子代、GGTTACTA 變異加倍、CTAGAGTA 毒、TGAGATCA 解毒。DNA 用 H 開頭再接 5 個字母,則是荷爾蒙,分 GAATT、TTAAG、GTATA、TAGGA、GGAAT 五種。

還有一個叫「外掛DNA」的片段,就是他的名字 MAJER。DNA 裡含有這五個字母的生物,速度、獵食、毒的範圍、耐熱耐冷、壽命全部加強,出現幾次就加強幾次。

Each creature has one DNA string, 4,000 letters by default, in the four letters A, T, G and C. The program reads it by looking at what a certain stretch is and how many times a certain fragment occurs: the first few letters set the lifespan, each letter multiplying by a factor (A by 1.5, T by 1.7, G by 1.9, C by 2.1). Red, green and blue each take 8 letters, each letter multiplying by 1, 2, 2.5 or 3, up to 255.

A set of particular fragments act as switches, with names and sequences written in Settings.txt: GCTATA heat tolerance, ATGCAA cold tolerance, TACTGGA half the copy time, CATGACA double life, AGTCGTA predator (can eat others), GTCGTAA double speed, GATCAGA temperature evolution, GATAATAA producer, AGATAGCA two offspring at a time, GGTTACTA double mutation, CTAGAGTA poison and TGAGATCA antidote. A DNA that starts with H followed by 5 letters is a hormone, of five kinds: GAATT, TTAAG, GTATA, TAGGA and GGAAT.

One more fragment is called "外掛DNA" (cheat DNA), and it is his name, MAJER. A creature whose DNA contains those five letters is strengthened in speed, hunting, poison range, heat and cold tolerance and lifespan, once for every time it occurs.

                If DNA.Contains(MajerDNA) Then
                    Dim MajerNum As Integer = Count(DNA, MajerDNA)
                    MAJER = True
                    TemChangeEvol = True
                    SpeedDouble = True
                    producev *= 2 + MajerNum
                    Xplus *= 1 + 0.7 * MajerNum
                    Yplus *= 1 + 0.7 * MajerNum
                    EatAble = True
                    Eattime = live / (10 + MajerNum)
                    VarPro = True
                    Varnum /= 2 + MajerNum
                    DoublePro = True
                    ProNum *= 2 * MajerNum
                    maxpoi *= 1.5 + MajerNum * 0.5
                    minipoi *= 1.5 + MajerNum * 0.5
                    PoisonRange *= 1.1 + MajerNum * 0.2
                    '----------
                    Hot *= 4 + MajerNum
                    Cold *= 4 + MajerNum
                    live *= 10 + MajerNum
                    CopyTime /= 10 + MajerNum
                    Consume /= 2 + MajerNum
                End If
clsEater.vb:DNA 裡含有 MAJER 時的各項加強,MajerNum 是出現次數。clsEater.vb: the boosts when the DNA contains MAJER; MajerNum is the number of occurrences.

環境有溫度、氧氣和二氧化碳。氧氣和二氧化碳一開始各 100,000,生產者(GATAATAA)吸二氧化碳放氧氣,所有生物呼吸時吸氧氣放二氧化碳,兩個動作只是把量在兩種氣體之間搬來搬去。存檔裡每個取樣點的兩者加總都剛好是 200,000。滑鼠可以開伽瑪射線,照到的生物每一次有 1/15 的機率被改掉 DNA 裡的一個字母,小機率還會多插一個或刪掉一個。

The environment has temperature, oxygen and carbon dioxide. Oxygen and carbon dioxide start at 100,000 each. Producers (GATAATAA) take in carbon dioxide and give out oxygen, every creature breathing takes in oxygen and gives out carbon dioxide, the two actions only move the amount from one gas to the other, and in the save files the two add up to exactly 200,000 at every sample. The mouse can switch on a gamma ray; a creature it touches has a 1 in 15 chance each time of having one letter of its DNA changed, and a small chance of an extra letter inserted or one deleted.

                    '光合作用與呼吸作用
                    If .Creater Then
                        If Co2 > 0 Then
                            Co2 -= .producev + SunE * 0.1
                            o2 += .producev / 10 + SunE * 0.1
                            .live += .Consume * 0.1
                        Else
                            .live -= .producev
                        End If
                        If o2 > 0 Then
                            o2 -= .Consume * dco2 / 5
                            Co2 += .Consume * dco2 / 5
                            .live += .Consume * 0.2
                        Else
                            .live -= .Consume / 5
                        End If
                    Else
                        If o2 > 0 Then
                            o2 -= .Consume * dco2 / 5
                            Co2 += .Consume * dco2 / 5
                            .live += .Consume * 0.2
                        Else
                            .live -= .Consume / 5
                        End If
Form1.vb:光合作用與呼吸作用。氧氣減多少,二氧化碳就加多少。Form1.vb: photosynthesis and respiration. Whatever oxygen loses, carbon dioxide gains.
                If (gamaray) Then
                    If touchtest(clsmouse, objeater) Then
                        objeater.VarPro = 10
                        If ran.Next(0, VarGamaRay) < 1 Then
                            Dim p1 As String
                            Dim p2 As String
                            Dim num As Integer = ran.Next(0, .DNA.Length)
                            p1 = .DNA.Substring(0, num)
                            p2 = .DNA.Substring(num + 1)
                            Dim ndna As String = p1
                            ndna += RandomATGC()
                            If ran.Next(0, VarGamaRay ^ 2) = 0 Then
                                ndna += RandomATGC()
                            End If
                            If ran.Next(0, VarGamaRay ^ 2) = 0 And p2.Length > 0 Then
                                p2 = p2.Substring(1, p2.Length - 1)
                            End If
                            ndna += p2
                            .DNA = ndna
                            .live += 3 - ran.Next(0, 10)
                            .CopyTime += 5 - ran.Next(0, 12)
Form1.vb:伽瑪射線改 DNA。Form1.vb: the gamma ray changing DNA.

程式每 5000 個單位時間存一個檔,檔案有四行:溫度、氧氣、二氧化碳、族群數量,每 2 個單位時間取一個數字。Save/10-7 資料夾有 495 個這樣的存檔,另外 3 個是 Save.txt 等雜檔。從檔名時間和數值接續的情況看,那一夜同時開了四個視窗在跑,另外三個較早停止,最長的一個從 10 月 7 日 22:52 跑到 10 月 8 日 18:34,共 1,875,000 個單位時間,族群在 3 到 72 隻之間。下圖左邊是這一個。

495 個存檔裡每一個取樣點的氧氣加二氧化碳都剛好是 200,000,溫度全程 20。下圖右邊是 10 月 9 日晚上另一次存檔(Save/10-9)的前 20,000 個單位時間:溫度從 20 一路升到 1200,族群從 50 隻掉到個位數,氧氣從約 100,000 掉到 0,溫度欄最後一段記成 0,族群後來回到 19 到 26 隻。

The program saves a file every 5,000 time units. A file has four lines, temperature, oxygen, carbon dioxide and population count, with one number every 2 time units. The Save/10-7 folder holds 495 such files, with 3 more odd files such as Save.txt. From the file-name times and how the numbers run on from one file to the next, four windows were running that night, the other three stopped earlier, and the longest ran from 22:52 on 7 October to 18:34 on 8 October, 1,875,000 time units, with the population between 3 and 72. The left half of the figure below is this one.

In all 495 files every sample has oxygen plus carbon dioxide equal to exactly 200,000, and the temperature stays at 20. The right half is the first 20,000 time units of another save on the evening of 9 October (Save/10-9): the temperature climbs from 20 to 1200, the population falls from 50 to single digits, the oxygen drops from about 100,000 to 0, the last stretch of the temperature column is recorded as 0, and the population later returns to between 19 and 26.

兩欄三列的折線圖:左欄一夜的族群數量在 3 到 72 之間起伏,氧氣忽高忽低,溫度是一條 20 的平線。右欄升溫的一次,溫度階梯式升到 1200 再掉到 0,族群掉到個位數後回升。
存檔畫出來的曲線。欄是兩次執行,列是族群、氧氣、溫度,三列的縱軸兩欄相同。Curves drawn from the save files. Columns are two runs, rows are population, oxygen and temperature, with the same vertical scale in both columns.

說明視窗還列了快捷鍵:Y、U 選兩個親代,J 產生交配後的子代,A、S 升溫與降溫 2 度,X 設定溫度,K 清除所有生物,Q 加入指定基因的生物,G 隨機產生,T 儲存,V 匯入,P 暫停。專案有 3 個資料夾,名稱帶著 20121002、20121012、20121019,各存一個時間點的原始碼。

The help window also lists shortcuts: Y and U pick two parents, J makes the offspring of the cross, A and S warm or cool by 2 degrees, X sets the temperature, K clears every creature, Q adds a creature with a given gene, G makes random ones, T saves, V imports and P pauses. The project has three folders named with 20121002, 20121012 and 20121019, each holding the source at one point in time.