Programming with one language with code ready. Robotics Game of Life. Pro Preview

The code is already ready. It is attached below the video. Let's see how the program works and what it does and how to use it. 

  • #250
  • 14 Mar 2016
  • 5:43

You can also modify this program. Try to change it. Experiment with it. See what happens. Or just run it and have fun with the program running on the brick and playing the game on the brick.

What it does

The program actually displays a grid. You can set some of the cells to be alive and at the end start the game and see how the different generations are calculated. 

Why on the brick screen

Our idea is to have the program without any sensors and motors. Just the general simulation of the program on the bricks screen. In this way we can discuss the game, its rules and how the switch, arrays, loop are used. 

Do the following tasks and modifications of the program.

Tasks description, submission and evaluation are available to subscribed users.

Subscribe now to access the full capacity and get feedback.

English

- Now that we have discussed the general programming of the robotics game of life, let's see how it works on the brick. This is the final program at this stage. We we have the brick and we have a grid. And when we start...

...we can see the game.

What you can now do is download this program. It's attached in the materials section below the video and run this program on your brick. And when you run the program you just click program and you're given a choice with a menu. And in this menu you can configure the number of rows and the number of columns that you would like your grid to have. And we set four by four and then we move with the buttons and with the buttons we select New. It's a very interesting way to program a menu and you also can get other tutorials about menus that we have at the site. And when we select New, we can then move with the left and right button and as you can see we kind of mark the cell that we are with the thinner borders. And we move, we move and with the enter button we can set that this cell is alive. And we can also set this cells is alive and we can set, for example, that cell is alive and also this cell. Now we move to the lower right bottom right corner and we click on the right button. So we are at the bottom right corner and we click with the right button and we start to play the game. And these are the new generations and you can see here that we have the new generations, and we reach a stable state. So from this state, the new generation will look the same. Download, run the program and see what happens. It is also interesting to start the program with more cells. So, for example, in this case I'll start the program with 20 by 20. This is the maximum rows that we've configured: 20 by 20. And we start the new game and you can see it's very tiny square right here. That's kind of white, and we can select okay. This is live cell, and this is alive and this is alive, and it's a trail. Just set the configuration here and then we move, click a few times. We move to the right and then we move to the bottom with the button. Just like the menu and now we're in the bottom right corner, right here. We click right and we'll see the different generation. Now we take more time because its a larger grid. The program is written in a way that it's taking a few seconds currently, but we can see the new generation. What you should do is try to solve the tasks that are below the video. Now we will take a look at the program and below the video are some of the tasks for you to modify this program so that it behaves in different ways and just to get to know the program. It might be a little bit more complex, but just a few modifications should be pretty easy. Let's check the program. This here is the program. It consists of a few blocks and what you can do is, instead of implementing the program from scratch, you can just download it. It's located below the video and we will discuss some of the implementations in this program so that you can get used to them and understand them and use them. The first thing that I would like you to do is a task, is to modify, to change, these two variables. These two blocks are called variables. And as you can see, their value is four for rows and four for columns. It's a misstype, but it's columns. And now, if you change this to a different value, like 10 here and 10 here, and download and run the program, then initially, the grid will start with a size of 10 by 10 rows, So try modifying these values and downloading the program and also try modifying the program in a way that we describe in the tasks below. Do this before continuing to the next video so that you can see this program. Open a few of the blocks that are doing this program and get to know this program.