第24題 Draw A Game Board(畫遊戲板) <<
Previous Next >> 解答-4
題目-4
Exercise 24
This exercise is Part 1 of 4 of the Tic Tac Toe exercise series. The other exercises are: Part 2, Part 3, and Part 4.
Time for some fake graphics! Let’s say we want to draw game boards that look like this:
This one is 3x3 (like in tic tac toe). Obviously, they come in many other sizes (8x8 for chess, 19x19 for Go, and many more).
Ask the user what size game board they want to draw, and draw it for them to the screen using Python’s print
statement.
Remember that in Python 3, printing to the screen is accomplished by
Hint: this requires some use of functions, as were discussed previously on this blog and elsewhere on the Internet, like this TutorialsPoint link.
Topics and links for more information
The main topic of this exercise is functions. They are tricky, and deserve lots of practice and thought. Here are a few links in case you want some more reading.
練習24
此練習是Tic Tac Toe練習系列4的第1部分。其他練習是:第2部分,第3部分和第4部分。
是時候購買一些假圖形了!假設我們要繪製如下游戲板:
這是3x3(就像井字遊戲一樣)。顯然,它們有許多其他尺寸(國際象棋為8x8,圍棋為19x19等)。
詢問用戶他們想要繪製什麼尺寸的遊戲板,並使用Python的print
語句將其繪製到屏幕上。
請記住,在Python 3中,通過以下方式完成在屏幕上的打印
主題和鏈接,以獲取更多信息
本練習的主要主題是功能。它們很棘手,值得大量實踐和思考。這裡有一些鏈接,以備您需要更多閱讀。
第24題 Draw A Game Board(畫遊戲板) <<
Previous Next >> 解答-4