More fun with Java 1.8 -ASCII “Art” 101 using Arrays….

This is the type of assignment I would hand out to first year programming students. After introducing the idea of lists, I implore them to solve the following:
Use a list to build an ASCII pyramid using the character of your choice and make it: a) appear “pyramidal” that is, no leaning, no right-angles at the base and give it some semblance of aesthetic quality b) your logic should generate EVERY level of the pyramid, that is, no coding “special cases” for the top, middle or bottom rows. The logic must hold sound to construct the entire pyramid as a stand-alone algorithm. c) print your src (source code) and the output of your program to prove to peers that it works.

    This task requires careful dissection of the elements involved:

  • variable number of rows
  • each row knows how many spaces to print and how many characters
  • this involves logical analysis for the left spaces, the chars AND the right spaces
  • The algorithm must know when to “endline”/”newline”/
  • Careful analysis and monitoring (QA/QC) of the variables during runtime may be needed

For the seasoned programmer this is fairly basic, but involves core mathematical concepts, an element of basic aesthetic design and a good grip on list variable storage; how they are both computed and sent to an output stream (System.out in this case) This is the rough equivalent of “cout <<” for you C/C++ guys

    For extra credit:

  • Add a user-interface to ask the user how big to build the pyramid. Include exception-handling for pyramid sizes that are not technically “pyramids” (height = 1 is not a pyramid) heights too large will lose their aesthetic, or their pyramidal structure entirely if built too large or too impractical for the user’s display. (I capped mine at 50 rows) – add warnings depending on the user interface).
  • Decorate the pyramid with one or more random characters in addition to your “foundation” block (I used hashtags for my foundation block).
  • Invert the pyramid.
  • Stack the pyramid atop the inverted one to make a diamond shape…make sure it lines up evenly. No bumps or other strangeness in the middle.

Here is a sample solution; note that I carefully tracked line size, space, building-block-count, row-count & the storage of each…this is crucial to accuracy and QC testing during development time.
This is an acceptable output:

a snap of the pyramid program in-process using the Netbeans IDE
seen w/in the Netbeans Integrated Development Environment. “I design them.”

 

Here is the source code – note brevity in my solution– ~20 lines-ungolfed!:
/*
author: Chris "Tapper" Welke
This program generates an ASCII-art 50 row pyramid using hashtags as a building block.
Solution provided for instructional/informational purposes in the areas of lists,
integers, type-casting, dynamic memory allocation, and open-source programming. If you
are new to Java, this is an excellent trial pgm to get you started.
Dist. under the GNU Public License. Free to distribute: please attribute though, ok?:
Last Stable Build: 5/23/15 at Tapper7.com and Self-Similarity Studios courtesy
The Netbeans (Netbeans.org) IDE, Java 1.8 and the std. javac compiler
OS: Win 8.1, Chipset by Intel. Laptop by Hewlett-Packard. Website provided by Media Temple
*/
package learn;
import java.util.Arrays;
public class HashTagASCIIPyramid{
protected static int charlinelength = 100;
public static void main(String[] arg){
float[] asciiStorage = new float[HashTagASCIIPyramid.charlinelength];
int totalHashtags = 1; //initialize builing block total
int charCount = 0; //count building blocks for QC testing
int[] cclist = new int[100]; //record the char generation as it happens
int leftspaces = (int)asciiStorage.length/2;
int rightspaces = (int)asciiStorage.length/2;
int height = 1;
for(int i = 0; i < asciiStorage.length/2; i++){
for (int l = 0; l < leftspaces; l++){
System.out.print(" "); charCount++;
}
for (int t = 0; t < totalHashtags; t++){
System.out.print("#"); charCount++;
}
for (int r = 0; r < rightspaces; r++){
System.out.print(" "); charCount++;
}
System.out.print('\n');
/*QC Tracking: height++; cclist[i] = charCount;*/
leftspaces--; totalHashtags +=2;rightspaces--;
}//end mn loop
}//end mn
}//end class #asciipyramid

Hints: I used space-fillers for the spaces (” “); – left and right brackets plus lots of variable outputs to see what was going on during run-time, my initial design yielded the following output:
run:
pyramid test1
WHOOPS!
Heh…so clearly there were multiple logic faults, (and I started with tildas, not hashtags….) but it was easy to track the movement of the left and right brackets that debugged the left and right SPACES and not shown are my debugging outputs that checked the length of each row for consistency(it was going over and under 100 – keeping the length of each row equivalent was key to my particular legitimate solution)— also that my iterators and arrays were misplaced and thus not controlling and the output correctly.

    Keys to victory:

  1. increment blocks by TWO; not one
  2. decrement spaces and increment blocks OUTSIDE the main loop rightSpaces--;leftSpaces--totalHashtags+=2;

Coming soon: Bill’s adventures at Los Alamos, More Netbeans experiments, tutorials and anything interesting that happens when I have my camera on me.

Lots of great ideas in the works…and let us not forget: Summer is Coming …. Go Santa Clara and Concord! Support your local drum corps by playing bingo, going to shows, donating your time, tailgating at shows and screaming your lungs out when corps brings you to it on the Field of Honor. All signs point to a another stellar season for Red and Blue Banners both; and I wouldn’t have it any other way (scratch that….I’d resurrect Bridgemen, Suncoast, Big 27, Star, Kingsmen, The Freelancers and The Velvet Knights) THEN it’d be roll-out time.
Under the circumstances, putting all politics aside; Thank God for Rosemont, Rockford, Madison, Garfield, Bloooooo, SCV/BD, Cru, Spirit and all other remamining “Big Time DCI” corps still in the hunt, still rockin’ it…gettin ready for the only kickoff I really care about: Memorial Day Weekend. A trial by fire where those who make it through will be ready for the best summer of their lives. Hang in there kids, you got this!
Music, Tech, Art, Love and Life; find it all right here at The SoCal Picayune. Your LA/OC home for Drum Corps, Culture, tech-security, experiments and solutions, the occasional off-color joke, scam-hunting, YT highlights and the best (and worst) direct from the minds of this writer, Tapper and Bill Feynman.
Maybe a Memorial Day Anecdote will inspire itself as we begin the approach. hmmmmm…..
[] Support my sponsors! All are reviewed regularly for legitimacy by the Senior Ethics Auditor: moi

Youtube and WordPress (hopefully) breathes new life into dying art form…

Around the turn of the millennium a new technology for animation was born: Flash. With it, an animator needn’t “a sweatshop in Korea with 50 animators working 24/7 at gunpoint ….and chickens running around”—said Mike Reiss, 26-year veteran producer of “The Simpsons”—Reiss is a four-time Emmy-winning producer, He wrote for Johnny Carson and Conan O’Brien in addition to a creator credit for “The Critic,” and scores of children’s novels – notably How Murray Saved Christmas, which NBC/Universal turned into a movie that aired Christmas Day last year to rousing reviews and accolades.

Flash can be programmed to do a great deal of the animation itself; a golden age of mature-themed animation made it’s way to the Web via Newgrounds and later Icebox. Icebox went defunct for a spell; they are back up though! With the advent of YouTube, animation host Newgrounds faded into the background as well. On the NEW Icebox, there exists ZERO NEW content, but all the CLASSIC animated series are is posted to an AWFUL WordPress blog (worse than mine) and the vids are hosted on YT-natch. It’s rough-around the edges but a whole lot better than nothing. Brilliant, hysterical, edgy and outrageously talented creations are resurrected…thanks to increasingly inexpensive Web-hosting.
This is a common model for modern publishing (I use it myself)…

WP engine: cheap…embedding video through YouTube – free.

Now all the fantastic episodes of SEVERAL brilliant “webtoons” are avail. It’s weird …. the episodes have so few views…Some episodes of “Superhero Roommate” featuring Brian Posehn…one of my all-time favorite comedians…has barely 200 views since uploading *ahem*
*scratch that…* “Leftovers part 1,” up for two years, has just over 100 views- I’d like to help him change that:

The surge of creative possibilities attracted a flood of heavy-hitter producers, writers, musicians and other artists. They were captivated by the ease of animating and the uncensored freedom offered by the InterWebz. In an eerily self-prophesying episode, Larry David piled on for a new series called “The Paula Principle” David creates a senator who’s just been nominated for president, he laments, self-deprecates and yells at his manager in classic LD-style, noting that he’s a complete hack, unqualified, in over his head…too stupid to do the job. Sadly…it was the only episode ever made. If I ever meet him, I will ask what would’ve happened to the “Complete Idiot” Senator, written an voiced by David himself and VERY MUCH a prequel to the style he would use on “Curb.” :

Only 290 views! How many times do you think “The Soup Nazi” episode of Seinfeld has been watched? I’ve seen it…3x? Would it be safe to say over a billion considering the syndication and DVD sets…and the fans who watch favorite episodes over and over again?
Another favorite of mine that has been brought back to life is “Mr. Wong” by Pam Brady. Mr. Wong is a SEVERE asian stereotype, his boss abuses him w/o mercy…and he gets involved with opiates, binge-drinking, hallucinations and “accidently” turns gay in this masterful series. The production value is top-notch. The main-theme played on the harpsichord at whiplash speeds in later episodes is a nod to how many heavy-hitting artists/musicians Flash technology attracted, here is episode 1, “Urine Trouble,” :

As you can see, this series was so good it was picked up by Mondo in 2009 and has nearly a quarter-million views since then. I assure you, episode 1 previously had well-over a million views through Newgrounds and the old version of Icebox.
Another series that enjoyed commercial success was “Queer Duck,” written by Mike Reiss, voiced by top-of-the-food-chain V/O KING Billy West (he was/is Ren & Stimpy amoung countless others on nearly every successful animated series/movie EVER – The Simpsons, Futurama…you name it). Rupaul joined up to write a SWINGIN ‘intro and outro that he sang masterfully. The gay jokes are hysterical, Reiss branched off from  The Simpsons as he was growing sick of the media’s portrayal of homosexuals, though he is not HIMSELF gay…at all..he’s Jewish, like me…and we have a tendency to come to the aid of oppressed groups; particularly those known to have an artistic gift (women, blacks and gays!) by promoting them…and taking our cut (Naturally…) Here’s episode two; I first watched when Reiss gave a seminar at Cal Poly, I interviewed him for the Daily and I asked him to show me the most offensive episode he had in the can so far. This was what he showed me….btw did I mention all the content is #NSFW? …I didn’t? Ok….well… it’s not…if you haven’t been fired yet let’s move on…sorry about that.

Yes..this series was so good it was picked up by Showtime.
He also created “Hard-Drinkin’ Lincoln,” which is self-explanatory. It’s about Honest Abe as an honestly s__t-faced, hardcore alcoholic, hijinks ensue and he usually gets shot at the end of every episode, making J.W. Booth a hero. It’s February, so here ya’ go….Reiss’ “Black History Month” tribute:

Speaking of purposely-offensive cringe-humor, great music and “period pieces,” “Meet The Millers” is one of my all-time favs…written by David Zuckerman. Dan Castelleneta (Homer S.) does V/O and Frank Sinatra Jr. wrote/sang the theme. It takes place in a xenophobic, commie-fearing, HEAVILY racist/anti-semitic suburb of Washington D.C.  in the 1950s. The father, an FBI agent, uses intimidation, fear-tactics, physical abuse and societal ills to his HILARIOUS advantage, which …naturally, he teaches to his children (when he’s not beating them of course)…Due to the Jennifer Aniston flick of same name, a normal web-query BURIES this great series deep down the list, even if you qualify the search for videos-only. I’ll plumb the depths of Youtube to find you an especially offensive/hysterical episode for ya, dear reader:

The dead-serious-severity in the voice of the older brother as he warns his black friend not to touch his sister and the BLAST against the French is daring and thought-provoking social satire…especially the ironic use of a laugh track when the jokes are at their most brutal not even 500 views yet.!…and now you know why the French kiss you twice!
So Icebox is BACK UP…someone setup a WP blog and assigned each series to a category. There are many more excellent series-es…es(????)….. I personally recommend “Starship Regulars,” I’m fairly certain it’s safe for work, it was initially scripted for network TV…”s__t” and “f__k” are substituted with futuristic terms, so it works. This one probably has the highest production value of them all. It’s a bummer there are so few episodes. I’m not a Trekkie by any stretch ..nor do I get too excited about Star Wars…sorry to burst your bubble if you thought I did. Remember: I’m a geek…. not a nerd; HUGE DIFFERENCE. I would’ve been all about this show had a major network bitten down on this…but, no dice: (Showtime did-yet it had a pitifully short run their Web site)

NOT EVEN A THOUSAND VIEWS!!! This is some of the greatest multimedia artwork ever created…and no one knows about it!
Even the new Icebox website is presented in carelessly written CSS…the videos out-span column-one, the new site is messy-carelessly slapped together-glad it’s there but sad to see it in such shabby condition. I present these on my site to promote the genius of their work…and to tidy up the FORMAT in which it is presented– Heroes of mine like Larry David and Mike Reiss (I STILL can’t believe I got to meet…even kick it w/ that guy in college…) THEY DESERVE BETTER. So I’m giving it to them. Check out some funny s— you’ve never seen or heard of before! None of my artist/writer/musician readers will be disappointed. This is Tapper-approved multimedia content we’re talkin’ about here!
My interview with Reiss was placed in the can at the Mistake Daily, so I have no access to it, but I’m in the process of extracting data off another old drive…I’m hoping it’s in there. I placed an order through an IT friend/associate, it took him a while to find the li’l gadget, there’s an issue with reading data off old IDE hard drives (obviously) plus I spent a little extra on a component that will interpret the data and send it out via USB 2.0, PLUS it fits in a case to protect the drive from electromagnetism. I don’t want to extract it from my old win95 box (ca. 1998) till it comes in….for all I know my cell phone …or a WiFi signal could fry it –frequency-modulation and EM are NOT on my list of expertise. All told it should work just like a thumb-drive –though it needs it’s own dedicated power supply, again, to protect it from getting sharked or de-magnetized. I’m srsly excited to get into my personal treasure-trove of writing, music and C++ code from my Cal Poly Dorm Days! This is from a tech-era when UNIX, C++/STL, Ethernet, Quake II, FTP, ICQ, IRC, Sun Microsystems, SPARC Solaris, Silicon Graphics (SGI) and Worms: Armageddon ruled the day! Facebook, Twitter, Google, Napster, .NET, even MYSPACE(!!!) weren’t even fully-formed IDEAS yet. It’s only 16 years ago, but that’s millenia in cyberspace-time. No one even says “cyberspace” anymore…see how dated it all is? In 1998, it would be six years until I finally caved-in and became the last man in America and got a cell-phone! One thing hasn’t changed…Microsoft still sucks.

Big-time fun to come…much of it (the interesting or historically-significant it’s) I will publish here.

So…..Is there any truth to the rumor that Springfield, ??…WAS IN FACT based on San Luis Obispo? I put that question to Reiss. Stay tuned…dear reader, stay tuned. []

Thanks for stopping by and please…many of you are spending too much time on my site. Did I mention that in the privacy policy? If not…Google reports “Sessions” to me….their clients are obsessed with it…how long you stay…only because they need to know how big of an “impression” my sponsored links made on you – so they report it to me daily. As for whom and how long? Per my privacy policy I cannot say, but some of you- TOO LONG, so again…get back to work, k? I don’t want to get anyone in trouble. -T.