Posts for: #Programming

Converting a Game Written in Basic to Python - Part III

In this third part, we have the following objectives:

  • Clean up the classes
  • Multiple planes
  • Multiple shots.
  • Generalize the game objects into a superclass
  • Display a score
  • Assign keys to shoot and play again or exit

In the version of Part II, the classes have a lot of repeated code. By analyzing each of them, we can reach a conclusion about a common behavior regarding how to draw and update the objects. A method to remove the object from the game is also used.

Read more

Converting a Game Written in Basic to Python - Part III

In this third part, we have the following objectives:

  • Clean up the classes
  • Multiple planes
  • Multiple shots.
  • Generalize the game objects into a superclass
  • Display a score
  • Assign keys to shoot and play again or exit

In the version of Part II, the classes have a lot of repeated code. By analyzing each of them, we can reach a conclusion about a common behavior regarding how to draw and update the objects. A method to remove the object from the game is also used.

Read more

Converting a Basic Game to Python - Part II

In this second post, we’re going to improve our game.

Although the new version runs in Python, it still looks like an old 80s game. The first thing to fix is the animation. Since we’re using a 280 by 192 point coordinate system to simulate Apple coordinates, we multiply each coordinate by 4 when drawing. To make it look similar to the original Apple, I reduced the number of frames to 8 per second. That’s why the animation looks so jerky! To get it running at 60 frames, we need to multiply the velocities by the ratio between the old and new frame numbers: 8/60. The new version defines some constants for this:

Read more

Converting a Basic Game to Python - Part II

In this second post, we’re going to improve our game.

Although the new version runs in Python, it still looks like an old 80s game. The first thing to fix is the animation. Since we’re using a 280 by 192 point coordinate system to simulate Apple coordinates, we multiply each coordinate by 4 when drawing. To make it look similar to the original Apple, I reduced the number of frames to 8 per second. That’s why the animation looks so jerky! To get it running at 60 frames, we need to multiply the velocities by the ratio between the old and new frame numbers: 8/60. The new version defines some constants for this:

Read more

Converting a Game Written in Basic to Python - Part I

The nostalgia of 80s computers is something I have never stopped feeling. As a child, I was fortunate to use several 8-bit computers, such as the ZX-81, ZX-Spectrum, Apple II, and MSX, or rather, their national clones (TK-85, TK-90X, TK2000), since Brazil was experiencing the era of the Informatics Market Reserve.

In a time when there was no Internet, we spent our time typing programs. A series of books on game programming was published by the Lutécia publishing house in Brazil, but the original American versions were released by Usborne.

Read more

Converting a Game Written in Basic to Python - Part I

The nostalgia of 80s computers is something I have never stopped feeling. As a child, I was fortunate to use several 8-bit computers, such as the ZX-81, ZX-Spectrum, Apple II, and MSX, or rather, their national clones (TK-85, TK-90X, TK2000), since Brazil was experiencing the era of the Informatics Market Reserve.

In a time when there was no Internet, we spent our time typing programs. A series of books on game programming was published by the Lutécia publishing house in Brazil, but the original American versions were released by Usborne.

Read more

Book on Introduction to Programming with Python is Now Available for Sale

There’s nothing like a cold and snowy night to get the blog up-to-date!
My programming book was published by Editora Novatec and is now available for sale.
I created a page about the book, with links to bookstores and contact emails:

https://python.nilo.pro.br

The book was written in such a way as to introduce new concepts gradually, with examples and exercises. When I started teaching, I taught Basic and Pascal. With Basic, there was the problem of line numbers. With Pascal, semicolons… it was too much to write before starting to program. In these cases, using a clear and simple pseudo-code, free from excessive symbols was interesting.
I avoided using pseudo-code or flowcharts, as I believe that when learning to program, it’s best to get straight to the point. With the Python language, everything becomes much simpler. Writing in pseudo-code can even be more complicated than writing in Python!
The reader/student needs to see something happening to continue studying. The important thing is to know how to read the program and understand what will happen when the program is executed. I really believe that the student should know if the program is correct before executing it. Execution is only a confirmation. A section on tracking was included in the book, to preserve this important step in learning programming.

Read more

Book on Introduction to Programming with Python is Now Available for Sale

There’s nothing like a cold and snowy night to get the blog up-to-date!
My programming book was published by Editora Novatec and is now available for sale.
I created a page about the book, with links to bookstores and contact emails:

https://python.nilo.pro.br

The book was written in such a way as to introduce new concepts gradually, with examples and exercises. When I started teaching, I taught Basic and Pascal. With Basic, there was the problem of line numbers. With Pascal, semicolons… it was too much to write before starting to program. In these cases, using a clear and simple pseudo-code, free from excessive symbols was interesting.
I avoided using pseudo-code or flowcharts, as I believe that when learning to program, it’s best to get straight to the point. With the Python language, everything becomes much simpler. Writing in pseudo-code can even be more complicated than writing in Python!
The reader/student needs to see something happening to continue studying. The important thing is to know how to read the program and understand what will happen when the program is executed. I really believe that the student should know if the program is correct before executing it. Execution is only a confirmation. A section on tracking was included in the book, to preserve this important step in learning programming.

Read more