diff --git a/app/controllers/dice_controller.rb b/app/controllers/dice_controller.rb
new file mode 100644
index 0000000..04a709f
--- /dev/null
+++ b/app/controllers/dice_controller.rb
@@ -0,0 +1,20 @@
+class DiceController < ApplicationController
+ def render_homepage
+ render({ :template => "dice_templates/homepage" })
+ end
+
+ def roll
+ @number_of_dice = params.fetch("dice").to_i
+ @how_many_sides = params.fetch("sides").to_i
+
+ @rolls = []
+
+ @number_of_dice.times do
+ dice = rand(1..@how_many_sides)
+
+ @rolls.push(dice)
+ end
+
+ render({ :template => "dice_templates/results" })
+ end
+end
diff --git a/app/views/dice_templates/homepage.html.erb b/app/views/dice_templates/homepage.html.erb
new file mode 100644
index 0000000..3ec94a7
--- /dev/null
+++ b/app/views/dice_templates/homepage.html.erb
@@ -0,0 +1,15 @@
+
Dice Roll
+
+
diff --git a/app/views/dice_templates/results.html.erb b/app/views/dice_templates/results.html.erb
new file mode 100644
index 0000000..ddf6748
--- /dev/null
+++ b/app/views/dice_templates/results.html.erb
@@ -0,0 +1,13 @@
+<%= @number_of_dice %>d<%= @how_many_sides %>
+
+
+ <% @rolls.each do |a_roll| %>
+ -
+ Result: <%= a_roll %>
+
+ <% end %>
+
+
+
+ Roll <%= @number_of_dice %>d<%= @how_many_sides %> again
+
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
index ee25e18..652da65 100644
--- a/app/views/layouts/application.html.erb
+++ b/app/views/layouts/application.html.erb
@@ -5,9 +5,27 @@
+
+
-
- <%= yield %>
+
+
+
+
+
+ <%= yield %>
+
+
diff --git a/config/routes.rb b/config/routes.rb
index bdb9595..95d2d10 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,4 +1,5 @@
Rails.application.routes.draw do
- # This is a blank app! Pick your first screen, build out the RCAV, and go from there. E.g.:
- # get("/your_first_screen", { :controller => "pages", :action => "first" })
+ get("/", { :controller => "dice", :action => "render_homepage" })
+
+ get("/process_roll", { :controller => "dice", :action => "roll" })
end