Posts

Showing posts from October, 2023

Day 20

Image
Numeric variable Now that I have learned to write codes for regular variables such as sentences and words, I have now learned to write codes for numerical variables using the symbol %s or %d to appear with us in this image.

Day 19

Image
Now I have tried making a program that asks me my name and when I tell it, it welcomes me. I did it before in scratch. I used to do it through the ask command. So I will do the same thing to you in C language, so I wrote the codes in this image:

Day 18

Image
Now that I have learned a little programming on the Scratch program, I have now begun to learn the C language. The C language depends on writing codes, and most other languages in general depend on writing codes. Writing the codes is done in English, but the computer does not understand them, so I need a translator to convert the letters into numbers. So I started learning how to convert the codes to Binary so that they appear with me in this image:

Day 17

  Game I'm now starting to apply the concepts I've learned to designing a game. Each character will have its own code. We will have three characters, and I will add each character with its own commands The game will be like this

Day 16

Image
  Variables  Now we will talk about variables. A variable is simply a place where we save a certain value or data, and this value can be a number, text, or anything. If I have data, I can save it in variables and then I can change its value. That is why it is called a variable. In order for me to create a variable in scratch, I go to the Variables box and give it any name I want. For example, if I want to create a program that compares two specific values while adding some conditions to them, it will appear like this

Day 15

Image
 Conditionals Today I learned one of the most important programming concepts, which is conditions. The conditions we use in normal life are exactly the ones we use in programming, for example when a mother says to her son, “If you finish your homework, I will allow you to play.” Now I want to do something, but this order can only be executed under a certain condition. If it is met, the order will be executed. If it is not fulfilled, it will not be executed. This is done through the Control field and then bringing the if command. But before anything else, the forever command must be shared with us so that the computer always receives the condition and does not stop at a specific moment. Example: If the mouse touches the object, it will meow. We will write the commands like this:

Day 14

Image
Now that I was able to create a function myself, I learned the input input for this function, and this input can be anything, such as the number of repetitions, etc., and so on. It is not a normal function, but rather you used it correctly, and this input appears like this. So this function can receive input, but its function is not known, so I register any function for it and let it be the number of times for it to appear in this image.  

Day 13

  Function   The function is one of the most important programming concepts, and there are entire programs based on the function language, so I learned a few of them today. Now, if I wanted to combine several commands, I would make them into one code, but there is no specific command that would make me merge the commands, so I enable scratch. We have the opportunity to create an order ourselves through My Blocks . I can give the command any name I want and combine several commands with it to become one command. This method is useful when you have many orders, so try to simplify them in the best way possible.

Day12

Image
  Repetition Today I learned to repeat commands, for example, if you want the object to say Meow, but more than once. First, before repeating, we have to choose a command to make a sound, which is play sound, in order to say meow. Now, if I wanted, for example, to repeat it three times, I could enter the same command three times, but you would do it successively and quickly. I can create a delay between each command through the wait command and set the number of seconds I want. But programming and algorithms in general do not depend on reaching the solution only, but rather reach the solution in the best possible way, and entering the same code several times manually is not the best way, so there are two things.                                         forever                 repeat  Repeat is to repeat the command a number of times th...

Day 11

Image
Now if I wanted the object to speak a word instead of writing it So I will go to My Blocks and choose Text to Speech . We will find a command called speak and install commands on it so that it appears with us in this image.

Day 10

Image
Each scratch command is a function that the program assigns to you, and we can also learn how to create functions ourselves. Now, if I want the object to ask me my name, and when I tell it, it welcomes me on its own. This method has one input but more than one output, meaning that it is not fixed because it can call me by any name. To solve it, we follow the following:   Because we want a question, we will choose ask from Sensing and write what's your name. Then the object receives the answer, which is my name. Then we store the answer in say, which we will fetch from Looks . In order to be able to combine the name with the word hallo, we choose join from operators so that it appears with us in this image.                 

Day 9

Image
If I want to make the object in scratch say, for example, hallo world. Now I have input, which is hallo world, and output, which is the final output, which is to make the object say hallo world. But we are missing an algorithm, which is the method or command that we will give to the object to say hallo world. Of course, first we must bring a command from Events , which makes the rest of the commands work, and then to Looks, from which we will fetch the Say command and put them together to appear in this image. The say command here is the algorithm by which I was able to reach the result.

