He said that for even number of times, or something like that, it will end up in the to Queue at the end.
I knew that my code was closer, but you said it wasn't replacing like it should.
I...
Type: Posts; User: javapenguin
He said that for even number of times, or something like that, it will end up in the to Queue at the end.
I knew that my code was closer, but you said it wasn't replacing like it should.
I...
Is that with mine or with yours or with both?
:confused:
What is wrong with:
// this class takes in productions and generates turtle commands.
import java.util.ArrayList;
import java.io.*;
import java.util.*;
public class program6_part_3
{ //...
// this class takes in productions and generates turtle commands.
import java.util.ArrayList;
import java.io.*;
import java.util.*;
public class program6_part_3
{ // beginning of class
...
Just got a response back.
Am I doing it right?
Why are you popping from "from"?
// this class takes in productions and generates turtle commands.
import java.util.ArrayList;
import java.io.*;
import java.util.*;
public class...
Not to seem like an idiot, but I have never done a switch structure before.
How would you fix this code to get one and then work for the last step?
// this class takes in productions and...
Here's what he said for part 3:
Part 3: Generating Turtle Commands
Many of the above files for turtle commands have been generated algorithmically. This is done by using “productions”. A...
For the code:
for (int iter =0; iter < numberOfIterations; iter++)
{ // beginning of for
for (int iter2 = 0; iter2 < from.Size(); iter2++)
{ // beginning of for...
Ok, but I'm only reading in from "from" and putting stuff in "to": How does he want me to swap it?
I'm wondering if he means to then do the same with to and read it into from, then do the same...
Does my code do that?
If not, how do I do that?
~X(~X(~X(~X(~X(~X(~X(~X(~X(~X(~X(^:)^
I want str to contain right hand side.
c contains left hand side
Did I do something wrong?
Any idea what he means by swap "from" and "to"
Here's what he said:
4. For each iteration:
a. For each character that you remove from the “from” queue:
i. If it is the left side of any...
How do I get it so that it'll check to see if the thing is in any of the productions?
Right now it'll just check to see if is in the last production at the end of the for loop.
// this is class StateOfTurtle, it has a constructor to set the x,y, and angle values. It calls setX(), setY(), and setAngle().
// it has a method to return the StateOfTurtle object. It also has...
Ok, is my line of codes
for (int penguin = 0; penguin < numberOfProductions; penguin++)
{
// should read in single character that is on left side of production.
c =...
Well, you get the picture. It won't let me upload anymore.
I hope they fix that glitch soon!
Uploading more files.
Also, are there any typos in the part 2 files? The part 2 files are the text files I'm uploading now, the previous set were the part 3 files, and all code blocks but the...
I already took care of that part.
I was just wondering if it would work for part 2?
These will help.
As will the next load of files.
That will make things easier to understand what I'm...
// this is class StateOfTurtle, it has a constructor to set the x,y, and angle values. It calls setX(), setY(), and setAngle().
// it has a method to return the StateOfTurtle object. It also has...
Well, how do you copy the StateOfTurtle object into an exact copy, but independent copy, of that object?
It shouldn't change references when the original StateOfTurtle object does. In other...
public class StateOfTurle
{
private float x;
private float y;
private float angle;
public StateOfTurtle(float x, float y, float angle)
{
x = this.x;
y = this.y;
I'm kind of editing them up above so that I don't keep having to post the same info over and over again with just a few alterations.
Also, I think I've figured out what to do for part 2 and kind...
public void remove(int index)
{
if ((index<0) || (index>=size))
{
JOptionPane.showMessageDialog(null, "You cannot remove an out-of-bounds value!", "Invalid removal",...
Ok, I think it's fixed now. Now any idea how I can do part 3?