Showing posts with label Nintendo. Show all posts
Showing posts with label Nintendo. Show all posts

Saturday, April 12, 2014

Chess: 3 Weak Squares


This is a game I played with Pure Chess at Scholar level. It's an interesting game, with me totally dominating Black's position. It's the finest game I've played so far. Just don't expect me to repeat this performance anytime soon!

1. e4 c5
2. g3 d5
3. Bg2 dxe4
4. Bxe4 Nf6
5. Bg2 

Oh, dear. 5 moves into the game, and I lost initiative already. There goes my hope for a good game.

5. ... h6
6. Nf3 e6
7. O-O Bd6
8. c3 O-O
9. d4 Nbd7
10. Be3 Ng4
11. Nbd2 Nxe3
12 fxe3 

A natural recapture. I moved a pawn from f file to e file, thus opening up my rook for attack on Black's King.

12. ... Re8?

This is strange. About the only thing I can think of is that Black has no concept of long range planning. By moving his rook there, he's setting up attack on f pawn. Right now, White can't attack that pawn, but after a few exchanges, things will be different!

13. Ne4 Bf8
14. Rf2 f5!

The situation is now clear. Black has no plan to save that pawn for defense after all. Black is using that pawn as an attacker!

15. Ned2 a5
16. Qc2 Ra6
17. Raf1 Qb6
18. Nc4 Qb5
19. Nce5 

A knight here is a very strong position. Notice that no pawn can attack that knight. It's a comfy perch that will make Black's movement difficult. It's also the first attacking piece so far. We are now moving into the middle game.

19. ... Nxe5
20. Nxe5 g5?

You should not voluntarily give up the pawns protecting the King. Just because you don't see anything wrong with the current position, does not mean it won't change in the future!

21. g4?

Ill-advised attack on my part. I failed to calculate the consequences of my gambit of trying to open the f file.

21. ... cxd4
22. exd4 Bg7
23. gxf5 exf5

I look at this position and stared in horror! My King has no pawn protection in view of 3 Black's pawns! About the only salvation is the fact that my pieces are consolidated while Black's pieces are scattered all over the board. If only I can attack on the Queenside while preventing Black to consolidate his pieces over to the King!

24. c4 Qb6
25. Bd5+ Kf8?

An unfortunate move for Black, lining up his King opposing my double Rook!

26. c5 Qf6?

Lining up his Queen to my double Rook?

27. Bxb7 Ra7
28. c6!

Looking at this position, I'm very happy! Black has 3 major problems that he needs to take care of. There are 3 pressure points


  1. The f5 square. Attacked twice, defended twice, defender wins. Attacked 3 times, defended twice, attacker wins.
  2. The d7 square. Possible King-Queen fork by the Knight.
  3. The c5 square. Possible King-Rook fork by the Queen.


Notice that I'm not looking at the position by the pieces. I'm evaluating the position by weak squares. This is not a common view, but I think squares are more important than pieces!

28. ... Rxb7
29. cxb7

Black attempts to solve problem #3 by trading his Rook for my Bishop. This is unfortunate for Black since I now have two attacks: the Bishop, and the b8 square promotion. As we play along, notice how Black's position crumbled rather quickly.

29. ... Be6
30. Rxf5 Bxf5

Black has solved problem #2, but his problem #1 remains.

31. Rxf5 Qxf5
32. Qxf5 Kg8

And now, I see a winning combo. I realize that in order for me to promote the pawn, I need to remove the Rook from the 8th rank. I know just how to do it! We are entering the Endgame phase. Black did not survive for long.

33. Qf7+ Kh7
34. Qg6+ Kh8
35. Qxe8+

And I have the Rook. I wasn't calculating mate, but since all moves are forced, it's a mating combination.

35. ... Kh7
36. Qg6+ Kh8
37. b8=Q+ Bf8
38. Nf7#

Yes! Mated the King in the corner! Notice that Black does not make obvious blunder. About the only inaccuracy that I can see is lack of long-term planning by Black. Overall, a great game that I do not expect to improve any time soon.

Saturday, January 11, 2014

Nintendo Journal #21


