Friday, September 28, 2012

How to Create a Simple Yes/No Dialog with a User

One of the students today in class asked me if there was some easy way to limit the choice of responses from the user when starting the Last-Coin Game. Here is a short program which demonstrates how the built-in dialog features of java can be used.

You are welcome to use this feature in your program for the Last-Coin Game (or you can come up with your own).


import javax.swing.JOptionPane;


public class YesNoDemo {

public static void main(String[] args) {


int response = JOptionPane.showConfirmDialog(null, "Click Yes or No",
                                       "Do you want to go first?", JOptionPane.YES_NO_OPTION);

if (response == JOptionPane.YES_OPTION)
System.out.println("User wants to go first");
else
System.out.println("User wants computer to go first");

}

}

Tuesday, September 25, 2012

How to Create an Unbounded Grid in GridWorld

You may find it convenient to change over from a simlple (bounded) grid to an unbounded grid to help you test your SpiralBug, etc. The way to do this is to add this 2nd line of code to the tester class right after you create the world:

ActorWorld world = new ActorWorld(); // this is the line of code you already have in your tester class
world.setGrid(new UnboundedGrid());  // this is the line of code you need to add

It will then be easier to see the spiraling patterns.

You will also need to add these import statements to the top of your code:


import info.gridworld.grid.*;
import info.gridworld.world.*;

Mr. Sarkar

Saturday, September 22, 2012

New Deadline for Latest Homework Assignment

The deadline for the Bug Variations (both the ones I assigned - RetroBug, RectangleBug, and MonotoneBug) and the Juno Assignment: GridWorld Part 2: Bug Variations is being extended.

The deadline which was previously this Monday is now being extended to Friday (9/28).

Mr. Sarkar

Monday, September 17, 2012

New Policy for Submitting Computer Projects

The emailing of screen shots is not working out well for grading your projects. 

In the future, when submitting projects, please follow these protocols:

For Coding Bat and Practice It Projects/Assignments


Enable teacher sharing and do nothing else. Do not email projects or submit paper. I will go on Coding Bat and Practice It and look at your work.

For All Other Computer Projects


You have three choices for submission:

  1. You can submit the project on paper. Please include a copy of the output attached to your documented code.
  2. You can email me your project (and the output) in a Microsoft Word document.
  3. You can email me your project(and the output) in a PDF file.
Mr. Sarkar


Thursday, September 6, 2012

Computer Art for the Lab

If some of you could print a full color copy of your "House With Sunrise," I will pin them up in the lab to shock and awe the other other classes that use the lab.

Extra credit for this? No. But you will have my thanks.

Mr. Sarkar