⬆️ ⬇️

"Programming for beginners" + probability theory

An interesting thing: any video programming course, from PHP to Java, includes a chapter for beginners - most often it tells about the basics of structured programming: variables, branches and loops.



Therefore, we decided to solve this problem once and for all - and removed the course “ Programming for beginners ” , which will help the very beginners to understand and deal with these basic concepts, as well as try them out. The course is constructed as a series of video lessons on the example of the application of the theory of probability (so that it was more interesting).



Video course announcement:



')

One of the first videos explains why you should learn to program at all: there is so much around it only thanks to mass production, conveyor and automation. Therefore, if we are not slaves, in order to repeat dull and tedious work, then we need to learn how to program - Leibnitz said more about this in the 17th century, in other words.



The course is made under the JavaScript language (as an equal member of the C-family languages), and students get the basics of working with it directly in the browser console - it’s convenient because they don’t need to install anything.



Of course, students of this course will not only comprehend the theory of structured programming - they need to give an example of some simple project to consolidate their knowledge.



If you think that this is easy - take and come up with a project example, when you only have variables, conditions and cycles from the toolkit, then this is not quite the case. What would you suggest? Note that almost any application involves data entry in one form or another - and we decided not to touch on this in the course. So neither to you of input forms, nor reading from a file, nor database queries.



Therefore, the task came up with this - to generate a win-win strategy for the game "Stone-scissors-paper", then you can take a random number generator as a data source. If you believe Wikipedia and the university course on probability theory, if you make random moves and play a lot of times when playing “Stone-Scissors-Paper”, the result will be close to a draw (you can check with this robot ).



Some screenshots from the course



Variables we decided to explain on apples. " You have 2 apples. Someone took one apple from you ... ", says the girl with the blue hair. We took this simple task to illustrate the fact that a variable has a constant name and a variable value. Variables from everyday life: the dollar, the price of a barrel of oil, my salary, today's date, etc.



The conditions are also intuitive. “Red - stop, green - go” is a traffic light as an example of branching logic.



Figure 1 - condition



Here the cycles may not be clear to everyone. Although this is an operation that requires repeating the same actions, students do not have experience in programming cycles. Therefore, the ideas of counting iterations and what happens if the cycle is infinite are considered in detail.



Figure 2 - cycle



The result of the program visually looks like this (at the same time they figured out what Unicode characters are, and used them in practice):



Figure 3 - strategy generation program in “Stone-paper-scissors”



I hope we have not tried in vain, and you will like the course! Um, have you already said that it is free? ..



PS Subscribe to our updates - there will be an announcement of several more interesting things soon, more seriously.

Source: https://habr.com/ru/post/295150/



All Articles