Go to Post I HAVE IT PROGRAMMED!!!! Ive just been forbidden from testing it... they think ill make the bot explode. >.> - Got_POSTWAFFLE? [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Spotlight this post!  
Unread 08-09-2005, 15:23
sciguy125 sciguy125 is offline
Electrical Engineer
AKA: Phil Baltar
FRC #1351
Team Role: College Student
 
Join Date: Jan 2005
Rookie Year: 2004
Location: Sunnyvale, CA
Posts: 519
sciguy125 has a reputation beyond reputesciguy125 has a reputation beyond reputesciguy125 has a reputation beyond reputesciguy125 has a reputation beyond reputesciguy125 has a reputation beyond reputesciguy125 has a reputation beyond reputesciguy125 has a reputation beyond reputesciguy125 has a reputation beyond reputesciguy125 has a reputation beyond reputesciguy125 has a reputation beyond reputesciguy125 has a reputation beyond repute
Send a message via AIM to sciguy125 Send a message via MSN to sciguy125 Send a message via Yahoo to sciguy125
Re: Karel++ Noob help

Ok, I just took a crash course in Karel++. That was the fastest I've ever learned a new language. For those of you who are wondering, it turns out that Karel++ is the language you would get if LOGO and C++ had a child that was raised by BASIC (not sure how that works, but that's what it looks like to me).

Karel++ doesn't have a "for" loop, but it does have "loop" loop.

Code:
loop(5)
{
  move(); //calls move() 5 times
}
I'm not sure if it supports non-void functions (or "instructions" as they seem to be called). All the examples I found don't take or return parameters in the functions. Because of the way the language is designed, I suspect that the following code might work, but I don't have Karel++, so I can't test it.

Code:
void movenum(n)
{
  loop(n)
  {
    move();
  }
}
Just as some general advice: Whenever possible, it's a good idea to make multipurpose code. Your example of using 15 separate functions works, but it's not very clean. If you wanted to expand it for some reason, you might have a hard time doing so because it only does one thing. It also makes it hard to read any code that uses those functions.
__________________

-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GE/S/P a-- e y-- r-- s:++ d+ h! X+++
t++ C+ P+ L++ E W++ w M-- V? PS+ PE+
5- R-- tv+ b+ DI+++ D- G
------END GEEK CODE BLOCK------
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 21:10.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi