Processing math: 100%

Sunday, December 18, 2016

Recursive Additive Manufacturing - RAMat

Noticed there's only 1 hit on google for "recursive additive manufacturing" and it seems unrelated. So, until I put together a detailed write-up, it's here online first.
- Wayne H Nixalo

Thursday, February 4, 2016

CS Course Day 66

CS Course Day 66

6.00.1x Problem Set 2:
6.00.1x Problem Set 3:
CS106A PSet 6:
CS106A Asn 5: Yahtzee.java:


03-Feb-2016 11:29

Working on CS106A Assignment 5: Yahtzee

Assignment page can be found here: 

A very helpful video tutorial if you find yourself stuck:

I got the first part of the program working. I used a tutorial video (Hack Your Knowledge) after brainstorming for a couple hours on part 1 to help speed myself along. You can call it "trying to optimize the learning process" or just being lazy, anyway I'm on the clock. But it's pointless if I'm not learning; so after paying attention on the logic of what was being said, I went back and erased methods to see if I could create them on my own. It worked.

I'm at the stage of a Yahtzee game where a player selects a scoring category - this is after every turn which is 3 rolls of the dice. After category selection, the computer checks if the category is valid. If so, the score is added to the scoresheet, which is a 2-Dimensional Array (so you're specifying the right 'box' to assign the score to). A couple questions I have here are: if the player selects an invalid category what happens? Does the game give them no points and continue on (wasting a turn for the player)? or does it prompt and let them pick again? The 2nd sounds more logical.

I don't know the game of Yahtzee well either: can a player replace an old score of a certain category with a better one? But there're 13 rounds so each round has to fill something.. that would imply No. And if they rolled something that only fit the "Chance" (any combo) category multiple times? Well then it seems logical that you wouldn't get a Full House or a Large Straight every single game.. so yeah you're going to have empty scores.. which, if you're adding them up at the end: either skip a score if it's empty ( scoreSheet[x][y] == null ) or assign zero to all.

03-Feb-2016 11:40

Ah okay, the player must select a score category, and if it's not valid, they just score 0 in that category. That makes totaling scores simpler. So selection is  matter of using the appropriate call to the YahtzeeDisplay class that's provided.

03-Feb-2016 12:00

It looks like I'll have to create a switch to retrieve scores based on category number.

03-Feb-2016 12:58

Here's a note of interest: leave complexity where it needs to be. I'm trying to write conditions for the different scoring categories. This is easy for the 'Upper' scores: just add the dice of a specific number. It's complicated for the 'Lower' scores: Three & Four of a Kind, Full House, etc. So what to do? Well the method I'm writing to calculate category score is concerned with exactly that. Figuring out the implementation of special cases (how to check for three of a kind for example) is beyond it's theoretical purview, if I may. That is another level deeper into the program. This reminds me of an SICP lecture by Gerald Sussman (.. or was it Abelson?) where he talked about treating a program's structure as successive layers of language that describe things in a certain level of detail appropriate to the general goal of that level. Maybe I'm wrong but I think I'm seeing that here.

Importance: I could very well just figure out some way to force through the algorithm and make it all fit inside the calcCatScore() method, but I'd be doing what those MIT professors warned of: building a machine of intricate parts that each accomplish a discrete task, break any and everything built on it crashes. Doesn't matter much now, and the computer may not care, but in the future I and my future employees will be glad to have a common line of sense running through any set of code. I guess that's the Computer Science side of things.

All good engineering is built on wishful thinking - G. Sussman.

04-Feb-2016 12:57

Finished debugging Yahtzee. Took a few rounds of testing. There were two issues: First the score returned to the display was off by 1. The index used for the dice is the same as the int value for the variable constants of their faces, but they're zero-indexed. For the proper score you need to add 1 to it. Secondly there was a logic error: when checking the arraylist of dice faces, if you check only for equality you will disregard cases where more dice than necessary fulfill a given criteria. So if you need say, 1-2-3-4 in order, but you have more than one of any, your score will be zero, which is wrong. So you check that the index of the arraylist of dice is greater or equal to one. That's it.