Nintendo #21 Mini umbrella




A really compact umbrella. Look how small it is, compared to a quarter! And yet it opens up wide enough to handle rain. Small, lightweight, portable umbrella that you can take "just in case" around town. Good for summer showers. For winter, I have REI Element jacket and doubles as raingear.

Saturday, January 4, 2014

Nintendo Journal #20


Nintendo #20 Water Filter



Water filter. I bought this one with the idea of having one to take around the town. I don't really like it. It seems to work as advertised, but the bite piece is too solid for me. Hard to use, hard to clean. The cartridge filter is easy enough to replace, but properly cleaning the whole thing is a hassle. It basically just sits in the cupboard doing nothing.

Saturday, December 28, 2013

Nintendo Journal #19


Craftsman Drill


I love this tool. I even use it around the house! Install this, install that. This is my first go to tool. It has light, auto tension, and all around a good tool.

Of course, the magazine review makes it only a so-so value. But I really don't care. This one is good enough for me.

Saturday, December 21, 2013

Nintendo Journal #18


Dremel Tool



Dremel tool turns out to be very useful and versatile. On the other hand, unless your craft projects includes sanding and cutting, it has limited usage. I'm going to try and see if I can do some craft projects with it. Mostly trying to make a case with Raspberry Pi, though. We'll see.

Saturday, December 14, 2013

Nintendo Journal #17


Automatic Blood Pressure Monitor



I'm maintaining my blood pressure. So far, I'm keeping 120/80. It has been at that for a long time. However, with good exercise, my recovery rate has improved tremendously. I'm thinking that in order to lower the levels, I must change my diet. Well, I'll have to think about that. Exercise, yes. Diet, less chance of it happening than a snowball in hell!

Saturday, December 7, 2013

Nintendo Journal #16


2 Bird Houses



Just a little something I pick up from Thrift stores. I'm using these as inpirations for craft projects. I had in mind using cardboard for the craft projects, but unfortunately, it petered out. Didn't work.

Oh, well. I'll think of something else. In the meantime, the left open birdhouse is used as pen holder. The right one is perched on top of my bookshelf.

Saturday, November 30, 2013

Nintendo Journal #15


Pull up exercise



Pull up bar, or chin up bar. I've always wanted one, but too cheap to buy one. Until I run into this on a Thrift store. Five bucks. Sold. I've been using it everytime I pass this hallway. Only about three pull ups everytime. I'm doing it not by repetition, but by duration. So, I'd better loading up on protein, because apparently, I'm not as good as I was before.

3 weeks into it, and I notice my upper body shape is solid! So it does work. No miracles, but for five bucks, I'm not complaining!

Saturday, November 23, 2013

Nintendo Journal #14


Digital Picture Frame



On one of my trip to Thrift store, I found this picture frame for cheap. Just a small one. I was hoping to be able to score the display for Raspberry Pi use. No such luck. The whole thing was integrated very well. I couldn't tell what kind of display that is, and the interface. In the end, it is a good digital picture frame. So, I use it as such.

Unfortunately, I don't have a good picture album to display. In the end, I simply download Nintendo 3DS data to a flash card, and stick it into the device. It shows mostly Animal Crossing New Leaf. This here is when I was visiting Morpheel's town. Monocot is the name of the town, but it was only once, a long time ago, and heavy thunderstorm. I remember the storm and Gulliver sleeping on the beach.

Saturday, November 16, 2013

Nintendo Journal 13


Trucker's Mug



There's a Big Man restaurant in Amarillo Texas that serves 72 oz Steak. Somehow I kept thinking of this 64 oz Big Mug to go with it. No comment. A picture is worth a thousand words.

Saturday, November 9, 2013

Nintendo Journal #12


Rubber band exercise



I really miss the old TotalGym. However, trucking life isn't really compatible with it. I tried having this thing with me, and I suppose it's better than nothing, but I don't thing there's enough resistance in it for it to be worthwhile. In the end, I just use body weight as exercise weight.

However, it does fit the niche for out-of-shape people who wants to gently ease into exercise routines. Me? I prefer old-fashioned dumbells.

