|
このページはEtoJ逐語翻訳フィルタによって翻訳生成されました。 |
Bookmark this on Delicious
Recommend to StumbleUpon
Another atypical tutorial for this 場所/位置. (Is any of them "typical"??)
This gives you the sourcecode for something "simple"... but コンビナート/複合体! But doesn't do a lot of explaining. The sourcecode, though I say it myself, is elegant and "powerful". Also 柔軟な.
その上に, while what it gives you is "pretty", it isn't 特に useful, as it stands. It is more of a starting point.
With it, you could create a 模擬実験/偽ること of bees 群れているing, ships moving in the English Channel, etc, etc. (I wrote it as a starting point for re-creating a program I wrote for the Acorn Archimedes in the 1980s. That program ふりをするd a 全住民 of 動きやすい protists, each with a simple genetic character, and they 発展させるd as the 模擬実験/偽ること ran.)
Or just have fun with pretty 活気/アニメーションs. Or 拡大する the ability of your brain to work with arrays in your programming.
The に引き続いて static image, 高めるd with Serif's PhotoPlus, really doesn't do the program 司法(官). What you can't see here is that the "amoebas" are, in a somewhat un-lifelike symmetry, streaming across the page on 平行の paths.
I've 地位,任命するd the .exe on its own for you to download so that you can see the 活気/アニメーション in 活動/戦闘. Download LTN199.exe, Streaming Amoebas
And, as 約束d, you can also download the Lazarus sourcecode.
At the heart of this is what happens when its timer times out... which in "Prestissimo" 方式 it 名目上 does once a millisecond. (I'm not sure how the system 対処するs with the fact that the timer times out more quickly than the OnTimer event handler 遂行する/発効させるs... maybe the timer is 無能にするd while the code is 遂行する/発効させるing? I 港/避難所't done any of that explicitly, however, and the code runs for hours without 衝突,墜落ing. Pretty 冷静な/正味の 裏書,是認 of the way Lazarus is put together, don't you think?)
Anyway... When the timer times out, "all" that happens is...
ShowAmoebas;
MoveAmoebas;
inc(wCycles);
if wCycles>60000 then wCycles:=0;//Could 追加する "cycles of cycles" 反対する, to
//跡をつける 洪水s.... but want to keep this 急速な/放蕩な!
laCycles.caption:=inttostr(wCycles);
... of which only the first two lines are at all "clever".
(Digression... I think it was working with arrays of smart LEDs (WS2812s) driven by an Arduino recently that "奮起させるd" me to take this elegant approach.)
Everything in the program 回転するs around a few arrays.
MoveAmoebas makes changes to the contents of the arrays... and does a few other things. (More on this in a moment.)
ShowAmoebas 簡単に reads what is in the arrays (and a 決定的な pointer), and from that paints pixels on the 審査する.
Let's look "behind the scenes" a little; let's look into the 機械装置 behind the illusion of the "movement" of the amoebas. (Or birds or ships or whatever you want to ふりをする!) The に引き続いて shows one amoeba, first as it was at a moment in time, and then as it was in the next moment....
"The amoeba" is the one dark blue 独房. It is "moving" to the 権利. "Behind it" (to its left), there is a "fading 追跡する" showing where it has been. Depending on your 監視する, you will see a pale blue pixel just to the left of the amoeba, and a paler blue pixel to the left of that. The pixel above the "公式文書,認める A" pointer is drawn in white. (More on that anon!)
(In the .exe 供給(する)d with this tutorial, the "追跡するs" are longer. You can change the length of the 追跡する by changing the value in kMaxPixelsIndex.)
That amoeba is 代表するd inside the program by one 列/漕ぐ/騒動 of four elements in the array WhereX 加える one 列/漕ぐ/騒動 of four elements in the array WhereY.
To keep things simple, we'll talk only of the values in, and 巧みな操作 of WhereX. Of course, 類似の things are happening to and with WhereY, although as long as all the amoebas stream across the page horizontally, the code for the values in WhereY doesn't have to be as コンビナート/複合体 as that for WhereX... although the 関連した code for ShowAmoebas was fully developed as 急速な/放蕩な as the code for WhereX. In MoveAmoebas, 十分な 開発 was 制限するd to changing what was in WhereX, and the code for WhereY, while 挿入するd と一緒に, and 平行の to the WhereX code, is not as fully developed.
明白に, during ShowAmoebas, a lot of pixels are plotted on the 審査する. And, at first, you might thing you need some sort of "erase" 行う/開催する/段階, to get rid of the old "署名/調印する".
井戸/弁護士席... yes and no. Look at the example of one amoeba just above: If, in "time=x+1", you draw the three "new" blue squares, you will have overwritten two of the old squares. They don't need to be erased. The only old blue square that needs erasing is the old "end of 追跡する" (the one with x 調整する=12).
While it may seem that we've drawn just three pixels, in fact we draw four... three in different shades of blue, and one in the background color. That "oldest bit of 追跡する" is drawn in the background color not because you are going to "see" it, but to blot out oldest pixel of the old 追跡する.
You could of course say that you'd 持つ/拘留する the position of the amoeba in element 0 of the array, the most 最近の 追跡する pixel's 調整する in element 1, and so on.
And if you did, 製図/抽選 the new 審査する with ShowAmoebas would be really simple.
But you'd 支払う/賃金 a time 刑罰,罰則. All of the 調整するs of all of the pixels would have to be moved "across" the WhereX and WhereY arrays between each 世代!
Instead, the arrays are used like this...
最初 (If we have a 追跡する as long as the one in the illustration), we start with the に引き続いて in the 列/漕ぐ/騒動 for this amoeba...
11 12 13 14
However, for the next 世代 (time=x+1), only the value in the first element of the 列/漕ぐ/騒動 was changed. The whole 列/漕ぐ/騒動 became....
15 12 13 14
The secret to this is the variable "bColPointerHead". 最初, it held 3, then it was changed to 0. The "3" said that "at the moment, the amoeba's X (and Y) 調整する(s) is 蓄える/店d in column "3" of the array." And, in the next 世代, the amoeba's X 調整する could be 設立する in column "0" of the array. (The first column 存在 "指名するd" "the zeroth", as is usual inside code.)
It 作品! It takes some clever code to make it work.. but that's what's going on, inside the program.
In a 関係のある vein: There is a (米)棚上げする/(英)提議する of what color to use for the amoeba, for the freshest pixel of the 追跡する, the next freshest, etc.
Again: The values in the array are not moved around as the program runs. The ソフトウェア knows how to 選ぶ the 権利 one.
The ShowAmoebas 決まりきった仕事 作品 as follows. When I speak of "an element" of an amoeba, I mean....
(pseudo-code)
For each element of each amoeba... do..
For each amoeba... do...
陰謀(を企てる) a pixel, in the 関連した color
(End "do each amoeba")
(End "do each element)
"Yeah, yeah... big 取引,協定", I hear you 説. 罰金! Go out 令状 an 同等(の) program! You'll find it a bit more fraught than you thought it might be!
Or, to see just what is going on in the program you've been given, try any of the に引き続いて. (If anyone is teaching Lazarus to a class, they are welcome to "始める,決める" these challenges to students. I'd be 利益/興味d to hear about the results...
It would be a simple 事柄 of 延長するing some of the arrays to an 付加 dimension to 供給する for different sorts of amoebas... some red ones, some blue ones, etc.
The obvious (and 平易な) challenge is to 延長する the program so that the amoebas move in the Y dimension too.
Can you make different amoebas move at different 速度(を上げる)s? Move in straight lines which are not 平行の to the 辛勝する/優位s of the image, or at 45 degrees to an 辛勝する/優位?
Give each amoeba a "strength" 所有物/資産/財産. 段階 1: The strength values are 直す/買収する,八百長をするd, a variety 存在 割り当てるd when the world is created. 延長する that to something under which strengths wax and 病弱な. Maybe coming 近づく the upper 辛勝する/優位 makes an amoeba stronger, coming 近づく the 底(に届く) 辛勝する/優位 makes it 女性>
And have the strength of an amoeba somehow 陳列する,発揮するd in what it looks like on the 審査する. Oh, and a graph at the 味方する of the 審査する showing the 現在の 配当 of strengths across the 全住民?
Got all that done? Now give all the amoebas (and other organisms... you do have more than just amoebas 現在の by now, don't you?) 遺伝子s. And have the 模擬実験/偽ること 論証する 進化 by natural 選択. You'll probably have to 追加する feeding, and a 機械装置 to "rain" "food" from the sky...
That's not too much to 試みる/企てる. I had most of it running in a program for an Archimedes in about 1988. The idea wasn't 地雷, but all of the code was.
Search across all my 場所/位置s with the Google search...
|
|
Page 実験(する)d for 同意/服従 with INDUSTRY (not MS-only) 基準s, using the 解放する/自由な, 公然と accessible validator at validator.w3.org. Mostly passes. There were two "unknown せいにするs" in Google+ button code. Sigh.
....... P a g e . . . E n d s .....