Recreating Monster Synthesis in Python
Writing & Edit Takashi Suzuki. . . .
- Subject: Use only part of the game data as an example.)
- Reference information
- Middle
- Description of the confirmation method
It's a class where you write Synthesis recipes in the form of a dictionary, and then you program the material back from the monster you want to make.
So let's start by following the child's parents with paper and pen. If you see the answer, let's do the same procedure for looking at the parent and write down the Python function just once.
Aim.
- So let's look at this.
- So we can think about it in terms of what we want to create.
- And then we can use the function to figure out what the recursive function is doing.
進め方(45分 × 2回の例)
| Time | What to do. |
|---|---|
| 1回目の前半 | And then we're going to have to do something that's really important. |
| 1回目の後半 | Set Synthesis recipes as a Python dictionary |
| 2回目の前半 | We're going to do a little bit more work. |
| 2回目の後半 | I'm going to have to mix with the fantasy monsters I thought I'd do. I'm going to have problems with friends. |
Program
# 配合表:作れるモンスター → 親2体
recipes = {
"スライムナイト": ("スライムタワー", "メソコボルト"),
"さまようよろい": ("スライムナイト", "たけやりへい"),
"トルトリーナ": ("メタッピー", "フェアリードラゴン"),
"メタルハンター": ("トルトリーナ", "さまようよろい"),
}
def materials(name, depth=0):
"""name を作るのに必要な、配合で作れない材料を集める"""
print(" " * depth + name)
if name not in recipes:
return [name]
left, right = recipes[name]
return materials(left, depth + 1) + materials(right, depth + 1)
if __name__ == "__main__":
need = materials("メタルハンター")
print("集める材料:", "、".join(need))
print("配合の回数:", len(need) - 1)
動かすと、メタルハンターから材料までの「木」が、字下げつきで表示されます。最後に、集める材料の一覧が出ます。2体から1体を作るので、この教材のように、毎回2体から1体を作り、手持ちも使わずに最後の1体まで組み立てる場合、配合回数は「材料の数 − 1」になる、という発見も子どもたちと話し合えます。
It's a question for children.
| Scene | Question |
|---|---|
| And I'm going to show you how to do that. | "Who's the parent of Hunter Mech?" |
| And I'm going to show you how to do that. | "The monster on the left and the parent on the right. What's the same as the heads?" |
| So let's go back to our example. | So I'm going to ask you a question. |
| Turn around | 「材料が4つなら、配合は何回?どうしてそうなる?」 |
Rather than give you the answer first, if you allow them to see the diagrams of a paper tree and the indentation of the program, more children will recognize for themselves, "It's the same shape!"
Check the condition of a dead end in a paper diagram
If you're going to start with "Honter Mech" and you're going to go ahead with "Hunger Mech" and you're going to end up with a name that is not defined by the parent in the teaching dictionary like Mecha-Mynah, the branch will stop there. if name not in recipes It'll be easier to find out where he is in charge.
I want to do more.
- 同じ材料が2回出てきたら、数をかぞえる(Pythonの
collections.Counter(use) - We're going to have to do something about it.Synthesis planner(Laughter)
I want to be careful.
In class, when kids focus on the fantasy monsters and create Synthesis recipes, they feel secure in their rights as well.You're here.I'll take care of it.
Ratings
| Stage | You can do this. |
|---|---|
| A | I'm going to use my own idea of Synthesis Recipes as a dictionary to run a program that goes back and forth. |
| B | 用意された辞書に1行足して、結果がどう変わるか説明できる |
| C | It's a very simple process. |
The first child to start programming will learn enough to go back on paper in C. Let's build up the power to "search, organize and convey" the feelings of the game and to "examine" it.
Referenced Atlas Area Article
YouTube Channel
YouTube ChannelTakamasa Suzuki on YouTubeVisit the YouTube channel to explore the videos.Related GMNAVI.JP articles and YouTube videos
- GMNAVI.JP(GMNAVI.JP)
The idea of having to experience repeat and conditional branches in a game. It's a good article with a lecture that teaches distribution. - GMNAVI.JP(To the weapons of the national convention.)
It's a story about how the power of capture to "search, organize, communicate" will lead to the construction of the work. - GMNAVI.JPDQM4 articles on GMNAVI.JP
I've compiled articles on DQM4 other than the blog page. - GMNAVI.JPDraon Quantges (GMNAVI.JP)
This is the entrance to the series, such as Dracue 1.5.7/11, astortia's child's journey, Billers 2.
Continue with our related guide sites
Explore monsters from earlier games
To explore familiar DQM4 monsters in earlier games, open our series guides. Choose a game to continue to its monster locations and recruitment guides.
Browse guides by game Minecraft guidesFor Minecraft players, too
Visit our Minecraft guide site for your crafting and adventure questions. Find help for another game you enjoy alongside DQM4.
Read Minecraft guidesAsk questions on YouTube Community
You can share the combinations you found, team composition, and strategy questions.
Open YouTube CommunityYou promised to use it.
Don't write down names, schools, addresses, etc.