0
A nice challenge for using OOP?
I have just begun with using Python, and after this week I will have done a lot of beginner challenges to learn the programming code. I found the Ptyhon OOP and FOP very difficult in the lessons on Sololearn. Does anyone of you guy know a nice challange that can help me learn this way of programming? Thanks in advance!
4 Respuestas
+ 2
what is FOP
+ 1
In my opinion, making a game of some sort that involve actual 'objects' that you can interact with might be a good way to get the hang of OOP. It's also very rewarding to make something you can see working.
--------------------
You can make use of Python's pygame library to make simple games.
But you should consider Processing, which does require a download, but is much more beginner friendly and fun to learn (in my opinion at least)
https://py.processing.org/
--------------------
Maybe you could start off with a tic tac toe game. It might include a 'Board' object, with methods and properties such as:
- board.data
- board.mark([mouseX, mouseY], 'X')
- board.isGameOver()
- board.reset()
Or a pong game with Paddle and Ball objects:
- pad1.move(10)
- ball.isHitting(pad1)
- pad2.score += 1
Maybe even a snake game
- snake.dead()
- snake.length += 1
- food.isEaten()
You get the idea, maybe you could even make your own game.
--------------------
Here are some examples (for inspiration, definitely not self promotion)
https://justaratherridiculouslylongusername.github.io/Snake/
https://justaratherridiculouslylongusername.github.io/Pong/
In case you run out of ideas
http://inventwithpython.com/blog/2012/02/20/i-need-practice-programming-49-ideas-for-game-clones-to-code/
--------------------
Hope this was of some help :)
0
thanks man! I'll get right on it!
0
No problem! Let me know if I can be of any more help