Programming, game design, and faith

Sun halo

Category: Code

World’s dumbest chatbot

Try it with emojis 😀


public class Test
  public static void main(String[] args)
    System.out.println("Hello. How are you?");
    java.util.Scanner cin = new java.util.Scanner(;
    String in = cin.nextLine();
    System.out.println("I feel "+in+" too.");

Entity-Component-System architecture

Recently I have been learning about the Entity-Component-System architecture for video game programming. I think it will help out with my “World’s Tiniest RTS” game. I learned about it here, in Robert Nystrom’s Game Programming Patterns. I also heard on the Exploding Rabbit podcast how Jay Pavlina (of Super Mario Bros. Crossover fame) uses the pattern. Here is my Clojure code for it, currently:

(defn create-game []
  {:entities {}})

(defn create-entity []

(defn add-entity [game entity]
  (update-in game [:entities] conj entity))

(defn add-component [game entity com data]
  (assoc-in game [:entities (first entity) com] data))

(let [e1 (create-entity)]
    (add-entity e1)
    (add-component e1 :position [3 4])
    (add-component e1 :name "ball")))

Powered by WordPress & Theme by Anders Norén