Robot Xiao Xin Yi language source code job ):
650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131228/153U2K29-0.png "> robot Xin source code-Lesson 1. Zip
Text Version of video tutorial:
1. From simple to deep, from easy to difficult, and step by step, do not rush for immediate success or gain benefits!
This is the general law of learning. Learning any knowledge is like this. If you do well in every step, you will naturally succeed.
2. Read the source code and write more source code to make it easier;
Reading is learning, writing is practice, continuous learning, continuous practice, continuous error, continuous correction, more persistence, OK, you will be a master in the near future!
3. Do not use modules as far as possible for new users. Because modules are highly encapsulated Code, once a software problem occurs, debugging will become impossible. Unless you know how modules are encapsulated, that is, you can also use pure code to write the same function, but you don't want to write it. Of course, you are no longer a newbie to this degree)
4. patiently handle every problem you encounter, so you cannot leave it alone;
Easy to understand, easy to use, Chinese programming environment, but it is a programming language after all, it will certainly encounter many difficulties, do not lose heart at this time, by working hard to solve the problem through various channels, you will become a master.
Everyone has heard a word, and thought determines fate! Because human behaviors are dominated by thoughts. The same is true for programming. First, we need to know what kind of functions the software should implement. Then we need to design a framework in our mind and then implement it with code.
A programmer writes a program like a writer writes an article or a book. First, he must have an overall understanding of the article or book, and then write the paragraphs and chapters separately. Otherwise, the written work may be messy and difficult to understand. If you do not have a good idea and architecture for the program before writing it, the program you write will be very bad, and you can't even write it in the middle.
Programming languages are like various languages, such as English, Chinese, French, and Arabic. It is undeniable that all languages have excellent literary works, you can also write very beautiful and powerful programs in easy language!
So, in terms of Chinese, can you write good literature as you know more Chinese characters and more idioms? Of course not. Good literary works are not only simple compilation of beautiful words, but also simple accumulation of cool sentences. More importantly, they are fascinating plots, clever arrangement of stories, and attention of the author's thoughts.
The same is true for programming. The idea is very important!
Xiaoxin is a simple robot program that I wrote in easy language. In our future courses, xiaoxin will often be used as an example to explain various commands and programming ideas in easy language.
Job: let robot Xiao Xin pick up the square at in the initial state and move it to A4 to put down the square.
What can Xiao Xin do?
1. Forward
2. Left turn
3. Quick Inspection
4. Place squares
. Version 2
. Supports database spec
. Subroutine painting point
. Local variable W, integer type
. Local variable H, integer type
Local variable W average, integer type
. Local variable H average, integer type
. Local variable Harr, integer type, "3"
. Local variable Warr, integer type, "5"
. Local variable I, integer type
. Local variable a, integer type
W = grouping Box 1. Width
H = group Box 1. Height
W average = W ÷ 6
H average = H limit 4
. Count the first loop (5, I)
Warr [I] = W average × I
. End of the count loop ()
. Count the first loop (3, I)
Harr [I] = H average × I
. End of the count loop ()
. Count the first loop (5, I)
. First of the count loop (3,)
Copy the window component (Label 1, LabelArr [(I-1) × 3 + a])
LabelArr [(I-1) × 3 + a]. Left = Warr [I]
LabelArr [(I-1) × 3 + a]. Top edge = Harr [a]-30
LabelArr [(I-1) × 3 + a]. Visible = true
. If it is true (I = 1)
Copy the window component (Label 2, LabelArr [15 + a])
. Start of judgment (a = 1)
LabelArr [15 + a]. Title = ""
. Judgment (a = 2)
LabelArr [15 + a]. Title = "B"
. Judgment (a = 3)
LabelArr [15 + a]. Title = "C"
. Default
. Judge the end
LabelArr [15 + a]. Left = group Box 1. Left-3
LabelArr [15 + a]. Top edge = LabelArr [(I-1) × 3 + a]. Top edge + 13
LabelArr [15 + a]. Visible = true
. If it really ends
. If it is true (a = 1)
Debug output (copy the window component (Label 2, LabelArr [18 + I])
LabelArr [18 + I]. Title = to text (I)
LabelArr [18 + I]. Left = LabelArr [(I-1) × 3 + a]. Left + 50
LabelArr [18 + I]. Top edge = grouping Box 1. Top edge + grouping Box 1. Height-10
LabelArr [18 + I]. Visible = true
. If it really ends
. End of the count loop ()
. End of the count loop ()
Address: http://www.jinqiuxin.cn/post/29.html