A very professional and media savvy photo of the final product below:



Tuesday, January 26, 2016

CSC Day 57 Update - Time time tiiiime

CSC - Day 57

6.00.1x Problem Set 1:
SICP ex 3.03 3.04 3.07:

Progress is never fast enough but a new side job makes the time I do have all the more valuable. I had a quick succession of good things happen, and if anything the path ahead's clearer now. It's a bit obvious I'm not hitting that 9-week deadline - nor was it ever physically possible - if it takes 10, so be it, once I'm done I assess how much time things take, what I did right, wrong, and wait for my ego to resurrect itself (doesn't take long).

SICP/CS61A - Structure & Interpretation of Computer Programs is at Lecture 23/44 & p341 (ch 3.4) - past the halfway point; and CS106A Programming Methodology is Lec 19/28, PSET 6 of 7, Assignment 6 of 7 - so.. getting there. I'm making sure I don't fall behind on 6.00.1x - so that I can get the certificate; Circuits & Electronics is the next priority and Calc I at the end.

Unfortunately I'm not quite philosophical right now - though I'm writing thoughts down for future posts, but today's part of that report-every-3-days commitment. And I figure I should wait more than 1 day of training to complain and wax-philosophic about low-tier work in America. It's more motivation to be serious w/ the study and get into intellectual work.



Some notes from Problem Set 1 of 6.00.1x - Introduction to Computer Science & Programming with Python:

I'm learning some differences between Python and Java. My approach to studying CS & Programming is to not shy away from dealing with multiple languages at once. After all: the real part should be learning to build algorithms, solve problems, and get comfortable with multiple layers of abstraction. The syntax of different programming languages should be the easy part.

That said a few beginner notes on Python and Java. In Java you have something very close to C. Code blocks inside braces, lines ending with semicolons, explicit type setting of variables. Python looks like it's more streamlined, but I suspect a bit of a learning curve after the first stage. No explicit type setting, which makes coding faster but can bring headaches if you don't pay attention, no semicolons - instead a strict indentation regime, and a simple colon beginning a code block instead of the braces. Edit: semicolons optional

6.00.1x PSet 1.2: Counting bobs

Figuring out how to count the number of times the name "bob" comes up in a string took a lot longer than my pride allows me to say. After seeing the difference between Java and Python syntax, there were 2 issues I had to figure out: firstly how to use the range() function. You can't just write:

for i in range(s): ...  because range() wants a number but s here is a string of letters. No bueno. So use len() to find the integer value of the length of s, and pass that as an argument to range() like so:

for i in range(len(s)): --- 

The second issue was remembering that moving through an array, you start at the first value and end just before the last. So writing: if "bob" in s[i:i+2]: is going to bring you bad times, and is why my code kept saying zero.

6.00.1x Pset 1.3: Counting and Grouping


There were two hurdles with this problem. First was figuring out how to pass integer variables into a string in Python, and I think I found a more-complicated-than-necessary way of doing it, and the other was making sure the variable I wanted to return was defined after the for-loop was completed. I also forgot some colons in there. Odd to me that Python won't update variables within another variable (say integer values within a string) but.. hmm perhaps because it's defined as a string then it stays that way? Idk.


Note: copypasting from Evernote lets you keep formatting? sweet

Saturday, January 23, 2016

CSC - Де 54

CSC - Де 54

Hangman Assignment Directory
Hangman.java
HangmanCanvas.java
HangmanLexicon.java


Breakout Assignment Directory
Breakout.java

6 Days to Deadline.

I think I'll expand this or put up a new post when I have more to say. Right now I'm in work mode.

Monday, January 18, 2016

Day 49 - 1st Stage Closing Sprint

Last night I took an inventory of where I stood with my work. I'm 7 weeks into the CS Course, and I'm very far behind where I want to be. The point was to take the same courses EE/CS majors do at an accelerated pace to give myself a several-month crash-course in Computer Science. If I'm taking as long or longer than the courses themselves I'm doing something wrong.

Current standing:
SICP/CS61A: p218/833 - week 5 of 14
CS106A; week 5 of 11
6.002.1x: week 2 of 4
18.01sc: section 27 of 101

So I'm giving myself 12 days to get this all done. That's my objective, and outcome I want is to build my CS fundamentals but really it's discipline. The stakes will be a lot higher in the future, so if I can prove to myself this can get done, then that's good.

I'm stacking on an extra course, MITx's 6.00.1x course on edx, Intro to CS & Programming w/ Python - because it's time dependent (so do it now or not) and I want to get a certificate in the thing (got 53/55% last time). It's not hard.

I can say that, oh when I started 48 days ago, I started from zero - and while that's true it also doesn't matter. It gets done or it doesn't. So:

In order to achieve my objective I'll need to keep up the following minimum pace:
51 pages of SICP /day
.75 weeks of CS61A / day --or-- 3 weeks every 2 days
6.002.1x is fine
7 sections (roughly 2 lectures) of 18.01sc every day
6.00.1x at normal pace.

Why do I believe I can do this? I've been able to finish an entire week of 6.002.1x Circuit Analysis in a day, and roughly the same in CS61A & CS106A. So it's not a capability issue. It's a discipline issue.

The stuff isn't extremely difficult, and I'm not looking to be a world-class expert; just to be competent & get it done. I'll be posting regular updates every 3 days until I start the 2nd set.

To meet the 9-week mark, I actually have 15 days, but I'm pretending those extra 3 don't exist. You should focus on not getting cut, not asking if you can keep the arm.

Tuesday, January 5, 2016

CS Course Day 36

Yesterday I finally started 6.002x Circuits and Electronics. I have until May to complete the 3 modules. My motivation is: it's not enough to learn programming skills; if I want to build integrated hardware systems... well I better know which wire goes where eh? I like the course. Worked on it yesterday from 1800 to 23:40 with some breaks. It feels good to work on things from a coding side, and from a physical and math pencil & paper side.

I worked on some very basic circuit analysis. The course at this stage is a review. KCL, KVL, element relationships, and node-method analysis. I first tried this course maybe 10 months ago and where everything seemed like impossible black-magic it's now pretty simple and intuitive. You stay consistent in how you assign [+/-] and math + principles basically takes care of it all for you.


For example, down below at S2E2 your asked to find the branch variables of the two circuits. The only difference between the two is that the sign convention (which way is [+] or [-]) on the voltages is switched. As you'd expect, the measured voltages and currents are the opposite signs of one another, but the power being supplied by the voltage source and dissipated by the resistor is the same.

These in-lecture exercises served as a warm-up for me: remembering the mental habits that make you efficient; but in the beginning you grind through it all so it takes some time. S2E3 at bottom was a more involved application of everything.

S2E2 & S2E3:


I got as far last night as dealing with the Node method. The other methods (KCL/KVL and element relationships) balloon in complexity and number of equations with number of elements. The node method is what's used. The way it works is you pick a node (a juncture between branch elements) and set that as your ground. You're measuring voltage which is a potential difference, so it doesn't matter so long as you're consistent. After that you write your KCL (Kirchoff's Current Law) equations for each node summed to zero. The convention I'm using is: current out = [+], current in = [-]. You then solve for the node and once you know your node voltages, calculating the remaining branch elements is easy: just a case of V = IR


I have SICP work to get to now so I'll cut this short and pick up another time. I'll have to make pictures of the notes clearer.



Saturday, January 2, 2016

Kerla Sho, New Year Update

CS Course Day 33.

GitHub Code repositories since last update:

ASJava_4.01-4.12
ASJava_5.01-5.12
SICP 2.17, 2.20, 2.22, 2.23
CS106A_Assignment 2: Simple Java


Structure and Interpretation of Computer Programs (which is a full course, not just a book) has gotten a lot easier after I decided to follow the exercise assignments in Professor Brian Harvey's Spring 2011 syllabus. Even if I am running on an accelerated pace, I think I'm fine if I do the same work that Berkeley and Stanford students do.

I feel hesitant every time I say this, but the level of relative ease when I follow the structure of university programs is pretty noticeable. But I think it also has to do with me being able to better understand the material in more manageable chunks. Hey how about that, you gotta train smart in academics too, not just athletics.

On New Year's Day I got started on the 2nd assignment of Mehran Sehami's CS106A course. The course is Stanford's introduction to Computer Science for EE & CS majors. I took 2.5 hours to finish the first problem in the assignment, and got done right before going to a New Year's get together. I finished the rest of the assignment today. The first 2 hours and 10 minutes were spent trying to unknot myself and making things worse, and below is the result 15 minutes after throwing out all the code and starting fresh. I got the pyramid right side up a couple minutes later.



The big lesson is thought structure. The way these problems work is there's a way to pay 20 hours and maximal effort with mediocre results, or 10 minutes and no effort with full return. This extreme curve for problems in Informatics makes me think people like Nick Bostrom are definitely on to something in their view of the nature of intelligence. Maybe. I feel as though life is more linear, or maybe we're just used to seeing it that way. The world is pretty unforgiving in favor of who has the advantage.. so jury's out.

The mistake I made was not understanding the nature of the problem exactly. I had an approximate grasp of what I had to solve and what I had to do to solve it, but without the necessary tools of experience and brain-wiring to rely on.There is no winging new things unless you're interested in what not to do (which at an early stage is important). I wasn't sure to use a while or a for loop (hint: use for's when your iteration is definite, while when it's indefinite) and, here's the big part: didn't understand how my for-loops were iterating. That's kinda important. Anyway the result was a mess.

When I started over, I decided not to do it the way I thought others would have me do. I'm not a professional yet so how can I know? All I'd get is a crude approximation without any knowledge of the whys/ So I started building the algorithm the way it made sense to me: you have a number of bases and you have a rank number, both of which count down to 1. Vertical position is uses rank as a parameter, and horizontal position uses the formula: center position - base number * the width of the bricks, + rank * half the brick width. What that gives you is a value that starts out less than center, and eventually passes it. Rank starts equal to the number of bricks at base (this number is passed into the method) and counts down. The base number starts equal to Rank at each rank iteration and counts down to 1. So at Rank = 14: Base = 14,13,12,... etc. This means the program draws bricks at the widest level first, which is why I got the pyramid upside down: wrong vertical parameter. Easy fix.

The rest of the assignment went smoothly. It took me 2.5 hours to finish the remaining 5 problems.

Not much else to say at the moment. I think things are going smoothly. They can be faster and I need to make that happen. I get closer to getting my full list of work done each day. When I get to that point I'll add more. Now that we're at the start of the month - I want to have SICP and CS106A completely finished by February. I'm just about starting Calculus again and Electronic Circuits. I have an EC reading from months ago that I'll do, and then go back and apply my work style from CS to it. If you can do the exercises you don't really know the material. If you don't know the material you can't be nimble and inventive, and perform to your potential when you set out to build something. It all comes back to the same thing: it's on you to put in the work. I really look forward to burning through the EE work.

I started surveying MIT's 6.01 Intro to EECS I. I'm not an MIT student so I don't have access to the labs & etcetera, but I want a better picture of the path ahead. I'm just doing all the readings and watching all the lectures and recitations. I don't count it as taking a course but there's a use anyway. I think I'll survey 6.02 Intro to EECS II, which focuses on digital communication systems, afterwards. I just checked and the lectures and readings are all there so we're good. It's like sparknotes for independent study. I have a whole curated reading list cut out for me :). 6.002x, the Circuits and Electronics course I do take very seriously and I will get a certificate in all 3 modules on edX.

That's that, more when more's happened.