Friday, November 8, 2013

Petit Computer Journal #24


Transferring Data from Petit Computer to PC

It's no secret that you can save the graphic screen to your SD card. What is the problem is that the data isn't stored flat. It actually is saved in character format, with block-sized groupings at that.

Discostew (of PTC MegaMan 2) wrote an article on the subject and Randomous reposted it here:

http://petitcomputer.wikia.com/wiki/GRP_File_Format_(External)

Well, that's fine and dandy if you want to use a separate program on the PC. What if you don't want to use a separate program on PC? Can you do the conversion right on Petit Computer? Of course. The question is: how difficult is it?

This is just an extremely simple problem. All I have to do is reverse the process, and I'd be done. Except, for some reason, I couldn't get it right. After four tries, and a whole day has gone, this is what I came up with:



  1. ACLS

  2. FN$="G0":'GRAPHIC FILENAME
  3. LOAD "GRP1:"+FN$,FALSE
  4. PNLTYPE "OFF"
  5. WAIT 180

  6. CX=0:CY=0
  7. FOR J=0 TO 2:FOR I=0 TO 3
  8. FOR Y=0 TO 7:FOR X=0 TO 7
  9. FOR YY=0 TO 7:FOR XX=0 TO 7

  10. GPAGE 0,2,2
  11. GPSET (I*64+X*8+XX),(J*64+Y*8+YY),CX
  12. GPAGE 1,3,3
  13. GPSET (I*64+X*8+XX),(J*64+Y*8+YY),CY
  14. CX=(CX+1)%256
  15. IF CX==0 THEN CY=CY+1

  16. NEXT:NEXT
  17. NEXT:NEXT
  18. NEXT:NEXT

  19. WAIT 60

  20. FOR J=0 TO 191:FOR I=0 TO 255
  21. GPAGE 1,2,1
  22. X=GSPOIT(I,J)
  23. GPAGE 1,3,1
  24. Y=GSPOIT(I,J)
  25. GPAGE 1,1,1
  26. C=GSPOIT(I,J)
  27. GPAGE 0,0,0
  28. GPSET X,Y,C
  29. GPAGE 1,1,1
  30. 'GPSET X,Y,0
  31. NEXT:NEXT

  32. WAIT 600


That's a two-step process. First, I load the graphic on the bottom screen, and encode the coordinates on GRP2 for x-coordinates, and GRP3 for y-coordinates. Then I use such coordinates to re-arrange the points on the top screen. You see such convoluted GPAGE commands because I'm switching back and forth among the different pages.

It works, but hardly elegant. The problem is that for some reason, my brain just can't wrap around the problem. Intellectually, I know the problem is a simple referencing problem. A pointer problem, for those of you doing in C programming language. And yet, the answer eludes me.

It's not until I'm at McDonald, getting my StreetPasses, warm and fed, that my brain functions again. Of course, after so many tries to the problem, my brain did start to warm up to the problem.

It was so trivial. I sketched the solution on the back of the receipt, and five minutes later, I was done! Here is what I came up with:


  1. LOAD "GRP1:FILENAME",FALSE
  2. PNLTYPE "OFF"
  3. GOSUB @SCAN
  4. 'SAVE GRP0 here...
  5. END

  6. @SCAN
  7. CX=0:CY=0
  8. FOR J=0 TO 2:FOR I=0 TO 3
  9. FOR Y=0 TO 7:FOR X=0 TO 7
  10. FOR YY=0 TO 7:FOR XX=0 TO 7

  11. GPAGE 1
  12. C=GSPOIT(CX,CY)
  13. GPSET CX,CY,0
  14. GPAGE 0
  15. GPSET (I*64+X*8+XX),(J*64+Y*8+YY),C
  16. CX=(CX+1)%256
  17. IF CX==0 THEN CY=CY+1

  18. NEXT:NEXT
  19. NEXT:NEXT
  20. NEXT:NEXT

  21. RETURN


Quite a big difference, wouldn't you say? I had all the pieces all along, and when I compared the solution on the receipt with my code, I realized that the code had it backwards. All I have to do then is to just switched the direction the coordinates was transfered! That's it.