Day 8

 Control It has many commands, such as wait, which makes you delay the command for a specific number of seconds, and repeat, which is repeating the command a specific number of times, while forever, which repeats the command indefinitely. Sensing I can control the character's actions, for example, by making him ask a question and make him answer. Operators It contains most arithmetic operations such as + and -. Variables Where I can store data in these variables. My Blocks These are functions that I can create myself.

Day 7

There are many commands in scratch including. Motion  Motion commands enable you to control object movements such as walking and turning. Looks These are any commands related to appearance, for example if you want the character to speak or think. Sound These are any commands related to voice. Events It concerns events, and it is one of the most important things in programming because if you place any of the other commands, it will only be executed using the event command. 

Day 6

Image
Today I started learning Scratch , which is considered one of the simplest programming languages. You can configure your entire online working environment in Scratch without downloading it to your device. The first thing that will catch the eye is this object (the cat) and this white box is stage or output There are also many characters and backgrounds that you can modify whenever you like. What makes scratch an easy language is that it has no room for errors because the form of the codes in it is in the form of puzzles , and this makes the subject easier. For example, if I put two things that are not complementary to each other, I will not be able to put them together.

Day 5

No one can learn programming and solve problems without knowing algorithms . Algorithms are about taking a set of steps to solve the problem in the simplest way. You can ask why do we need algorithms for programming? One thing we must understand is that a computer has no mind, meaning it cannot think, unlike a human. If you tell it anything, it will understand it. Directly, but the computer must tell it all the steps that must be followed to do that thing, and if you forget to tell it a step or make a mistake in it, it will not understand the matter, and the steps are algorithms. Any program you want to design before you implement it in any programming language must be written in the form of pseudocode , which is the organization of the steps that you will follow and the method of writing them, like any method of writing a programming language, so you must use it first so that your brain is qualified for programming. Example: If I want the computer to find a name for me, I type the fol...

Day 4

  R  G B  This system is a mixture of the three main colors:  By mixing these colors, we can obtain any shade of color we want, and this happens because we set different values for each color that we can reduce or increase to extract the shade of color we want. With these values, they can be converted to Binary so that the computer can understand them, and each color shade is a byte. As I mentioned previously, its maximum value is 255. Example: If you want red, give it the maximum value (225), green and blue with zero, and so on . The Pictures If you look at any image and zoom in to the maximum extent, you will find that the images are made up of squares called Pixels , and the pixels are a color and the color is a byte. This is how the computer can understand the images . Videos Video is a group of images and frames that move continuously, creating movement, creating the video. The images are pixels, the pixels are a color, and the color is a byte. ...

Day 3

Binary System I understood that computers only understand the language of 0 and 1 So I needed a way to make the computer understand sounds, videos, images and languages Therefore, symbols, numbers, and letters were converted into a value in the binary system, and this system is ASCII code (American Standard Information Interchange)   As is clear in the previous image, this system provides each letter with a fixed value that the computer can understand But this system is not sufficient because the data here represents only 7 bits or 8 bits Because the maximum value I can reach is 255, assuming that there are 8 closed keys But I cannot represent the rest of the multiple languages such as Arabic, Chinese, Japanese, and others A new system called  Unicode was invented, which can give you from 16 bits to 32 bits  

Day 2

  Computer language The computer only understands the language 1 and 0. Every letter I want to deliver to it has a specific code, and not just languages, but even pictures and videos. There are two systems for learning that language           Binary System                             Decimal System   I learned some basics about them, the most important of which is that each number has a specific value that is different from the other To represent any value, we must operate a number of switches to equal the same desired value For example, a binary system contains 8 keys, and each key represents  a value if it were the first key   It equals 1 and the second key equals 2 then If you want 1, I will open the first key If I want 2, I will open the second key If I want 3, I will o...

Day 1

  Programming has many specializations such as web mobile desktop cyber security But first  we have to be properly established at the beginning of studying any language in a simple way, such as the CS50 curriculum The main idea of programming is to solve problems in the simplest way Firstly We have input, which is the problem to be solved The device in which we process   Output  of the solution to this problem In order to communicate with the computer to solve the problem, we must understand its language, which is the language of zero and one. The smallest computer unit is a bit The slightly larger unit is a byte, consisting of 8 bits The summary of all this is that every letter, number, or any word has a symbol for them in the language 0 or 1 We will learn more about how to communicate with the computer in this language in the coming days