Muutke küpsiste eelistusi

Coding with Minecraft: Build Taller, Farm Faster, Mine Deeper, and Automate the Boring Stuff [Pehme köide]

  • Formaat: Paperback / softback, 256 pages, kõrgus x laius: 295x175 mm, 1 Illustrations
  • Ilmumisaeg: 29-May-2018
  • Kirjastus: No Starch Press,US
  • ISBN-10: 1593278535
  • ISBN-13: 9781593278533
  • Formaat: Paperback / softback, 256 pages, kõrgus x laius: 295x175 mm, 1 Illustrations
  • Ilmumisaeg: 29-May-2018
  • Kirjastus: No Starch Press,US
  • ISBN-10: 1593278535
  • ISBN-13: 9781593278533
A hands-on introduction to coding that teaches you how to program bots to do cool things in the game you love--Minecraft! This book takes the robotic "turtle" method, and extends it to the 3D, interactive world of Minecraft.

Automate the Minecraft Stuff will transform Minecraft from a mere video game into an educational programming tool. Using ComputerCraft, a free Minecraft mod, and the Lua programming language (used by professional game developers), you'll write programs to make your bots dig mines, chop wood, craft items, and build anything you can imagine. Sit back, relax, and make your turtle army do the work! The book provides the full code needed to write each program and walks you through it line by line, explaining how things work along the way. By book's end, you'll have a handle on computer science basics, a taste of how fun and powerful coding can be, and plenty of turtle robots at your command.

Arvustused

While Coding with Minecraft is an educational book, it is also a delightful read...a must for anyone who has any interest in Minecraft. Gaming INTEL

"If you have children interested in coding who also love Minecraft, I believe this would be a great book to invest in." The Old Schoolhouse

Muu info

