• Home
  • About
    • About The Coder
    • Language List
  • The Rules
    • Rule #1: Clarity Trumps Everything
    • Rule #2: Source Code is for Humans
    • Rule #3: Don’t Ignore Warnings
    • Rule #4: Comment As You Go!
    • Rule #5: Always Use Parentheses
  • CS-101
  • Python-101
  • Guestbook

The Hard-Core Coder

~ I can't stop writing code!

The Hard-Core Coder

Tag Archives: computer code

Life With Class

07 Thursday May 2020

Posted by Wyrd Smythe in Fun, Python

≈ Leave a comment

Tags

computer code, Conway's Life game, John Conway, program, Python code

Last time I showed you the functions necessary for Life — for John Conway’s game of Life, that is. We ended up with a set of functions you can use to generate frames of a Life session.

This time I’ll show you an object-oriented version (a Life class) along with some other tweaks to make things look nicer.

Continue reading →

John Conway’s Life

03 Sunday May 2020

Posted by Wyrd Smythe in Fun, Python

≈ Leave a comment

Tags

computer code, Conway's Life game, John Conway, program, Python code

You may have heard that mathematician John Conway died last April. To his everlasting dismay, most people only know him for his “game” of Life (which he considered trivial and inferior to his real mathematical work). Unfortunately for Conway, his Life game is fascinating.

To honor his passing, I whipped up a Python version that I thought I’d share. Python is about the only language I’ve used a lot in which I’ve never implemented Life, so high time I did, right?

Continue reading →

Function Currying

22 Wednesday Apr 2020

Posted by Wyrd Smythe in CS101

≈ 2 Comments

Tags

computer code, computer programming, function currying, Python code, software design, software development

I saw a video recently about function currying, and it triggered the realization that currying might solve a problem I’ve been pondering in the context of language parsing. The problem involves knowing how many arguments an operator expects, what’s called the arity of an operation or function. It can vary from zero to many.

But it occurred to me that, with currying, there could be a language where operations always take just one argument. And that would solve a challenge for a mathematical expression language I have in mind.

Continue reading →

The Playfair Cipher

27 Sunday Oct 2019

Posted by Wyrd Smythe in Fun

≈ 1 Comment

Tags

cipher, computer code, Python code, secret codes, substitution cipher

Earlier this month, on my other blog, I wrote about the Playfair Cipher, a polygraphic substitution cipher invented by Sir Charles Wheatstone in 1854.

At the time I mused about writing some Python to automate using the cipher, and now I’ve done that, so here it is:

Continue reading →

OOP versus Imp

25 Tuesday Jun 2019

Posted by Wyrd Smythe in Opinion

≈ Leave a comment

Tags

computer code, computer language, computer languages, computer programming, computer science, imperative programming language, language design, Object-Oriented Programming, OOP, programming language

This is another note for a friend: a followup to a discussion about how some programmers really hate Object-Oriented Programming (OOP) languages.

Most of those who hate OOP hold up Imperative Programming (IP) as the One True Way to write code. The key difference is the IP is function (or verb) oriented whereas OOP is object (or noun) oriented.

I’ve never really understood that active dislike. It’s just another way to organize the same code you’d write anyway.

Continue reading →

The Eight Queens

23 Sunday Jun 2019

Posted by Wyrd Smythe in CS101, Fun, Python

≈ Leave a comment

Tags

computer code, Python code

There’s a fairly simple puzzle, called The Eight Queens, that I’ve long favored as a project for first semester CS students. The problem is simple enough for a beginner to tackle, yet also interesting enough to be engaging. (And just tricky enough to be a nice beginner challenge.)

Due to a discussion on my other blog, I dug out an old Python implementation I had, and, after looking at it, I thought it might be worth writing a post about. If nothing else, as I said, the problem is interesting enough to be engaging.

Continue reading →

Anyone Can Code?

14 Friday Sep 2018

Posted by Wyrd Smythe in Opinion

≈ Leave a comment

Tags

computer code, computer programmer, computer programming, real programmers, software design, software development, software industry

There’s a general ethic these days — that anyone can code — and like a lot of things, there’s some truth to it, but also some silliness. As usual, it really depends on what we mean by “anyone can code.”

If we mean it in the same way we might say, “anyone can drive,” I think it’s silly. But if we mean in the same way we might say, “anyone can doctor (or lawyer),” well, then I still think it’s silly.

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 →

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

The Posts

  • Python String Translate
  • The Last Bug
  • Regular Expressions
  • Bits Bytes Chips Clocks
  • Loving the Lambda
  • Failure Tales
  • Naming Things (redux)
  • Calculating Entropy (in Python)
  • Building a Turing Machine
  • Python Tokenize

The Topics

  • Blog (4)
  • CS101 (35)
  • Fun (27)
  • Interesting (1)
  • Opinion (12)
  • Python (24)
  • Stories (15)

The Month

March 2023
M T W T F S S
 12345
6789101112
13141516171819
20212223242526
2728293031  
« Oct    

The Past

Posts

RSS Feed

Comments

RSS Feed

Enter your email address to follow The Hard-Core Coder and get email when there is a new post.

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

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