Skip to content

Instantly share code, notes, and snippets.

##Turn based ruby game
=begin
GOAL
Write a simple game that allows the user and the computer to take turns selecting moves to use against each other.
Both the computer and the player should start out at the same amount of health (such as 100),
and should be able to choose between the three moves:
The first move should do moderate damage and has a small range (such as 18-25).
The second move should have a large range of damage
and can deal high or low damage (such as 10-35).
##Turn based ruby game
=begin
GOAL
Write a simple game that allows the user and the computer to take turns selecting moves to use against each other.
Both the computer and the player should start out at the same amount of health (such as 100),
and should be able to choose between the three moves:
The first move should do moderate damage and has a small range (such as 18-25).
The second move should have a large range of damage
and can deal high or low damage (such as 10-35).
@CodePint
CodePint / binary_tree.rb
Created February 8, 2018 15:56
binary tree and nodes
class Node
attr_accessor :data, :left, :right
def initialize(data)
@data = data
end
include Comparable
def <=>(node)
Rails.application.routes.draw do
devise_for :users
resources :users do
resources :images
resources :reviews
end
resources :memberships, only: [:new, :create]
class CreateGyms < ActiveRecord::Migration[5.1]
def change
create_table :gyms do |t|
t.references :users
t.references :routes
t.string :gym_name, null: false
t.text :about
t.string :address
t.string :email
t.timestamps
# frozen_string_literal: true
class DeviseCreateUsers < ActiveRecord::Migration[5.1]
def change
create_table :users do |t|
## Database authenticatable
t.string :first_name, null: false
t.string :last_name, null: false
t.string :user_name, null: false
t.string :email, null: false, default: ""
@CodePint
CodePint / comment_migration.rb
Created May 11, 2018 14:31
gist_send_route01
class CreateComments < ActiveRecord::Migration[5.1]
def change
create_table :comments do |t|
t.references :climbs
t.references :users
t.text :text
t.timestamps
end
end
end
# frozen_string_literal: true
class DeviseCreateUsers < ActiveRecord::Migration[5.1]
def change
create_table :users do |t|
## Database authenticatable
t.string :first_name, null: false
t.string :last_name, null: false
t.string :user_name, null: false
t.string :email, null: false, default: ""
<h1> Add a route to this gym <h1>
<br>
<%= form_for :route, url: { action: "create" }, method: 'post' do |f| %>
<div class="field">
<%= f.label :route_identifier %><br>
<%= f.text_field :route_identifier %>
</div>
<div class="field">
<%= f.label :grade %><br>
<%= f.text_field :grade %>
def new
@route = Route.new
@gym = Gym.find(params[:gym_id])
end
def create
if current_user.route_setter
#binding.pry