User Tools

Site Tools


robots

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
robots [2023/09/27 00:29] appledogrobots [2023/09/27 00:31] (current) appledog
Line 1: Line 1:
 = Robots = Robots
 Part one of this class was taught to [[Roger]] on Sep. 19th 2023. Part one of this class was taught to [[Roger]] on Sep. 19th 2023.
 +
 +This discusses the basic addition of map and player. In part two we add rocks and robots, and in part 3 we finish the game.
 +* [[robots-2|Part 2]]
 +* [[robots-3|Part 3]]
  
 == PyGame Console Starter == PyGame Console Starter
Line 103: Line 107:
 Note that #3 could be written using else: as well; but then later if we want to introduce more checks it will be difficult to modify the code. Not difficult, just more difficult than this way. The fall-throuh condition style of coding is considered lower-level than using if-elif-else, and an even higher level is to use switch. If-else is lower level than if-else. This is based on how assembly laguage works. Although you could use a 'jump table' or a series of ifs to simulate a switch; which is why switch is a high level language concept-- it doesn't exist in machine code and is a construct to bridge the gap between how we think or how we want to think when programming, and how the machine actually works. That is why higher level constructs are always slower, and why languages such as Python which are based around high level abstractions are always slower than lower level languages. The target level is different. Note that #3 could be written using else: as well; but then later if we want to introduce more checks it will be difficult to modify the code. Not difficult, just more difficult than this way. The fall-throuh condition style of coding is considered lower-level than using if-elif-else, and an even higher level is to use switch. If-else is lower level than if-else. This is based on how assembly laguage works. Although you could use a 'jump table' or a series of ifs to simulate a switch; which is why switch is a high level language concept-- it doesn't exist in machine code and is a construct to bridge the gap between how we think or how we want to think when programming, and how the machine actually works. That is why higher level constructs are always slower, and why languages such as Python which are based around high level abstractions are always slower than lower level languages. The target level is different.
  
- +At this point you should have a working game which allows the player to move around, but there are some problems with the game. Yet, this so far is good enough for a small 1.5 hours class.
robots.1695774586.txt.gz · Last modified: 2023/09/27 00:29 by appledog

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki