Posts: 157
Threads: 5
Joined: Mar 2013
Reputation:
60
To be honest, I don't like the idea of #include in CBot. CBot already supports public functions and classes, which provides pretty much the same needed functionality and can be easily extended in the future. There were discussion in the past about possibility of adding "program libraries" to some buildings for storage, so other robots can access functions and classes defined in them. #include would just duplicate a lot of code.
"After three days without programming, life becomes meaningless."
~The Tao of Programming
Posts: 825
Threads: 26
Joined: Oct 2012
Reputation:
90
From the other hand, such program may won't work with official builds. Anyway, we'll have to manage something, Code Battles will have quite big files (imagine all these programs after a few years, when more and more complex AI will be implemented there) and 700 lines for whole program might be quickly a serious limit.
Posts: 828
Threads: 26
Joined: Oct 2012
Reputation:
113
The limit is actually 20000 characters or 1000 lines
Posts: 43
Threads: 10
Joined: Sep 2015
Reputation:
21
The last time I hit the character limit at 701 lines, the editor
cut off at 20637, which I thought was strange, I knew it was set to 20000.
It made my LevelController script look like crap when I had to
strip out comments, tabs, and LF, just to finish it.
It also forced me to do some DRY clean up, so that was good.
I wanted to do more but LevelController command takes only one script, as far as I can tell.
Other motivations were:
- code re-use.
- cleaning-up the program folder.
- writing large programs that are easy to navigate.
- random bugs when using the game's editor.(might be fixed already)
- virtually no limit to program length.
- just to see if the game would accept a large program.
- it was becoming impossible to improve my code battle program.
fix or improve one part of code(recompile 10 programs).
add a function, works good, start a new codebattle,
<error> <error> <error> <error> <error> <error>.
After my first failed(& ignorant) attempt at #include,
the second version, written from scratch, is way better.
I've been using it for more than a month already.
Anyway, I'm not trying to promote the idea, I'm just communicating.
Posts: 157
Threads: 5
Joined: Mar 2013
Reputation:
60
Program length limit should be removed. Static limit is not a good thing. There's no theoretical limit defined in CBot itself so the editor and CBot compiler should be able to process big files if necessary. Still, very large programs are not a good idea.
"After three days without programming, life becomes meaningless."
~The Tao of Programming
Posts: 43
Threads: 10
Joined: Sep 2015
Reputation:
21
For reference, my codebattle program + shooter program are currently 46kb, & 9719 tokens.
I broke it into separate programs to be organized and avoid editor bugs(probably fixed already).
That comes with the strict limitation of only referencing functions and classes
compiled previously in program storage, in other words:
If I wanted to share my codebattle program, I'd have to number the files
and provide stupid instructions on how to make sure it works.
This puts your main program at the bottom of program storage.(a minor inconvenience)
I suspect that most codebattle programs wouldn't reach 80kb, including mine.