This site requires JavaScript, please enable it in your browser!
Greenfoot back
Super_Hippo
Super_Hippo wrote ...

2018/1/20

'code too large' error

1
2
Super_Hippo Super_Hippo

2018/1/20

#
That's what I did and you see with what I ended up ;)
xbLank xbLank

2018/1/20

#
You should avoid stuff like this after all. No project should look like this. I have no idea what you were tyring to achieve but this can be done in another way for sure. Thats what makes coding great. There are a million solutions to a problem. Its up to you to pick the for your case most beneficial one.
Yehuda Yehuda

2018/1/21

#
@일리아스 Can you name (one)/(a few) of those million solutions. How do you think the "stuff" should look.
CxVercility CxVercility

2018/1/21

#
Yehuda wrote...
@일리아스 Can you name (one)/(a few) of those million solutions. How do you think the "stuff" should look.
Its hard to say how he could've done his project without knowing what it does, but the principle can be applied to anything Here's 3 different ways to add 5 to an integer
x = x+5;

for(int i=0;i<5;i++){
x++;
} 

int y = x+5
while(y>x){
x++;
} 
danpost danpost

2018/1/21

#
Super_Hippo wrote...
So instead of "take element with index i" I have to count the spaces in the string then. This seems quite complicated and/or bad cpu-wise, but it could work.
Actually, it would not be that hard to work with. You could use the split method to create a temp arrray that breaks up the string into its individual parts. Then use charAt on the particular part required.
Super_Hippo Super_Hippo

2018/1/21

#
There isn't such an easy system behind the numbers that I could create them with loops. I am not sure how to say it in English, but basically the numbers represent the state of a traffic light when one phase changes to another. @danpost: I will try it, thank you.
You need to login to post a reply.
1
2