A hands-on introduction to coding that teaches you how to program bots to do cool things in the game you love--Minecraft! This book takes the robotic "turtle" method, and extends it to the 3D, interactive world of Minecraft.
Acknowledgments xv
Introduction xvii
What Are Minecraft Mods?
xviii
What Is ComputerCraft?
xviii
How to Use This Book
xix
What&aposs in This Book?
xix
Getting Help
xx
Online Resources
xxi
What You Learned
xxi
1 Getting Started With Computercraft 1(8)
Installing Minecraft, ATLauncher, and ComputerCraft
1(4)
Buying Minecraft Online
2(1)
Downloading and Installing ATLauncher
2(2)
Downloading and Installing ComputerCraft
4(1)
Running Minecraft
5(2)
Creating a New World
6(1)
Minecraft Game Mode Differences
6(1)
What You Learned
7(2)
2 Programming Basics 9(18)
Getting Started with Turtles
9(8)
Crafting a Mining Turtle
10(2)
Running Programs in the Turtle GUI
12(2)
Fueling the Turtle
14(2)
Moving the Turtle
16(1)
Getting Started with Lua Programming
17(3)
Running the Lua Shell
17(2)
Goodbye Lua: Exiting Lua&aposs Prompt
19(1)
Letting Lua Do the Math
20(3)
Order of Operations
21(1)
That&aposs So Random: Generating Random Numbers
22(1)
Storing Values with Variables
23(2)
Checking the Turtle&aposs Fuel Levels
25(1)
What You Learned
26(1)
3 Talking To Your Turtle 27(8)
Teaching Your Turtle to Say Hello!
28(2)
Running the hello Program
29(1)
Listing All Files with the Is Command
30(1)
Displaying Text with the print() Function
30(2)
The String Data Type
31(1)
Stringing Strings Together with Concatenation
31(1)
Retrieving Turtle Names
32(1)
Getting Keyboard Input with the io.read() Function
33(1)
Bonus Activity: Proper Introductions
33(1)
Giving Text a Typewriter Effect
33(1)
Changing Turtle Names
33(1)
Bonus Activity: A Turtle by Any Other Name
34(1)
What You Learned
34(1)
4 Programming Turtles To Dance 35(12)
Writing a Dance Program
36(1)
Running the mydance Program
37(1)
Using Comments in Your Code
38(1)
Turtle Movement Functions
38(1)
Experimenting with Moving the Turtle
39(1)
Looping with for Loops
40(1)
Taking the Turtle for a Spin
41(1)
Doing a Little Hop
42(1)
Bonus Activity: New Dance Moves
42(1)
Sharing and Downloading Programs Online
42(3)
Deleting Files Off the Turtle
43(1)
pastebin.com Limitations
44(1)
turtleappstore.com
44(11)
Bonus Activity: Maze Runner
44(1)
What You Learned
45(2)
5 Making A Better Dancer 47(12)
Writing a Better Dance Program
47(2)
Running the mydance2 Program
49(1)
The Boolean Data Type
49(1)
The nil Data Type
50(1)
Looping with while Loops
50(1)
Making Decisions with if Statements
51(1)
Comparing Two Values with Comparison Operators
52(2)
Making Alternate Decisions with elseif Statements
54(1)
Nested Code Blocks
54(1)
Making a Decision...or Else!
55(3)
Moving Up and Down
56(1)
Spinning All Around
57(7)
Bonus Activity: Watchturtle
58(1)
What You Learned
58(1)
6 Programming A Robot Lumberjack 59(12)
Equipping Turtles with Tools
60(1)
Designing a Tree-Chopping Algorithm
61(1)
Writing the choptree Program
62(1)
Running the choptree Program
63(1)
Detecting Blocks with the Turtle Detection Functions
64(4)
The not Boolean Operator
64(1)
The and Boolean Operator
65(1)
The or Boolean Operator
66(2)
Terminating Programs with the error() Function
68(1)
Mining Blocks with the Turtle Digging Functions
68(1)
Comparing Blocks with the Turtle Comparison Functions
69(1)
Returning to the Ground
69(1)
Startup Programs and the shell.run() Function
70(1)
Bonus Activity: Going Down
70(1)
What You Learned
70(1)
7 Creating Modules To Reuse Your Code 71(14)
Creating Functions with the function Statement
72(3)
Arguments and Parameters
73(1)
Return Values
74(1)
Making a Module of Functions
75(3)
Loading a Module with the os.loadAPI() Function
76(1)
Experimenting with the hare Module
76(2)
Looking at the Turtle&aposs Inventory
78(3)
Selecting an Inventory Slot
79(1)
Counting the Number of Items in a Slot
79(1)
Getting Item Details from a Slot
80(1)
The Table Data Type
80(1)
Examining the Table Returned by the turtle.getItemDetail() Function
81(1)
Global and Local Scope
81(1)
Finding an Item with a for Loop
82(1)
Selecting an Empty Inventory Slot
83(1)
Bonus Activity: Dance Move Module
83(1)
What You Learned
84(1)
8 Running An Automated Tree Farm 85(14)
Designing a Tree-Farming Program
86(1)
Writing the farmtrees Program
87(1)
Running the farmtrees Program
88(1)
Tree Types in Minecraft
89(1)
Chunk Loading in Minecraft
90(1)
Loading Modules with the os.loadAPI() Function
90(1)
Checking for Files with the fs.exists() Function
91(1)
Selecting Saplings in the Turtle&aposs Inventory
91(3)
Planting a Tree
91(1)
Inspecting Blocks and Waiting for the Tree to Grow
92(2)
Breaking Out of Loops with break Statements
94(1)
Running Other Programs with the shell.run() Function
94(1)
Handling Items with the Turtle&aposs Drop Functions
94(2)
Rewriting Your Code for When You Have No Bone Meal
96(1)
Bonus Activity: Lone Turtle Farmer
96(1)
What You Learned
97(2)
9 Building A Cobblestone Generator 99(14)
Blueprints for the Cobblestone Generator
100(1)
Setting Up Furnaces for Smelting the Cobblestone
101(1)
Writing the cobminer Program
102(1)
Running the cobminer Program
103(1)
Setting Up Your Program and Making a Constant Variable
103(1)
Mining the Cobblestone from the Generator
104(1)
Interacting with Furnaces
105(5)
Making Code Readable with Constants
106(1)
Dropping the Cobblestone into the Furnaces
106(1)
Rounding Numbers with the math.floor() and math.ceil() Functions
107(1)
Calculating the Cobblestone to Distribute in Each Furnace
108(2)
Moving the Cobblestone Miner Back into Position
110(1)
Bonus Activity: Cobble Together More Cobblestone Furnaces
110(1)
What You Learned
111(2)
10 Making A Stone Brick Factory 113(14)
Designing a Program to Craft Stone Bricks
114(1)
Crafting a Crafty Turtle
114(2)
Writing the brickcrafter Program
116(2)
Running the brickcrafter Program
118(1)
Setup for the brickcrafter Program
119(1)
Checking the Turtle&aposs Fuel
119(1)
Collecting Stone from the Furnaces
120(1)
Crafting Stone Bricks
121(1)
Moving the Turtle Back into Position
122(1)
Bonus Activity: Cake Factory
123(1)
Creating a Factory Building
123(2)
What You Learned
125(2)
11 Constructing Walls 127(16)
Extending the hare Module
128(9)
Counting Inventory Items with countInventory()
130(1)
Selecting and Placing a Block
130(1)
Designing a Wall-Building Algorithm
131(3)
Writing the buildWall() Function
134(3)
Writing and Running the buildwall Program
137(1)
Loading the hare Module
138(1)
Using the Array Data Type
138(1)
Reading Command Line Arguments
139(1)
Creating Usage Messages
139(1)
Calling hare.buildWall() to Build a Wall
140(1)
Bonus Activity: mylabel Program with Command Line Arguments
141(1)
What You Learned
141(2)
12 Constructing Rooms 143(10)
Designing a Room-Building Algorithm
144(1)
Extending the hare Module
145(1)
Calculating the Total Number of Blocks Needed to Build a Room
146(1)
Writing the buildRoom() Function
147(2)
Writing the buildroom Program
149(1)
Running the buildroom Program
150(1)
Bonus Activity: Plus-Shaped Rooms
151(1)
What You Learned
151(2)
13 Constructing Floors 153(20)
Designing the Sweeping Algorithm
154(4)
Building the Floor
155(2)
Returning to the Starting Position
157(1)
Passing Functions to Functions
158(2)
Extending the hare Module
160(1)
Calling the sweepFunc() Function
161(4)
Moving Along the Rows and Columns
162(1)
Figuring Out If a Number Is Even or Odd with the Modulus Operator
163(1)
The Even-Width and Odd-Width Paths
164(1)
Writing the buildFloor() Function
165(1)
Writing the buildfloor Program
165(1)
Running the buildfloor Program
166(1)
Creating a Patterned Floor
166(5)
Writing the buildcheckerboard Program
167(1)
Running the buildcheckerboard Program
168(1)
Writing the placeCheckerboard() Function
169(1)
Calling the sweepField() Function
170(11)
Bonus Activity: Different-Colored Checkerboards
171(1)
What You Learned
171(2)
14 Programming A Robotic Farm 173(18)
Setting Up a Wheat Field
174(1)
Designing the Wheat-Farming Algorithm
175(1)
Extending the hare Module
176(1)
Writing the farmwheat Program
177(2)
Running the farmwheat Program
179(1)
Setup for the farmwheat Program
180(1)
Writing Functions to Use in the Main Program
181(3)
Checking the Crop
181(1)
Planting Seeds
182(1)
Storing Wheat
183(1)
Farming with a Loop
184(2)
Bonus Activity: Giant Wheat Fields
186(1)
Tips for Automating Other Kinds of Farming
186(4)
Farming Vegetables
186(1)
Milking Cows and Shearing Sheep
187(1)
Gathering Chicken Eggs
188(1)
Farming Cacti and Sugar Cane
189(1)
What You Learned
190(1)
15 Programming A Staircase Miner 191(18)
Designing the Stair-Mining Algorithm
193(4)
Extending the hare Module
197(1)
Writing the digUntilClear() and digUpUntilClear() Functions
198(1)
Writing the stairminer Program
199(1)
Running the stairminer Program
200(1)
Setup for the stairminer Program
201(1)
Creating the First Stair Step
201(1)
Mining Downward
202(2)
Checking the Turtle&aposs Fuel
204(2)
Checking the Turtle&aposs Inventory
206(1)
Mining Upward
206(1)
Bonus Activity: Tall Tunnel
207(1)
What You Learned
207(2)
Function Reference 209(8)
fs (File System) API
210(1)
hare API
210(1)
io (Input/Output) API
211(1)
math API
211(1)
os (Operating System) API
211(1)
shell API
212(1)
string API
212(1)
textutils API
212(1)
turtle API
212(4)
Building Functions
213(1)
Fueling Functions
213(1)
Inventory Functions
214(1)
Movement Functions
215(1)
Perception Functions
215(1)
Tool-Related Functions
216(1)
Lua Functions
216(1)
Name ID Reference 217(10)
Finding a Block&aposs Name ID
217(1)
Distinguishing Between Blocks That Share Name IDs
218(1)
List of Block Name IDs
219(8)
Index 227
Al Sweigart is a professional software developer who teaches programming to kids and adults. Sweigart has written several bestselling programming books for beginners, including Automate the Boring Stuff with Python, Invent Your Own Computer Games with Python, and Cracking Codes with Python (all from No Starch Press).