Sunday, July 27, 2014

Green Lakes

Traveling at  home...is Oregon home still?...

 
With Janet's sister Judy, her boyfriend Pete, her mom Mary and the dog, we headed up to Green Lake on the back side of south Sister.
Oregon smells like fresh pine and cleanliness.

I don't think the pictures need any explanation, enjoy the scenery.

 
 

 

 

 

 


 


 

 

 

Finished up the day at the Cowboy Dinner Tree.


Friday, July 18, 2014

Minecraft and Python

The last week of school I brought in a Raspberry Pi with the Minecraft Pi version that comes with its own API to program with Python.  I'll talk about the school/learnin' we did and then explain how we did it.

If you are not familiar with Minecraft, it is a game and a creative world.  For the Pi version it is just creative mode in a small (-127 to 127 dimensions) world.

The link above is for the education version of Minecraft (a different version) but if you are going to take 5 minutes to learn about Minecraft, you will want to learn about this version unless you want to dive into the actual game.

Within the Minecraft world you build with 1x1x1 blocks to create anything you want.  Using Scratch, my fifth graders had learned about X/Y graphs with negative numbers.  Adding Z space to this was a whole lot more interesting and confusing (also, a bit above grade level...which is a sentiment I don't always agree with).

To introduce the concept I constructed some paper cubes and drew the graph on two large pieces of art paper, X & Z as the base with Y drawn on the second piece of paper, propped up perpendicular to the X, Z page.

At this point we jumped into some basic designs.  With the API that comes with Minecraft Pi you construct a cube or cuboid by setting the opposite corner points.  It does a lot more, but we focused on the geometry.
From the center of the world (X,Y,Z format) (0,0,0) to (5,5,5) will give you a cube that is 5 wide, 5 long and 5 deep and a solid block.


Don't use VNC, rather work with the Pi plugged into a monitor.
I've shot some pictures of the TV to show this:


(Using VNC I get only a black screen where Minecraft is so I couldn't take any screen shots except ones to show the error)
 This is from my laptop screen shot.


So from here on out, the picture and video quality is crummy, I shot an HDTV with my phone while I used the mini-keyboard so sorry for the shakyness.



Now thinking through a 3D design is an easy first step: Build a big block

<-- This one floats so the kids could see that it was a full cube, not just resting on the ground.

(I missed the picture of the floating block but you can see it briefly in the videos below)

Then it gets interesting.  Fill a big cube with a slightly smaller cube of type 'air'.  This gives you a hollow cube.  It just gets better from here; where will you place your windows and make sure that you are cutting out 'air' holes that fit with your initial cube.  Will you make a fence around everything by laying down four lines or a large-flat cube of fence which is then filled with a smaller-flat cube of air?

The kids took their designs home and planned out their models, they spent hours on this for a few nights (none of this was homework, it was originally just to explore X,Y,Z space and have fun).
They brought in their pages that looked like this:


16,0,16,30,5,30,4    <-- their plans were lists like this
(X  ,Y,Z,  X2, Y2, Z2, blocktype)   <-- this is what the numbers mean

the x2, y2, z2 represent the opposite corner of the cuboid.  The above block would be 14units wide, 4 units tall and 14 units deep/long and made of granite?(4)

I had typed in each line at first like this: mc.setBlocks(16,0,16,30,5,30,4) which will set a nice cube.  After showing the class how this worked I quickly switched to using the proper variables.  Most of the class was comfortable with variable data from Scratch and they were gaining confidence with using ideas like X+5 within the plans. Again, this is above grade level, but it was embraced by the students and they were able to do it.  Gaining confidence, they weren't quite comfortable with all aspects of variables representing numbers, but they will certainly be ready for these concepts when they pop up in math in middle school.

The first thing to do is to clear your world
 


...and if you are like me, you spend your lunch break adding your name to the clear function so it always pops up in your world.  


A 'clear' script is very very useful when you are throwing kids scripts at Minecraft one after another.  
The first two lines get everything rolling.  The fourth clears everything  by putting a 0 'air' block everywhere and the fifth line rebuilds the ground.  The comments on line seven show the letters.

Here is the script:
import mcpi.minecraft as minecraft
mc = minecraft.Minecraft.create()

mc.setBlocks(-127, 0, -127, 127, 30, 127, 0)
mc.setBlocks(-127, 0, -127, 127, 1, 127, 2)

#j
mc.setBlocks(3,3,0,3,5,0,4)
mc.setBlock(4,3,0,4)
mc.setBlocks(5,3,0,5,10,0,4)
#e
mc.setBlocks(7,3,0,7,10,0,4)
mc.setBlocks(7,3,0,10,3,0,4)
mc.setBlocks(7,6,0,9,6,0,4)
mc.setBlocks(7,10,0,10,10,0,4)
#f
mc.setBlocks(12,3,0,12,10,0,4)
mc.setBlocks(12,6,0,14,6,0,4)
mc.setBlocks(12,10,0,16,10,0,4)

#f
mc.setBlocks(18,3,0,18,10,0,4)
mc.setBlocks(18,6,0,20,6,0,4)
mc.setBlocks(18,10,0,22,10,0,4)


I did very little correcting of the student's plans.  Rather, I entered in all of their plans (coordinates) and then let them walk around their creations and find where their bugs were.  Mostly the attempts at doors and windows were off at first and the kids had to renegotiate their X or Z positions to get everything in the right spot.

Here is one of the kids scripts that got a little more complete and interesting.
import mcpi.minecraft as minecraft
mc = minecraft.Minecraft.create()
mc.setBlocks(-80,-2,-80,120,55,120,0)
mc.setBlocks(-80,-2,-80,120,0,120,2)
x1 =0
y1 =0
z1 =0

x2 =105
y2 =2
z2 =105

bt = 85  
mc.setBlocks(x1,y1,z1,x2,y2,z2,bt)

x1 =1
y1 =0
z1 =1

x2 =104
y2 =2
z2 =104

bt = 0  
mc.setBlocks(x1,y1,z1,x2,y2,z2,bt)


x1 =2
y1 =0
z1 =2

x2 =25
y2 =10
z2 =25

bt = 57
mc.setBlocks(x1,y1,z1,x2,y2,z2,bt)

x1 =3
y1 =0
z1 =3

x2 =24
y2 =9
z2 =24

bt = 89  
mc.setBlocks(x1,y1,z1,x2,y2,z2,bt)


x1 =4
y1 =0
z1 =4

x2 =23
y2 =8
z2 =23

bt = 0  
mc.setBlocks(x1,y1,z1,x2,y2,z2,bt)


x1 =2
y1 =0
z1 =2

x2 =4
y2 =4
z2 =4

bt = 0  
mc.setBlocks(x1,y1,z1,x2,y2,z2,bt)

mc.setBlock(7,4,3,50)
mc.setBlock(20,4,20,50)
mc.setBlock(19,1,19,89)

x1 =2
y1 =11
z1 =2

x2 =25
y2 =21
z2 =25

bt = 78  
mc.setBlocks(x1,y1,z1,x2,y2,z2,bt)


x1 =30
y1 =-10
z1 =0

x2 =49
y2 =0
z2 =34

bt = 49  
mc.setBlocks(x1,y1,z1,x2,y2,z2,bt)

x1 =31
y1 =-9
z1 =1

x2 =48
y2 =0
z2 =33

bt = 8  
mc.setBlocks(x1,y1,z1,x2,y2,z2,bt)

mc.setBlock(35,-1,2,53)
mc.setBlock(35,-2,3,53)
mc.setBlock(35,-3,4,53)
mc.setBlock(35,-4,5,53)
mc.setBlock(35,-5,6,53)

This was about everything we had time to do.  I did show them how functions and loops work just for fun and we built this:


Change one parameter and you get a whole new set of houses.



import mcpi.minecraft as minecraft
mc = minecraft.Minecraft.create()
import time
#clear land
mc.setBlocks(-120,0,-120,50,50,50,0)
#Build ground
mc.setBlocks(0,-1,0,50,-1,50,1)

def house(x,y,z,bt,rt):
#walls
mc.setBlocks(x,y,z,x+4,y+10,z+10, bt)
xr=x-1
yr=y+11
zr =z-1
xr2 = x+5
zr2 = z+1
#hollowroom
mc.setBlocks(x+1,y+1,z+1,x+3,y+9,z+9,0)
#door
mc.setBlocks(x+2,y,z,x+3,y+2,z,0)
#roof
c=0
while c<5:
mc.setBlocks(xr,yr,zr,xr2,yr,zr2, rt)
yr+=1
xr+=1
xr2-=1
zr+=1
zr2-=1
c+=1

xr=x-2
yr=y+5
zr =z+2
xr2 = x+5
zr2 = z+5
c=0
#while c<5:
# mc.setBlocks(xr,yr,zr,xr2,yr,zr2, 0)
# yr+=1
# xr+=1
# xr2-=1
# zr+=1
# zr2-=1
# c+=1
def rowhouses(x,y,z,bt,rt):
c=0
while c < 12:
house(x,y,z,bt,rt)
x+=10
time.sleep(5)
c+=1

rowhouses(0,0,0,4,2)

The sleep function allowed us to watch things happen in real time in the game.  It was much more powerful in explaining the concept than anything else I had tried.

Where should you get started?

Thursday, July 17, 2014

Halong, Sapa, Hoi an, and a nap.


Over our spring break my mom and Aunt Linda joined us for a quick run around of Vietnam.  Handspan tours took care of Halong bay and Sapa, Janet organized all of it including a trip to Hoi An.  Everything went smoothly.


They came straight from the airport to school and jumped right into teaching art and singing with the kids.  We took the three hour bus to Halong Bay the next morning and everything was much more organized than our previous bus to Hai Phung to go out to Cat Ba island (same basic trip we took a few months prior).




We started with a 2 day cruise in Halong Bay. The boat was lovely, food was really good.











Seen enough pictures of rocks shooting out of the water?  Of course not.






Some early morning tai-chi on the deck led by one of the chefs.  The boat had about 10 rooms, very nice ones.   Food was fantastic and we met a few of the 15 or so other people on the boat.
 We kayaked around, did some swimming while the crew watched for jelly fish.   We saw quite a few while kayaking and had to avoid a few while swimming.




 This guy is taking out the ovaries in oysters and replacing them with a small bead to farm pearls.

We took the bus back to Hanoi, grabbed dinner then jumped on the train to Sapa.
Somehow I don't have pictures to post of the train.  It was an overnight sleeper with four beds per cabin.  A mix of noisy and rattly and over all not to bad.

We got to Sapa, took a bus up to the hotel and were hiking an hour later.  I had imagined a lot more of a jungle trek, but it was mostly on dirty paths, through a few rice patties and over a creek or two.  A bit of uphill and downhill and totally worth it!




 Some of the local ladies joined us and chatted with us along the way, giving a bit of help when it was needed and we bought a few nice things from them before they walked back to their villages.










Linda showed all the kids the pictures she took of them and it was obvious that they were familiar with digital cameras (no not the infant, but the youngsters in the pictures below).

















Our guide, Tuan, showed us rice at the various stages of growth.

We got to see the mishmash of Disney inspired art that decorated the school.
























Yes, I do love the panoramic effect on Google photos.





Indigo leaves, when you mash them up you get....indigo colored juice that you can use as dye.











We took the train back to Hanoi then flew down to Hoi An.  Janet managed to pack 3 weeks of trips into 2.

Hoi An



My mother in a cooking class is good to see, maybe the microwave will see less use in her home.





The food was delicious, we went to the local markets, which was interesting as we were with other tourists, but it was the same type of market that we shop at in Hanoi so I got to watch the other people react to the stalls.  We took a boat trip down the river and to the cooking school.  Our teacher was a perfect balance of a sassy grandma, great cook and she was quick to snap you with chopsticks while laughing.  Lots fun and the food was great.

This was our last trip in Vietnam.  Stay tuned for our new adventures in Lahore, Pakistan starting in August.