02 Message

The message structure gets its name abbreviated to “ic-msg” because we type it a lot.

A IC-Msg is a structure.

(make-ic-msg Number Number Color-String)

Interpretation:

(make-ic-msg from to col)
  • from: the id of the world sending the message
  • to: the id of the world the message is intended for
  • col: the new color that world is to show

Instructions

  1. Change a new file to Racket language mode, so it says “Determine language from source” at the bottom.

  2. The file should contain only these three lines below:

#lang racket
(provide (all-defined-out))
(define-struct ic-msg (from to col) #:prefab)

Verify that the file says “Determine language from source” after saving!!

Common Problems

  • The file must be in Racket language mode. (Menu: Language -> Choose Language … -> The Racket Language)
  • There should be no space between the #: and prefab.

If you have problems creating the file yourself, download it using Save link as… (ic-msg.rkt).