Well, except it doesn't work, and Discostew pointed out that my latest code did double encoding, and the original "erroneous" code was right to begin with! Oh, well. So read in linear, and output blocks!

That's a reference, or pointer, problem. And guess what? As a programmer, you have to understand the concept of "reference". Like finger pointing to the moon. You look at the moon, instead of the finger. Simple, isn't it? Yet, so many people are confused.

So much so, that people are leaving C programming language for something easier to program. By that, they mean a programming language that does not use pointer. Guess what? The concept of reference is so universal in programming, it exists even in a pointer-less language such as BASIC.

Therefore, I say, you must learn the concept of pointers. If you don't, you just limit yourself to the problems you can solve.

Oh, and about this? I don't know why I was having such troubles. But I did solve it, and that's the important thing. The next time such a problem come up again, I'll be ready.

Saturday, November 2, 2013

Nintendo Journal #11


Halloween Pumpkin Candy Bucket



There's a segment in Jimmy Kimmel where he asked parents to tell their kids that they ate all their Halloween candies. Such a mean trick! The kids are spoiled, too, by the look of it.

As for me, I really did eat all the Halloween candies all by myself. I had bought the whole thing one month early when they first go on sale. Then I eat a package or two or three, every day.

Come Halloween, I had to go out and buy another 2 bags of candies just to fill it up. I also put some protein bar in there, knowing I'll be taking some stuff from it everyday.

Saturday, October 26, 2013

Nintendo Journal 10


Leatherman Blast



Although my daily carry is a Buck folder, I do have other knives. I have several Swiss Army Knife folders. Some models are Camp, Hunter, and several others. I really like these Swiss Army knives. They are sharp, hold their edge, and very convenient to have.

You see a Leatherman Blast next to it. I guess I got in by the hype. There's no question the metal in Leatherman Blast is good. It may even be better than the one in Swiss Army Knife. However, I think they ignore usability issue. Pulling out the blades and other tools are rather painful, and not at all easy. The plier is nice, and the tool selection is fine. However, pulling those tools out is ridiculously hard when compared to Swiss Army Knife.

Am I being spoiled? I don't think so. Gerber makes a good one and it's easy to use. So, for multi-tool needs, I first go to SAK, then Gerber. If it's not convenient, I'd rather not use it.

Saturday, October 19, 2013

Nintendo Journal 9


2 Buck Knives



I have several knives. These two here, I picked up in Indiana knife store. I actually was looking for CRST folder, but I couldn't find it. However, they do have something called a Barlow knife.

Barlow knife is an old design. Supposedly, George Washington carried one. It also makes it into a story book, Huckleberry Finn by Mark Twain, if I remember correctly. So, that's a good old standby. It's a good, compact, all-purpose camping knife.

Another knife is the modern version. This one is non-folding fixed blade. I also have the folder version of it that I carry everywhere. However, for heavy duty camping, this knife is as good as it gets without getting into exotic territory.

Buck knives are good, reasonably price all-around common knives. I actually prefer Buck knives to Case.

Saturday, October 12, 2013

Nintendo Journal 8


TopGun LCD game


I also picked up an old LCD games. TopGun by Konami. It's just a single board game with LCD screen. There's a small speaker on the back. It's amazing how simple these things are. I think games like these are perfect for Petit Computer projects. I will be rustling up a few.

I marvelled at how thin the LCD screen is. It's just a thin plastic, nothing more. I looked at the contacts, and they're sooo tiny! I really doubt that they can align it perfectly, and yet, when I reassembled the device, it works fine!

I don't know how they do it. As simple as it is, that's not something any rookie can do. There must have been some degree of experimentation in order to fit things just right.

Saturday, October 5, 2013

Nintendo Journal #7



LeapPad circuitry



I've been frequenting Thrift stores lately and picking up old electronic stuff. I was hoping to score one of those servos, or maybe screen display. When I see this Leappad, I picked it up.

Sure enough, there is display in there. Except, there isn't a 2 lines into it. Or maybe four. There's quite a bit in there. I really don't know how many are there. Apparently there is a standard called DSI that is common for LED display. I looked at it, and it's too fine for me to handle.

