ผลต่างระหว่างรุ่นของ "Prg2/monkey game"

จาก Theory Wiki
ไปยังการนำทาง ไปยังการค้นหา
 
(ไม่แสดง 16 รุ่นระหว่างกลางโดยผู้ใช้คนเดียวกัน)
แถว 2: แถว 2:
  
 
== Basic information ==
 
== Basic information ==
 +
 +
[[Image:Prg2-monkey-cover.png]]
  
 
* Repository: [https://github.com/jittat/monkeys-demo https://github.com/jittat/monkeys-demo]
 
* Repository: [https://github.com/jittat/monkeys-demo https://github.com/jittat/monkeys-demo]
 +
* Inspiration: QBASIC GORILLAS - See [https://www.youtube.com/watch?v=UDc3ZEKl-Wc&t=37s]
 +
 +
== Part 1 ==
 +
 +
See the clip here: [https://www.youtube.com/watch?v=OnR5JrMhVow PRG2 - Monkeys Part 1]
 +
 +
In this part we will learn
  
== Materials ==
+
* Basic refactoring of code
 +
* Basic project management tool in github, e.g., issue tracker and project board
 +
* Git commands: init, add, commit, pull, push
  
=== Part 1 ===
+
{{กล่องฟ้า|
 +
'''Careful''': In the clip, I said that when you call <tt>git pull</tt>, git would do <tt>fetch</tt> and <tt>merge</tt>.  I incorrectly said that you have to commit the merge yourself when there is no conflicts.  I think I have fixed all that, but if you find in the clip somewhere that I said something like that, please let me know.
 +
}}
  
=== Part 2 ===
+
== Part 2 ==
  
=== Part 3 ===
+
See the clip here: [https://www.youtube.com/watch?v=OxsQXZb1WLo PRG2 - Monkeys Part 2]
  
=== Final code ===
+
In this part we will learn:
 +
 
 +
* Git commands: log, checkout
 +
* Git concept: branch, remote, edit history, merge conficts, .gitignore
 +
* Working on the same remote git repository with other developers (with no branches)
 +
* Using modules in Python
 +
* Small code cleaning
 +
 
 +
== Part 3 ==
 +
 
 +
See the clip here: [https://www.youtube.com/watch?v=AtAHAEle9Cg PRG2 - Monkeys Part 3]
 +
 
 +
In this part we will learn
 +
 
 +
* More project planning using github project board
 +
* Git concepts: branches
 +
* Git commands: branch, fetch, merge, stash
 +
* Code:
 +
** Show/hide functionally in Sprite
 +
** Keyboard event handling in GameApp
 +
** Text class for showing text on the canvas
 +
 
 +
== Final code ==
 
We notice that there are many duplicate lines in Sprite and Text (in <tt>gamelib.py</tt>).  Therefore, we extract a new base class, called <tt>GameCanvasElement</tt> from both classes.  We also have to update all attributes from <tt>sprites</tt> to <tt>elements</tt> so as to be more inclusive about things inside the list.
 
We notice that there are many duplicate lines in Sprite and Text (in <tt>gamelib.py</tt>).  Therefore, we extract a new base class, called <tt>GameCanvasElement</tt> from both classes.  We also have to update all attributes from <tt>sprites</tt> to <tt>elements</tt> so as to be more inclusive about things inside the list.
  
 
: See the diff here: [https://github.com/jittat/monkeys-demo/commit/d07e9ac733a38bf47b1f22ba753d3a8f7c0eb968]
 
: See the diff here: [https://github.com/jittat/monkeys-demo/commit/d07e9ac733a38bf47b1f22ba753d3a8f7c0eb968]
 +
 +
[[File:Monkey-games-last-diff.png]]
  
 
This is the edit history for the game.
 
This is the edit history for the game.
  
 
[[Image:Prg2-monkey-edit-history.png]]
 
[[Image:Prg2-monkey-edit-history.png]]

รุ่นแก้ไขปัจจุบันเมื่อ 01:51, 9 มีนาคม 2564

This is part of Programming 2 2563

Basic information

Prg2-monkey-cover.png

Part 1

See the clip here: PRG2 - Monkeys Part 1

In this part we will learn

  • Basic refactoring of code
  • Basic project management tool in github, e.g., issue tracker and project board
  • Git commands: init, add, commit, pull, push

Careful: In the clip, I said that when you call git pull, git would do fetch and merge. I incorrectly said that you have to commit the merge yourself when there is no conflicts. I think I have fixed all that, but if you find in the clip somewhere that I said something like that, please let me know.

Part 2

See the clip here: PRG2 - Monkeys Part 2

In this part we will learn:

  • Git commands: log, checkout
  • Git concept: branch, remote, edit history, merge conficts, .gitignore
  • Working on the same remote git repository with other developers (with no branches)
  • Using modules in Python
  • Small code cleaning

Part 3

See the clip here: PRG2 - Monkeys Part 3

In this part we will learn

  • More project planning using github project board
  • Git concepts: branches
  • Git commands: branch, fetch, merge, stash
  • Code:
    • Show/hide functionally in Sprite
    • Keyboard event handling in GameApp
    • Text class for showing text on the canvas

Final code

We notice that there are many duplicate lines in Sprite and Text (in gamelib.py). Therefore, we extract a new base class, called GameCanvasElement from both classes. We also have to update all attributes from sprites to elements so as to be more inclusive about things inside the list.

See the diff here: [2]

Monkey-games-last-diff.png

This is the edit history for the game.

Prg2-monkey-edit-history.png