```On Fri, Sep 5, 2008 at 10:01 AM, Matthew Moss <matthew.moss / gmail.com> wrote:
> whip out your favourite graphics toolkit or library and write a
> program that
>
> 1. Asks for a function of one variable, x
> 2. Asks for the region of the graph to display (xmin, xmax, ymin, ymax)
> 3. Plots the graph

I didn't follow the requirements, but inspired by the quiz did a
little bit using my favorite graphics (none;-):

def grapher xmin, ymin, xmax, ymax, &function
ymax.downto(ymin) do |y|
xmin.upto(xmax) do |x|
begin
print (function.call(x, y) ? '#' : '+')
rescue
print "X"
end
end
print "\n"
end
print "\n"
end

grapher(0, 0, 40, 10){|x,y| x == y}
grapher(0, 0, 40, 10){|x,y| 2 >= y**2 / x}
grapher(0, -5, 60, 10){|x,y| y == (5 + Math.sin(x) * 5).to_i}
grapher(-10, -5, 70, 10){|x,y| y**2 == x}

Output:

++++++++++#++++++++++++++++++++++++++++++
+++++++++#+++++++++++++++++++++++++++++++
++++++++#++++++++++++++++++++++++++++++++
+++++++#+++++++++++++++++++++++++++++++++
++++++#++++++++++++++++++++++++++++++++++
+++++#+++++++++++++++++++++++++++++++++++
++++#++++++++++++++++++++++++++++++++++++
+++#+++++++++++++++++++++++++++++++++++++
++#++++++++++++++++++++++++++++++++++++++
+#+++++++++++++++++++++++++++++++++++++++
#++++++++++++++++++++++++++++++++++++++++

X+++++++++++++++++++++++++++++++++#######
X+++++++++++++++++++++++++++#############
X+++++++++++++++++++++###################
X++++++++++++++++########################
X++++++++++++############################
X++++++++################################
X+++++###################################
X+++#####################################
X+#######################################
X########################################
X########################################

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+##+++++#+++++#+++++##+++++#+++++#+++++#+++++##+++++#+++++#++
+++++++#+++++++#++++++++++#+++++++++++++#++++++++++#+++++++#+
+++++++++#+++#++++++++++++++++++#+#++++++++++++++++++++++#+++
++++++++++++++++++++++++++++#+++++++++#++++++++++++++#+++++++
#++#+++++++++++++++#++++++++++++++++++++++++#++#+++++++++++++
++++++++++++++++++++++#++#+++++++++++++++#+++++++++++++++++++
++++++#+++++++++#+++++++++++++++++++++++++++++++++#+++++++++#
++++++++++#+#++++++++++++++++++#+++#++++++++++++++++++#+#++++
++++#+++++++++++++#++++++++++#+++++++#++++++++++#++++++++++++
+++++#+++++#+++++#+++++##+++++#+++++#+++++##+++++#+++++#+++++
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#++++++
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#+++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++#++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++#+++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++#++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++#++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++#+++++++++++++++++++++++++++++++++++++++++++++

http://github.com/fjc/rubyquiz/tree/master/176.rb

```