If you know Raspberry Pi camera ribbon cable. That looks just like that. There's also a touchscreen pasted on top of the screen, but I don't think it works, because the program does not respond to touch at all. It does have standard 4 wires that I can handle if need be.



I do notice something: The audio plug is low profile. So I ended up soldering it to my Raspberry Pi!

Sunday, August 11, 2013

Raspberry Pi Journal #4

Video Playback Trouble
OMXPlayer Trouble. MPlayer2 works fine.

So, I was connecting my USB flash drive to Raspberry Pi, and I played some videos I have that I recorded using my Windows 8 camera. The resolution is HD. Omxplayer plays fine as usual, but somehow, there's no sound! That's strange. I looked at the boot configuration, it says hdmi_force=2, which means HDMI output. Furthermore, I believe that I did play the video with sound before.

Putting in -o hdmi didn't work, believe it or not. I was very disappointed. So I tried various options. This works:

omxplayer -r -o hdmi filename

I was so very happy, until it reaches the end of the video, and the whole screen went blank! Uh-oh. Not good. So very not good!

I wasted several hours trying to debug the process. In the end, though, I gave up. It's nice to be able to use hardware decoding, but if in the end I have to shutdown the computer and reboot, then that's not the way I'm going to do it! Maybe there is a command that I can use to reset the display. If so, then I can simply write a script just to make sure the command to reset the display is run after omxplayer finished playing. I don't know such command.

Obviously, I'm not going to use that program ever again.

So, I went to the package directory. I did a search and found mplayer2. Looks good. The package seems to be rather well-developed. So it's pretty simple to just download the whole package.

sudo apt-get install mplayer2

Curiously, when I did a which mplayer2, I came up blank. So, I did which mplayer. Bingo! There it is! Obviously, there'd be a conflict if I ever install mplayer, instead of mplayer2. Will have to be careful in the future.

Then I ran some test videos.

  • Nintendo 3DS video: Ran fine, no problem.
  • Flip Videos: Ran fine, no problem. Can do Full Screen. 50% CPU
  • WIndows 8: Ran slow. Out of sync. 100% CPU

None of the videos ran smooth, BTW. I had to use -framedrop option to run it. I was extremely disappointed that the Windows videos can't be shown. I'll have to make sure to record in low resolution mode from now on. Or, I can simply use my Nintendo 3DS to record the video. It ran just fine!

Here's the screen capture of the video in action:

Not bad for a windowed application that does not take over the whole screen. Unlike omxplayer, I may add. So, I'm happy for now.


EDIT:
Finally figured out the command to refresh the screen. There is a couple seconds delay at the end, but at least I get my screen back! I ended up making a script called "omxplay", do a chmod 755 and put it in /bin

#!/bin/bash
omxplay -o hdmi -r "$1"
fbset -depth 8 && fbset -depth 16




Sunday, August 4, 2013

Petit Computer Journal #1

Petit Computer Journal#1

What is Petit Computer?

If you have been following Nintendo DSi development, then you'd know that SmileBoom has developed a downloadable computer program called Petit Computer. This is a development environment to create your own games on Nintendo DSi using BASIC. The idea is that you will write your own programs, and instead of buying other people software, you just write your own program. It's that easy! No more useless junk!

Why would you want to do that? In the beginning of computer history, there was simply no computer program available. You can either hire expensive professionals, or write your own program. Most people who grew up with early Personal Computer would write their own program. There are old magazines that tells people how to program their computer.

Later in the development of personal computer, softwares have become very complicated. Programming a computer is no longer within the realm of hobbyist computer. I still remember the disbelief that a C development system is 4 Gigabytes. Just how complicated can writing a computer program be? Very, very complicated!

And yet, most people do not need complicated programs. It does not take a rocket scientist to write a simple Blackjack program. Or create a maze. Or word search program. I did Sudoku program in one afternoon.

You don't need ridiculous amount of education in other to write useful program. You don't even need to write one. You can simply read what other people have done, and run their program on your Nintendo DS.

