![]() (On Linux and Unix systems, ‘greenfoot’ is an executable shell script. The installation process has installed an application named ‘greenfoot’. It is aimed at a target audience of students from about 14 years old upwards, and is. If not, then you need to start Greenfoot now. My main point is about the readability of the code. Greenfoot is an educational integrated development environment aimed at learning and teaching programming. Of course picking at the cost of individual instructions is not really constructive here (it's unlikely to make a measurable performance difference, regardless of which alternative you choose). At machine code level, on most architectures, the original two lines would probably boil down to 2 machine instructions (after the getX() method call was complete): a compare instruction, and a conditional move instruction - whereas the single line you suggest, if compiled literally, requires a relatively expensive divide instruction followed by a multiply instruction (which is also relatively expensive, though less so than a divide). ![]() Do you find this easier to read or do you think it would be more efficient? I personally find the original easier to understand in terms of intention, and suspect it would be more efficient also. Greenfoot is an educational integrated development environment aimed at learning and teaching programming. Finally select GreenfootScenarioMain as main class, this allows you to launch Greenfoot programs from within IntelliJ. ![]() I would use 'int newCoord = (1-getX()/9)*9 ' to replace lines 4 AND 5, myself. Finally, we will not discuss getNeighbors() and intersects(), as those methods are only useful for Greenfoot scenarios that contain worlds that are created. Basically you add bluejcore.jar and greenfoot.jar (found in your installation directory of Greenfoot) as your project libraries and create a properties file (details in the link) for Greenfoot. Licenced by NCC and professional Network engineers/Tech persons available.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |