• Home
  • About
    • About The Coder
    • Language List
  • Code Rules
    • #1: Clarity Trumps Everything
    • #2: Source Code is for Humans
    • #3: Don’t Ignore Warnings
    • #4: Comment As You Go
    • #5: Always Use Parentheses
    • #6: Always Define Literals
    • #7: Never Repeat Yourself
  • CS-101
  • Python-101
  • Simple Tricks
  • Guestbook

The Hard-Core Coder

~ I can't stop writing code!

The Hard-Core Coder

Tag Archives: Python code

So Random!

01 Tuesday Jan 2019

Posted by Wyrd Smythe in Fun, Python

≈ 5 Comments

Tags

Python code, random

To ring in the new year, I thought I’d play around with an old friend from my earliest programming days, a random text generator. Back then (over 30 years ago), but a little bit always, a good way to practice programming is by working on small, relatively easy, but still fun, programs.

Simple games are common choice, but not the only one. (I’ve probably written a version of Mastermind in every programming language I know.) Another fun choice is various image or text generators (or processors). Random text generators, in particular, offer a range of complexity depending on your taste and time.

Continue reading →

Knowing Where To Bang

02 Wednesday Aug 2017

Posted by Wyrd Smythe in Python, Stories

≈ Leave a comment

Tags

computer programmers, computer programming, debugging, old joke, Python code, tips

Sometimes ya gotta laugh. I just spent nearly an hour chasing one of those bugs that “can’t be happening” because “the code looks absolutely correct (as far as I can tell).” Of course, the bug, once you find it, was always hiding in plain view.

This time the fix involved adding just two characters and incidentally improving the program semantics, and very much reminded me of the old joke about the huge cargo ship that breaks down at sea…

Continue reading →

Python Pi

14 Monday Mar 2016

Posted by Wyrd Smythe in Fun, Python

≈ 1 Comment

Tags

digits of pi, pi, Pi Day, Python code

For Pi Day I published a post on my main blog, Logos Con Carne. Here is the Python code behind the data generated in that post.

Continue reading →

State Engines, part 3

25 Wednesday Nov 2015

Posted by Wyrd Smythe in CS101

≈ 2 Comments

Tags

computer, computer code, computer programming, computer science, Python code, state engine, state table

In the first two parts of this series I’ve introduced state engines and taken apart a specific instance of an engine. Now it’s time to tie together the design idea with approaches to building a variety of such engines.

Because the programming logic is in the state table, the engine can be fairly generic. That means it’s possible to create a state engine framework you can reuse for a variety of applications.

Continue reading →

State Engines, part 2

11 Wednesday Nov 2015

Posted by Wyrd Smythe in CS101

≈ 2 Comments

Tags

computer, computer code, computer programming, computer science, Python code, state engine, state table

Last time I introduced state engines and state tables. I showed parts of a simple implementation of one in Python. It parsed the language introduced in Little Programming Languages. This post continues that, so be sure you’ve read that first article.

I got as far as the state table implementing the process, and that’s where this post picks up. I’ll also get into the SourceReader class that does the heavy lifting.

Continue reading →

State Engines, part 1

08 Sunday Nov 2015

Posted by Wyrd Smythe in CS101

≈ 2 Comments

Tags

computer, computer code, computer programming, computer science, Python code, state engine, state table

At one point in my career, the state engine (SE) was one of my favorite AWK hammers. At the time much of the work involved text processing or, in some cases, serial byte processing (which is not quite the same thing). That sort of thing is right in the wheelhouse for a state engine.

They are a very useful tool and an important part of any programmer’s toolkit.

Continue reading →

Python & Baseball

19 Monday May 2014

Posted by Wyrd Smythe in Fun, Python

≈ 1 Comment

Tags

baseball, character graphics, computer programming, imperative programming language, Minnesota Twins, programming language, Python code, Target Field

One of the cool things about being a carpenter is that you can make your own shelves and dog houses. One of the cool things about being a computer programmer is that you can make your own computer apps!

In an era when computers are so much a part of life, that’s a useful skill. And the nice thing about doing it yourself is that things turn out exactly as you want them. You can make things that are perfect just for you.

Case in point: using Python to create custom charts of baseball stats!

Continue reading →

New Blog!

26 Wednesday Feb 2014

Posted by Wyrd Smythe in Blog

≈ 2 Comments

Tags

computer humor, computer languages, computer programming, Python code, software, software design, software development

I have a lot of computer programming stuff I’d like to write about, but it’s way too specific for my regular blog (which has a hard enough time attracting readers), and it’s too general to be appropriate for my Book of BOOL blog.

So here I go with blog number three. (Technically, blog number four; my very first blog was my now-long-abandoned baseball blog.) This blog is exclusively for writing about computer programming topics. Expect a mix of “stuff I’ve done that was fun” plus “stuff I’ve thought about and want to document” plus “good advice for coders.”

I’ve written some of those last kind on my regular blog. To get things going, and to put them in a more sensible place, I’ll re-post them here.

Soon. But for now, “Hello, World!” It’s a whole new blog!

Newer posts →
Follow The Hard-Core Coder on WordPress.com

The Posts

  • This is Python! (part 8)
  • This is Python! (part 7)
  • This is Python! (part 6)
  • This is Python! (part 5)
  • This is Python! (part 4)
  • This is Python! (part 3)
  • This is Python! (part 2)
  • This is Python! (part 1)
  • Tk Calculator App Extra
  • Python Prefix Calculator App

The Topics

  • Blog (4)
  • CS101 (37)
  • Fun (39)
  • Interesting (5)
  • Opinion (12)
  • Python (69)
  • Stories (15)

The Month

March 2026
M T W T F S S
 1
2345678
9101112131415
16171819202122
23242526272829
3031  
« Feb    

The Past

Posts

RSS Feed

Comments

RSS Feed

The Main Blog

Visit Logos con carne

Lots of wyrds... with meat!

The Author

Wyrd Smythe

Wyrd Smythe

The canonical fool on the hill watching the sunset and the rotation of the planet and thinking what he imagines are large thoughts.

View Full Profile →

Create a website or blog at WordPress.com

  • Subscribe Subscribed
    • The Hard-Core Coder
    • Already have a WordPress.com account? Log in now.
    • The Hard-Core Coder
    • Subscribe Subscribed
    • Sign up
    • Log in
    • Report this content
    • View site in Reader
    • Manage subscriptions
    • Collapse this bar