#include "library.h" const int edge = 50; const double timestep = 1.0; struct actor { double posx, posy, speed; int colour; string name, success; actor * destination; void setpos(int x, int y) { posx = x + edge; posy = y + edge; } void setspeed(double s) { speed = s; } void setup(string n, int c, string s, actor * d) { name = n; colour = c; success = s; destination = d; } void update(double t) { double dx = destination->posx; double dy = destination->posy; double direction = atan((dx-posx)/(dy-posy)); double changex = speed * t * sin(direction); double changey = speed * t * cos(direction); posx += changex; posy += changey; } void showself() { set_pen_color(colour); set_pen_width(3); move_to(posx, posy); draw_point(); } }; struct universe { int width, length, topx, topy; actor cast[10]; int castsize; universe(int l, int w) { width = w; length = l; topx = edge; topy = edge; } void make_window() { ::make_window(length+2*edge, width+2*edge); } void display() { set_pen_color(color::black); move_to(topx, topy); draw_to(topx+length, topy); draw_to(topx+length, topy+width); draw_to(topx, topy+width); draw_to(topx, topy); for (int i=0; i