Posts

Showing posts from September, 2018

Braitenberg Vehicles – v1.0

Image
For our Braitenberg Vehicles project, we were to create Braitenberg's first four cars. The basic idea behind these vehicles is that each vehicle has a set of sensors and motors. The sensors cause the motors to move: either speed up or slow down. By connecting different sensors to different motors, you can cause the cars to have different movements. Math: Math!! Although I usually start with the visual side of these projects, this time I wanted to first figure out how the vehicles would move on-screen. Getting Around The first car, Getting Around , was pretty simple. The light intensity, taken from the sensor, directly correlates to the y-position of the car. At this point, I threw together some basic graphics using the handy-dandy StdDraw library and a few JPEGs. You can see the final Getting Around  car to the right. Implementing two motors and sensors, however, was much more challenging. At first, I was trying to calculate the distance each motor would travel

GridWorld – v1.0

Image
My second assignment was to create a pathfinding program called GridWorld, not unlike an old  AP Case Study . User Interface Again my first priority was the interface. Using the trusty library StdDraw, I used the same sort of grid pattern that I used in my Game of Life program. This time, by using images to form the grid instead of individual rectangles, I didn't have to worry about borders between the cells or any other extra buffer. The final UI can be seen in the picture.  However, this time, instead of creating buttons on the canvas itself, I opted to use Swing, the GUI toolkit included in Java. This helped me create buttons and a "Control Panel" (right), which was much easier than using StdDraw's graphics and listening for a mouse click. The Game As we are learning about Agents in my Artifical Intelligence class, this project contains an Agent, which is the player. The Agent loops through three phases: sense, decide, and act. In Gridworld, the P