I'm finally talking about something other than 'RTanque'! I love 'RTanque' and I get to learn more about Ruby when I play around with the tank bots, but enough of 'RTanque' for now.
The edX Berkeley 169.2x SaaS course is almost over, I can't believe it, 1 more quiz and 1 more homework assignment, and it's over, it officially ends March 31st. The edX course is now having us starting to work with Javascript, so I've decided to try out 'FightCode' the tank battling game that uses Javascript, I figure that will be a fun way to learn more about Javascript.
I think Javascript makes you more valuable to any team, wether or not you like it, if you're talking to a browser than you are going to need it. I think If I was a coding super hero, I'd pick Javascript as my super power :)
It's been a really busy week of shoeing horses, it gets so busy this time of year, I love making more money but I 've gotten a little frustrated the past 2 days because I've only gotten to study for 2 hours per day.
I need to finish my assignment for the pet rescue site tonight, then tomorrow finish lecture videos for Berkeley's 169.2x final which is about 5-6 hours of videos, basically 2 weeks in 1. Homework and then a quiz due before Sunday at midnight, then they're are a ton of things I'd like to work on of my own.
I love being swamped with stuff to do coding wise, because I feel like no matter what I do I am going to be learning, in the same token, I don't want to fail and not get everything done. Oh why do I have to go work to make money?! I wish I could just stay home and code :) Okay enough sobbing, now to get to work on the pet rescue site.- Josh
Thursday, March 28, 2013
The end of Berkeley the beginning of Javascript
Tuesday, March 26, 2013
'RTanque' Part 3: Basic Targeting
This guide covers how to make a simple targeting tank bot with 'RTanque'.
(1) Making a basic 'RTanque' tank bot.
Now that you all have seen how to build a basic tank in part 1, and how to clone multiple bots in part 2, we are now going to show you how to make a simple bot that knows how to target other tanks.
class BasicBot < RTanque::Bot::Brain
Getting Started With 'RTanque' Part:1 of 4
class BasicBot < RTanque::Bot::Brain
NAME = 'basic_bot'
include RTanque::Bot::BrainHelper
def tick!
## main logic goes here
# use self.sensors to detect things
# use self.command to control tank
# self.arena contains the dimensions of the arena
self.make_circles
self.command.fire(0.25)
end
def make_circles
command.speed = MAX_BOT_SPEED # takes a value between -5 to 5
command.heading = sensors.heading + 0.01
end
end
(2) Now we add the targeting code to the BasicBot.
class BasicTargetingBot < RTanque::Bot::Brain
NAME = 'basic_targeting_bot'
include RTanque::Bot::BrainHelper
TURRET_FIRE_RANGE = RTanque::Heading::ONE_DEGREE * 1.5
# This is a constant, we don't want it to change,
# we use this constant in pointing_at_target? method,
#to make sure our tank's barrel is pointing at the target.
def tick!
## main logic goes here
# use self.sensors to detect things
# use self.command to control tank
# self.arena contains the dimensions of the arena
self.make_circles
if we_have_target
target = we_have_target
track_target(target)
aim_at_target(target)
fire_at_target(target)
else
self.scan_with_radar
end
# self.command.fire(0.25) replaced fire_at_target
end
def make_circles
command.speed = 5 #MAX_BOT_SPEED # takes a value between -5 to 5
command.heading = sensors.heading + MAX_BOT_ROTATION # or you can do something like 0.01 instead of MAX_BOT_ROTATION
end
def we_have_target
self.nearest_target
end
def nearest_target
self.sensors.radar.min { |a,b| a.distance <=> b.distance }
end
def track_target(target)
self.command.radar_heading = target.heading
end
def aim_at_target(target)
self.command.turret_heading = target.heading
end
def fire_at_target(target)
if self.pointing_at_target?(target)
command.fire(MAX_FIRE_POWER)
end
end
def pointing_at_target?(target)
(target.heading.delta(sensors.turret_heading)).abs < TURRET_FIRE_RANGE
end
def scan_with_radar
self.command.radar_heading = self.sensors.radar_heading + MAX_RADAR_ROTATION
end
end
This is an basic, easy guide to making an 'RTanque' a targeting tank bot. Next up part 4: "Making an "invincible" 'RTanque' tank bot.This is Part 3 of a 4 part series on 'RTanque' tank bot making. Cody Kemp @codesterkemp and myself Joshua Kemp @joshuakemp1 will be joint authors during this series.
Monday, March 25, 2013
Michael Hartl's Rails Tutorial and my 1.5 hour Rspec test!!!
My assignment for the side project pet rescue website is a little bit difficult for me, although I would never admit it out loud, so I decided to quickly do the Michael Hartl Rails tutorial again, I've done it before and my brother Cody wants some help tweaking it a little and making it into a different application, so why not help Cody out and for another reason.
In the tutorial if I remember correctly there is a section that deals with the modeling I need to do for the pet rescue website. I figure "Heck, final week of Berkeley edX 169.2x a quiz and homework all do by March 31st, a little work on the side project, why not quickly whip through a 60 hour tutorial in like 5 minutes right?"
As I'm working through the Michael Hartl Rails Tutorial I'm tweaking the names to the tests, and stuff, no bigs, I've done this before, I'll be done in no time flat, till I mess up the final rspec test. Anyway long story short, my quick easy fix, took me 1.5 hours to fix. Yes it was VERY simple. YES I should have figured it out in 5 minutes. NO I didn't so, in honor of that annoying rspec test I included today a screen shot of the test finally passing.
Oh that felt so good to finally get the rspec test to pass, you know the feeling if you've ever started randomly sobbing in Paneras for no apparent reason. If you don't know the feeling, keep coding and you will. - Josh
Sunday, March 24, 2013
Junior Developer RoR in 6 months or 182 days!
I changed my Twitter profile recently, but not my goal. My original goal was to become a Junior Ruby on Rails developer in 6 months, and at the time I just said "Hey my birthday is around 6 months away, heck let's make it April 7th, my birthday."
Well as time is running out, I want my FULL 6 months, (26 weeks) so I'm changing my 6 month date from my birthday April 7th to April 23rd 2013 which is exactly 6 months from the date I started October 23rd 2012. 182 days, 6 months or 500+ hours.
I'm hoping to leave a guideline or bench mark for others who come after me who want a rough idea on how to get from point A to point B as a self taught programmer, to becoming hired as a Junior RoR Developer.
This is the end of week 22 of my learning journey, and I didn't do as well this week, because we went to Baltimore's Inner Harbor for my wife's birthday for a few days and I was strictly forbidden to do anything computer related :)
I only put in 17 hours this week versus my typical 21.
My grand total hours of study after 154 days is: 442.50 hours, leaving me 28 days left till my 6 months is up. I should have around 535 hours of studying by then if everything stays on track.
When I hit 6 months of studying (April 23rd) I think I'm going to add another page on to my blog with a list of books and tutorials I've completed, that way others can see exactly what I've studied and also as a sort of online "Here's what I know", not 100% sure yet.
I still want to do a Hackathon this year, I also think I will give a "Lightning talk" at possibly Arlington Ruby Meetup on how to use 'RTanque' we'll see, I'm not too hot at public speaking, but hey gotta' start somewhere :) Code, code, code :) - Josh
Tuesday, March 19, 2013
Beginner's guide to 'RTanque' Part:1
This guide covers how to make a very basic tank bot with 'RTanque'.
(1) Making a basic 'RTanque' tank bot.
First and foremost go to https://github.com/awilliams/RTanque and clone the repo or, Adam has a Quick Start to get you started, which works well and is quick to set up.The code below is how to make a basic 'RTanque' tank bot, that basically does 3 things:
(1) Shoots,
(2) Adjustable speed,
(3) Circles,will not get stuck against walls.
self.command.fire(0.25) can be adjusted from 0.25 to 5 to change your rate of fire, with the small the number the less frequent, but more damaging and high velocity shot or just set it to MAX_FIRE_POWER to make sure your bot only fires the hardest punching shot.
command.speed = can be adjusted with a number like -5 or 5, or just set it to MAX_BOT_SPEED to make sure your bot is giving you all she's got.
command.heading = sensor.heading + 0.01 . if you decrease the 0.01 you will decrease the tightness of the circle.
class BasicBot < RTanque::Bot::Brain
Getting Started With 'RTanque' Part:1 of 4
class BasicBot < RTanque::Bot::Brain
NAME = 'basic_bot'
include RTanque::Bot::BrainHelper
def tick!
## main logic goes here
# use self.sensors to detect things
# use self.command to control tank
# self.arena contains the dimensions of the arena
self.make_circles
self.command.fire(0.25)
end
def make_circles
command.speed = MAX_BOT_SPEED # takes a value between -5 to 5
command.heading = sensors.heading + 0.01
end
end
This is an extremely basic, easy guide to making an 'RTanque' tank bot, however as the series goes along the final tank bot we'll be showing you how to make will be a force to be reckoned with. The tank is fittingly called "invincible".
This is Part 1 of a 4 part series on 'RTanque' tank bot making. Cody Kemp @codesterkemp and myself Joshua Kemp @joshuakemp1 will be joint authors during this series.Follow Me
POPULAR POSTS
-
Yes, obviously Free Code Camp is popular. It's supposed to make things easier for you to learn how to code. My problem is the length of...
-
I have always promised honesty and transparency with this blog. Last time I gave a review about Free Code Camp, I wasn't super supporti...
-
You need a Regular Expression to validate a phone number or a user's email address, so what do you do? Go onto StackOverflow and copy so...
-
What up peeps ! I feel like every day gets better and better, I just gotta' say life is good, No brag, just fact :-) I thought I woul...
-
Some things about development are not taught in college, some things about development are not even taught on the job. Some things you are j...



