<?php

header("Content-type: text/xml");
define("ROOT", "../../../../../../users/");
define("LEVEL_IDS_FILE_NAME", "level_ids");
define("FIELD_SEPARATOR", "|");
define("FILE_SPECIAL_CHARACTER", "_");
define("LEVEL_FILE_EXTENSION", ".xml.gz");

$id = $_GET["id"];
$path = build_path($id);
if (!file_exists($path))
{
   $path = str_replace(".gz", "", $path);
}
ob_start();
readgzfile($path);
ob_end_flush();

function build_path($id)
{
   $entry = file_read_line($id);
   $fields = explode(FIELD_SEPARATOR, $entry);
   $user = $fields[0];
   $file_name = convert_name($fields[1]) . LEVEL_FILE_EXTENSION;
   $path = ROOT . $user . "/levels/" . $file_name;
   return $path;
}
function file_read_line($line)
{
   $path = ROOT . "/" . LEVEL_IDS_FILE_NAME;
   $levels = file($path);
   return trim($levels[$line - 1]);
}
function convert_name($name)
{
   $name = preg_replace("/[^a-zA-Z0-9]{1}/", FILE_SPECIAL_CHARACTER, $name);
   return strtolower($name);
}
EVR.Level.Summary.Time = function(container, level)
{
   this.container = container;
   this.level = level;
   this.set();
}
EVR.Level.Summary.Time.prototype.set = function()
{
   var level = this.level;
   var container = this.container;
   var relative = level.container;
   var font = TIME_FONT;
   var color = this.determine_color();
   var size = TIME_FONT_SIZE;
   var text = level.history.get_newest().time;
   this.text = new EVR.Text(container, text, font, color, size, relative);
   this.set_line_height();
   this.text.css.overflow = "visible";
   var style = container.style;
   style.verticalAlign = "middle";
   style.paddingLeft = TIME_PADDING;
   style.letterSpacing = TIME_LETTER_SPACING;
   style.overflow = "visible";
}
EVR.Level.Summary.Time.prototype.determine_color = function()
{
   if (this.level.goal_cleared())
   {
      return TIME_CLEAR_FONT_COLOR;
   }
   return TIME_FAIL_FONT_COLOR;
}
EVR.Level.Summary.Time.prototype.set_line_height = function()
{
   var text = this.text;
   var height = text.get_font_size();
   height -= height * TIME_LINE_HEIGHT_MODIFIER;
   text.set_line_height(height);
}
EVR.Level.Summary.Time.prototype.draw = function()
{
   this.text.set_font_size();
   this.set_line_height();
}
EVR.Level.Summary.Time.prototype.toString = function()
{
   return "[object EVR.Level.Summary.Time]";
}
EVR.Level.Summary.Goal = function(container, level)
{
   this.container = container;
   this.level = level;
   this.set();
}
EVR.Level.Summary.Goal.prototype.set = function()
{
   var level = this.level;
   var container = this.container;
   var string = this.get_goal_string();
   var family = GOAL_FONT_FAMILY;
   var color = GOAL_FONT_COLOR;
   var size = GOAL_FONT_SIZE;
   var relative = level.container;
   this.text = new EVR.Text(container, string, family, color, size, relative);
   this.set_attributes();
}
EVR.Level.Summary.Goal.prototype.get_goal_string = function()
{
   var level = this.level;
   var goal, text;
   if (level.is_clear())
   {
      goal = level.advanced;
      text = GOAL_ADVANCED_TEXT;
   }
   else
   {
      goal = level.goal;
      text = GOAL_TEXT;
   }
   return text + " " + goal.toString(0, 1);
}
EVR.Level.Summary.Goal.prototype.set_attributes = function()
{
   var text = this.text;
   text.set_color(GOAL_BACKGROUND);
   text.css.textAlign = GOAL_TEXT_ALIGN;
   text.css.letterSpacing = GOAL_LETTER_SPACING;
   text.css.marginTop = GOAL_MARGIN;
   text.css.padding = GOAL_PADDING + " 0";
}
EVR.Level.Summary.Goal.prototype.draw = function()
{
   this.text.set_font_size();
}
EVR.Level.Summary.Goal.prototype.toString = function()
{
   return "[object EVR.Level.Summary.Goal]";
}
EVR.Level.Summary.Accuracy = function(container, level)
{
   this.container = container;
   this.field = level.container;
   this.path = level.road.path;
   this.history = level.history;
   this.align();
   this.add_heading();
   this.add_accuracy();
}
EVR.Level.Summary.Accuracy.prototype.align = function()
{
   var style = this.container.style;
   style.verticalAlign = "middle";
   style.textAlign = "center";
}
EVR.Level.Summary.Accuracy.prototype.add_heading = function()
{
   var cell = this.container;
   var text = ACCURACY_HEADING;
   var font = ACCURACY_HEADING_FONT;
   var size = ACCURACY_HEADING_FONT_SIZE;
   var color = ACCURACY_FONT_COLOR;
   var heading = new EVR.Text(cell, text, font, color, size, this.field);
   heading.css.textDecoration = ACCURACY_HEADING_TEXT_DECORATION;
   heading.css.letterSpacing = ACCURACY_HEADING_LETTER_SPACING;
   heading.css.backgroundColor = ACCURACY_BACKGROUND_COLOR;
   heading.css.borderBottom = ACCURACY_HEADING_BORDER;
   this.heading = heading;
}
EVR.Level.Summary.Accuracy.prototype.add_accuracy = function()
{
   var cell = this.container;
   var size = ACCURACY_FONT_SIZE;
   var text = this.history.get_newest().accuracy;
   var font = ACCURACY_FONT;
   var color = ACCURACY_FONT_COLOR;
   var accuracy = new EVR.Text(cell, text, font, color, size, this.field);
   accuracy.css.fontWeight = ACCURACY_FONT_WEIGHT;
   accuracy.css.letterSpacing = ACCURACY_LETTER_SPACING;
   accuracy.css.backgroundColor = ACCURACY_BACKGROUND_COLOR;
   accuracy.css.padding = "0 " + ACCURACY_PADDING + "px";
   this.accuracy = accuracy;
}
EVR.Level.Summary.Accuracy.prototype.draw = function()
{
   this.heading.set_font_size();
   this.accuracy.set_font_size();
}
EVR.Level.Summary.Accuracy.toString = function()
{
   return "[object EVR.Level.Summary.Accuracy]";
}
EVR.include("level/summary/Accuracy.js");
EVR.include("level/summary/Time.js");
EVR.include("level/summary/Goal.js");
EVR.include("level/summary/comparison/Comparison.js");
EVR.include("level/summary/graph/Graph.js");
EVR.Level.Summary = function(level)
{
   EVR.Table.call(this, level.road, "1%", "100%");
   level.road.set_color(SUMMARY_BACKGROUND);
   this.level = level;
   this.row = this.insert_row();
   this.add_finish_line();
   this.add_widgets();
   this.append();
}
EVR.Level.Summary.prototype = new EVR.Table;
EVR.Level.Summary.prototype.add_finish_line = function()
{
   var road = this.container;
   var finish_line = new EVR.Level.Road.Path.Line(road, LINE_FINISH);
   finish_line.place(SUMMARY_FINISH_LINE_OFFSET);
   finish_line.append();
   this.finish_line = finish_line;
}
EVR.Level.Summary.prototype.add_widgets = function()
{
   var level = this.level;
   var cell = this.insert_cell();
   this.accuracy = new EVR.Level.Summary.Accuracy(cell, level);
   this.goal = new EVR.Level.Summary.Goal(cell, level);
   this.graph = new EVR.Level.Summary.Graph(this.insert_cell(), level);
   this.comparison = new EVR.Level.Summary.Comparison(this.row, level);
   this.time = new EVR.Level.Summary.Time(this.insert_cell(), level);
}
EVR.Level.Summary.prototype.draw = function()
{
   this.comparison.draw();
   this.time.draw();
   this.goal.draw();
   this.accuracy.draw();
   this.graph.draw();
   this.finish_line.draw();
}
EVR.Level.Summary.prototype.toString = function()
{
   return "[object EVR.Level.Summary]";
}
34.239.158.107
34.239.158.107
34.239.158.107
 
September 30, 2015


Edge of Life is a form I made with Babycastles and Mouth Arcade for an event in New York called Internet Yami-ichi, a flea market of internet-ish goods. We set up our table to look like a doctor's office and pharmacy and offered free examinations and medication prescriptions, a system described by one person as "a whole pharmacy and medical industrial complex".

Diagnoses were based on responses to the form and observations by our doctor during a short examination. The examination typically involved bizarre questions, toy torpedoes being thrown at people and a plastic bucket over the patient's head. The form combined ideas from Myers-Briggs Type Indicators, Codex Seraphinianus and chain-mail personality tests that tell you which TV show character you are. In our waiting room, we had Lake of Roaches installed in a stuffed bat (GIRP bat). It was really fun!

The icons for the food pyramid are from Maple Story and the gun icons are from the dingbat font Outgunned. I'm also using Outgunned to generate the items in Food Spring.