In short, Petit Computer is what Nintendo DSi homebrew, had it officially be done by Nintendo. Notice I said Nintendo DSi. That's because even though it's billed to be compatible with Nintendo 3DS, it doesn't take advantage of that platform. You can of course use Nintendo 3DS to run the program, but it's not necessary. If you don't have the device yet, I suggest the XL version. You won't have to squint at the small screen, and you can actually tap the keys with your fingernails, instead of stylus.

What's the difference between this and other BASIC?

SmileBasic, the BASIC language of Petit Computer, is very different from other BASIC languages. Most people are probably familiar with MS QBasic. Well, the difference between the two is that if you put this command "A=10:A=A/10:PRINT A" into Petit Computer, you'd get a "1". With QBasic, you'd get a "10".

Haha, joking aside, there is quite a big difference with the other BASIC. For one thing, this version of BASIC is very primitive when it comes to program structures. There is only FOR-NEXT loop. There is no such thing as WHILE-WEND, REPEAT-UNTIL, SWITCH-CASE. Rumor has it, you can't even GOTO out of the FOR-NEXT loop because you will corrupt the stack. That is strange. I will need to check for that. I think what happens is that the stack will run out because you cannot nest loops too deep.

Another difference is that SmileBasic is heavily tied into the Nintendo DSi hardware. This means sprites, background pictures, music synthesizers. Very powerful capabilities that is available for your use. You can easily make a Mario level game. Really.

The flip side to it is that if you aspire to make "modern" program such as the ones made by Visual Basic, then you are out of luck. This style of BASIC is old-style. Looking at the keywords of the language, I can't help to think that maybe this version isn't too friendly for beginners. Too much closely resembling Assembly Language/Machine Language. And you know what they say about Machine Language. If you cannot think in terms of Hexadecimal, then you may as well give up.

How hard is it to program a computer?

Paraphrasing an old joke:
Typing the program: $10.
Knowing what to type: $9990.

Computer programming is one of the easiest, if not the easiest job around. The qualification of that is IF YOU KNOW WHAT YOU'RE DOING. Do people know what they're doing? Surprisingly enough, no.

That's actually normal. Unless you're doing routine database programming, you probably will have to dissect the problem enough to come up with a solution. The problem you're solving is unique because if it's a common problem, then other people would have solved it already. Therefore, your problem solving skill must be top-notch.

The good news is, as a beginner, you don't have to be an expert solver. You're just starting out! By definition, other people have trodden the path before you, and you are going through familiar territory. If you get stuck anywhere, a simple question to the appropriate forum will suffice to get you going. There are plenty of tutorials on the Net. I plan to make some myself.

Do you need to be good at Math? No, you don't. I know I'm bucking the convention here, but we're talking about hobbyist computer programming. If you can balance your checkbook, then you can write computer program. If you know how to use spreadsheet program. You definitely have all the skills required. Higher level math is only necessary if you aspire to be a software ENGINEER. For hobbyist level, the most important skill needed is "Show and Tell". Really.


Should I really do this?

Why would you spend your time writing computer program on a very primitive system when you can have the world given to you by the latest and greatest in computer programming technology? How about Python? Ruby? Aren't they so great? Yes, they are, if you want to be productive.

If, however, you want to have fun and make games on Nintendo DSi, then this is the system to use! Not despite it being primitive, but because of it. Remember that old style 8 bit Apple, Atari, Commodore computer are rather primitive, and those computers were very useful. It doesn't take much to write useful programs.

I regularly write programs in Small Basic because it's fun. I will write programs in Smile Basic because it's fun. Remember: computer programming is easy, IF you know what you're doing. So the trick is, to first learn what you need to know in order to write the program, then write the program. By then, it'd be easy.

This is especially true with drag and drop programming. Let's take, for example, Macromedia Director. It's a very powerful platform, to be sure. But do you really learn how to program? Or do you learn to do use the package? Take away Director, and given Basic, can you replicate what you did with Director? Doubt it. Take away Basic, can you replicate what you did with Director? In my case, it took only 2 days, including learning the Director!

I hope I have convinced you to do this. If not, well, there's always Small Basic. :)