Wishful Coding

Didn't you ever wish your
computer understood you?

The end of Team Relay Chat

It’s time to end this experiment. It’s as easy as disabling the sign-up button, as there are no users to notify.

How it started

During my batch at Hacker School we used IRC to communicate. I still have the channel open in my IRC bouncer, but after my batch they started using some web application which I never really used.

At about the same time I worked for a company where they used Campfire internally, which I also never really used or liked.

So the idea was born to build a collaboration platform based on IRC. I started hacking and it worked. The rest was just an excercise in finishing and shipping.

Users!

After I posted my first working version to Hacker News I had maybe 5 trial users and a lot of people chatting on the demo server. I got some useful feedback.

This was all very exciting, but it didn’t last. I dropped of the front page, trial periods ended and things became quite. I’d have maybe a signup every week, but noone stayed.

I tried Google AdWords, but that stuff is hard.

Doing things that don’t scale

The sign-up process worked like this:

  1. An email arrived.
  2. I sent a reply to verify they where not bots.
  3. I rented a VPS.
  4. I ran my deployment script.
  5. I sent another email telling the user their server was ready.

This was actually very funny, because I could tailor the email to the user. They still thought I was a machine most of the time, but I also had some nice exchanges.

Some people also submitted multiple times because they did not get a reply within 5 minutes. After I changed “Sign up” to “Request invite” this went better.

Technical problems

The system I made worked pretty well, but deployment could have been better.

I used a Pallet script that would break every other deploy. The authors where very helpful in fixing all the problems, but I would nevertheless pick another system next time I need to automate deployments.

Every user had its own VPS. This was before Docker, so multi-tenanting and isolating IRC servers was hard. IRC doesn’t have virtual hosts you know. In practice this meant signing up new users was slow and expensive.

Bigger problems

The only real problem with this project is that I can’t sell it. I can’t even explain to you why this is better than email or Facebook.

It basically comes down to “I like IRC”. Other than that, Hipchat has more features and better UX.

The project was born as a hack and something I would use. I had and still have no idea why anyone else would use it.

There are developers who don’t use IRC, and non-developers that don’t even know what IRC is. Who would have thought…

Conclusion

It was fun, I learned. Next time I build somthing, I should figure out if and why people want it.

TRC is on Github, so if you do care, you can run your own server. The deploy script is probably broken though.

There is one instance of TRC still running as a bouncer that actually has users, including myself. If you are looking for a bouncer with a fancy web interface, you can have it for 3 Euro per month.

It’s all very small-scale, so if you want some random plugin installed, you can probably have it. Chances are I won’t renew the wildcard SSL cert though, these things are expensive.

Riskless

playing Riskless

Deterministic Risk using Stratego battle mechanics.

I wanted to play a game of Risk with my brother, but he complained that Risk involves too much luck. Sometimes a single unit would successfully defend against a large army.

I came up with the idea of using Stratego pieces, and after some testing, this are the rules we came up with.

Start of the game

The flag is not used. Only missions about conquering continents are used.

  1. Hand out mission cards.
  2. Divide all territory cards.
  3. Each player places all desired units on their territories.

We tried several value systems, but they where much to tedious to be fun. Place as many units as you want.

I found it works well to hold back the spy, a few bombs and some miners. These can then be placed to stop strong units or find mines.

A turn

A turn follows the normal Risk order. Place units according to controlled continents, attack or place floor(territories / 3) units, make up to 7 moves, and possibly take a territory card.

Attacking

Attacking happens by picking a unit of one of your countries with 2 or more units on it, and a unit in a neighbouring hostile country. The unit with the lowest rank is removed from the game.

If the country is taken, any number of units may be moved to it.

In case of equal ranks the defendant wins.

We tried some other rules, but found that most would make the game very slow(move one unit), the marshal too powerful(allow empty territory), or bombs to overpowered(defendant picks unit).

Placing units

This works the same as in Risk, but units cost their rank to place. This makes it cheap to scout and expensive to revive the marshal.

For this purpose the bomb has a rank of 5 and the scout and spy switch costs, making the common scout cheaper than the special spy.

Game end

The game ends when a player has completed his mission.

Remember to remove missions that don’t make sense with 2 players.

Ranks (costs)

  • 10 Marshal
  • 9 General
  • 8 Colonel
  • 7 Major
  • 6 Captain
  • 5 Lieutenant
  • 4 Sergeant
  • 3 Miner
  • 2(1) Scout
  • 1(2) Spy
  • ∞(5) Bomb

Randomness

Yes, the game is not 100% deterministic, depending how you look at it.

This randomness is in the dealing of the mission and territory cards and the fact that you can’t see the opponents units. You can theorise though.

However, given a starting position, it would be possible for 2 computer players to always arrive at the same end-game.

Published on

Raspberry Pi mp3 player

connected

Ingredients:

  • Raspberry Pi
  • USB battery
  • Headphones
  • Case(optional)
  • Bunch of wires
  • Female 1” header
  • Pile of resistors
  • Leftover shard of breadboard

Put the buttons, resistors and wires on the breadboard in a basic pull-up configuration.

schematic

Use tin, glue and pushpins to connect everything together.

inside

Admire.

case

Install cmus and write some code to control it using the GPIO buttons.

import RPi.GPIO as GPIO
import socket
from time import sleep

GPIO.setmode(GPIO.BOARD)
GPIO.setup(23, GPIO.IN)
GPIO.setup(21, GPIO.IN)
GPIO.setup(19, GPIO.IN)
GPIO.setup(15, GPIO.IN)

s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
s.connect('/home/pi/.cmus/socket')

def play_pause(e):
    s.send(b'player-pause\n')

def next(e):
    s.send(b'player-next\n')

def volume_up(e):
    s.send(b'vol +10%\n')

def volume_down(e):
    s.send(b'vol -10%\n')

GPIO.add_event_detect(23, GPIO.FALLING, callback=play_pause, bouncetime=200)
GPIO.add_event_detect(21, GPIO.FALLING, callback=next, bouncetime=200)
GPIO.add_event_detect(19, GPIO.FALLING, callback=volume_up, bouncetime=200)
GPIO.add_event_detect(15, GPIO.FALLING, callback=volume_down, bouncetime=200)

while True:
    sleep(1)

Make sure the code runs at startup.

# /etc/rc.local
su - pi -c "screen -d -m cmus"
sleep 5
python /home/pi/play.py >> /var/log/pyplay.log 

Enjoy!

ssh interface

Oh, the audio is pretty bad. It might need an USB sound card.