This video we’re going to introduce the project karel craft so basically this is an integrated or an at least an attempt for integrating corel into a minecraft like environment using arsene engine with panda 3d back-end so just a brief overview correct the robot is an educational programming language for beginners Although it has evolved a lot you could also learn it you could also use it to learn python which is popular in data science and machine learning community on the other hand minecraft and other similar sandbox construction video games are popular to gamers and have built a considerable following in the community So karel craft is an attempt to mix the ideas together and perhaps put carell or put an agent in a 3d 3d world in which the agent could put vox cells while the agent or well the user will be able to learn basic programming basic programming concepts so just a brief background So correct the robot can be used as a method of teaching fundamental programming ideas and currently in its current version it is within a two-dimensional world uh in which this is the agent this is karel and karel can move forward or karel can move backward if in this case If it moves backward it has to turn around first and move so it’s it has its own limitations i feel like uh it could only move forward so if you move uh backward you need a of commands not to be able to perform that action so it can respond okay to simple commands Okay but there’s no the in its original version there’s no turn right by default and one reason for that is to teach the user to declare functions so the user the beginner could declare a turn right function by herself and you could have turned around as well and pick beeper and put beeper So the empty pair of parentheses recall that this is used to denote the function and karel will also give you some error or some so we call a prompt or if you made a mistake in your sequence of instructions karel will tell you that you have made a mistake so if carrel Tries to do something illegal such as moving through the wall or picking up a non-existent reaper and so on so karel will inform you about the mistake and this is very nice for beginners if you’re just starting to code in which you are just getting familiar with the concepts of conditional statements And iterations so it’s a problem goal solution approach to programming in which carell needs to perform a task like for example in this stat in this example from stanford you have karel must move one step only one step to this beeper and pick it up and after that transfer the beeper to A different location in the world okay and together the user will be able to come up with a sequence of instructions to be able to solve the problem and basically that’s the idea behind coding or programming so you could come up with a sequence of instructions sometimes you apply branching And control structures like iteration loops to be able to solve the problem so uh for python you could have basic centers like the snake case turn right and now this is the default or this is the custom function turn right and for java as well you could learn corel to You could use karel to learn java language at least for python is this is the pattern so you have def will define the function the keyword to define a function and you have main so this is required in the current program and you could also have a turn right Custom function as stated earlier uh carell problems will be able to teach you the composition so the process of breaking a program or a problem down into smaller pieces Like for example uh in this case uh carrel’s first step is to move to the hole and second will be to fill the hole with a beeper and then after that moving on to the next corner and the student will be able to visualize some of these Sub steps and come up with a different solution or come up with a solution for each of them and then integrating it to solve the overall problem so that’s the idea behind problem decomposition so karel will also be able to teach a student iteration a process of repetition or doing Something again and again uh like the for loop so in this case uh karel is just gathering beepers and putting it in a certain location and in this other problem coral is just putting beepers at the edges you could also nest the loop in which corel will install a certain number of beepers In each corner and the code is this like you have a custom function like move to the next corner uh put five beepers okay and then just go to the corners in the main loop or in the main function and the idea is just solve the problem while loop is Also introduced a process again this is similar to for loop but in this case you are testing a certain condition okay you have while test and in for loop the the usual use case is when you know the number of iterations beforehand however in a while loop if you just want to attach To test a certain condition it would be ideal to utilize it and just put a terminate termination condition afterwards a while loop so karel is starts to move uh while in front uh is clear okay from obstacles so this moves to the corner or move to the wall So moving to the wall is a simple while loop and testing the condition front is clear so the idea behind the front is clear is it it will simply return either true or false so if if there’s no wall or if there’s no blocking it’s there’s no item blocking its way then it Will be able to move to the wall this will be true front is clear and perform the move repeatedly so this ideal ideal in teaching beginners to learn the concepts of iteration or simple repetitions in the program without too much syntax so the common pitfall Is the fence post bug so the idea is on the last position usually uh if you put beeper for example the last position uh well either the last position or the first position might be vacant because of the fence post bug uh like for example in this case well Front is clear if you’re putting beeper and moving afterwards the last beeper uh will not be installed or will not the last position will have no beeper the idea is this can easily be solved by putting a paper outside of the iteration like this one so basic conditions so you have Conditional testing like if the test is true then perform the code block one otherwise perform code block two and basic conditional statements as well like for example if there is no beeper you install a beeper and so on okay and these are basically listed in the documentation for current so the Uh let’s start with a brief demo so in this program this uh program is simply traversing the world the idea is karel is installing beepers to the corners and it will stop as long as or after it installs all the papers so the gold the programmer is simply that and Not producing a debug error i feel like it finished running and it’s successful so this is a sample solution so you could have a your own default function you have a main function and you run the code so the goal of this project going back to the karel craft since the current interface Is two-dimensional why not we could transfer karel or any agent performing the instructions into a three-dimensional three-dimensional world so that’s why uh this is karel kraft and the idea is combining the concepts of corelda robot and minecraft a minecraft-like environment although this is a very small version of it Being that at the scale of the existing one but the basics basic ideas are there so in this project we applied the uh or cena engine by poke peter and if we run this code instead of importing stanford carell from the guys in stanford okay we could import this module correlate Okay which is this one i put it here and we could test the we could test the perimeter first okay coming up this program in the perimeter program i will simply go around the perimeter of corel and install the blocks so this is the basic interface of Carrel so you have here the prompt the prompt will uh state the current action of karel like putting the block or moving or turning the turning left and so on the position is all stated here okay and you could you could explore with the speed i think you could make it Slower or faster you could also adjust the camera so you could come up with a sort of a 2d view of it so this is just a camera trick and once the corel has finished running you could also explore the world okay using arrow keys or wasd keys And the prompt will also tell you if that location is forbidden okay so this is the sample error scenario if you move beyond the world okay i haven’t implemented the at the walls yet within the world but ex executing that will be pretty straightforward i think so you could also have the traditional Beeper approach so in beeper you could stop multiple beepers so in this case we could run the beeper And uh there is a certain number to it because you could stop beepers on top of each other so the number in that that entity will give you the the current number in the stock so we could adjust the speed and make it faster so the idea is Okay we could try to show the stack of beepers so if if i delete the termination condition which is if black present or beeper or if color is present go outside the loop so in this case this will simply be an infinite loop so we could we’re able to we will be Able to explore the stacking of the beepers so i simply put a z offset okay so you could see that there’s a sort of a z offset here by the way energy energetic you could use the right click to just drag the the entity and explore your preferred angle so currently we have Four beepers in the stock so let’s just stop at five beepers for now and move on to other demo so this is stacking five reapers okay and you could simply press escape okay to cancel the execution and as you could see the beepers here are stopped so the topmost level is six Okay at least for this part okay however the other parts type and if if you move it sideways okay you could see that there’s a stacking going on because of the z offset now instead of beeper we could also try to use the color We could paint a certain color let’s run this make this faster okay so i made it faster and the idea is it just colors the black we could also test the multiple objects as you have seen this before but this time around we’re also removing it so we’re stacking The beepers let’s make it a bit slower so in this case where we’re stacking the beepers and removing it afterwards so stacking it okay and then removing it afterwards we could also test the destroying of the beepers okay in which we put beepers in the line And then we simply destroy it one by one and it will give you an error if you’re removing something that is not there so eric carrell attempted to pick a beeper but it does not exist so the the reason behind this is you have uh this in this example okay we’re installing A certain number of beepers okay and then afterwards we are removing it even if there’s no more beepers to remove so if if there’s no more beepers to remove just like the standard corel it should return an exception i also noticed that if you increase the speed too much there Will be a bug in the collider so just to avoid that scenario i just use the data structure and not the not the collision for that the collider object if we could also explore the pyramid so in this case this is creating a triangle so currently it’s creating a triangle of Of grass pattern okay i could also modify this like for example for the second level i could choose maybe a different layer just pressing numbers okay as sort of the texture just changing the texture in this case you could change other you could you could add more textures to this so In my case i just have there’s the next character you have the texture okay so i think i have the only five textures okay but then i get this this can be increased We could also change the the size of the world like for example if in the constants if we have a maybe a smaller world like maybe 12 by 12 and let’s test it with the pyramid so this is now a smaller world for karel and the behavior is just the same You could change the texture you can make it faster okay you could also explore the other commands within my previous discussion karel okay so like in this case we could explore the uh different colors we could explore the random colors This case this is these are blocks so let’s cancel it okay because i already converted this to blocks now they let me okay let me reconvert it to color Okay so in this case this is the random coloring and it’s currently in staircase pattern and again you could explore the 2d camera view and the 3d 3d view as well okay lastly i want to show you the rainbow pattern as well or the layered layered color pattern which okay which i Was shown in the previous video this one so it will pick another color for the next layer okay so we could test it to a larger world as well like uh we could test it to a 40 by 40 world okay hopefully it doesn’t break let’s let’s test it with the rainbow Colors okay so uh this is a big world so let’s reduce this let’s make the speed Faster So in this case this would be ideal to uh to use the this environment for teaching beginners and let them explore uh what they could do with the basic computational concepts uh like iteration and control structures or conditional statements so this generating certain colors i could also utilize bricks for this And pretty much that’s it thank you for your time you Video Information
This video, titled ‘KarelCraft: Karel + Minecraft-like Environment with Ursina (Panda3D)’, was uploaded by MELVIN CABATUAN on 2021-05-21 02:29:40. It has garnered 199 views and 3 likes. The duration of the video is 00:29:28 or 1768 seconds.
Karel + ‘MineCraft’ – like environment enabled by Ursina Engine (Panda3D)
Code: https://github.com/melvincabatuan/KarelCraft
“Karel the Robot”, an educational programming language for beginners (Pattis, 1970), remain useful for learners in programming and computational thinking. In it’s most recent form, you can use it to learn the multi-purpose language Python that is popular in data science and machine learning community. On the other hand, Minecraft (by Mojang Studios) and other similar sandbox construction video games (e.g. Minetest) are popular to gamers and have built a considerable following in the community.
KarelCraft is an attempt to mix the ideas together and come up with an environment that beginner programmers can learn fundamental programming skills, while working with an agent, i.e. Karel, doing actions and performing decisions in a small sandbox construction setting.