Difference between revisions of "User talk:Hapiel"

From Robowiki
Jump to navigation Jump to search
(Welcome and reply!)
Line 1: Line 1:
 +
 +
{| width="100%" style="background: white; "
 +
| valign="top" width="60%" style="border: 2px solid #000; padding: .5em 1em; -moz-border-radius: 1em; -webkit-border-radius: 1em; border-radius: 1em" |
 +
'''Welcome!'''
 +
 +
Hello, {{BASEPAGENAME}}, and welcome to [[RoboWiki]]! This place contains a wealth information about [[Robocode]], from [[Head-On Targeting|basic]] to [[Wave Surfing|more advanced]]. I hope you enjoy creating robots and being a robocoder!
 +
 +
If you are posting a comment on this wiki, please [[wikipedia:Wikipedia:Signatures|sign]] your messages using four tildes (<nowiki>--~~~~</nowiki>); this will automatically insert your username and the date stamp. If you are not familiar with MediaWiki, these links might help you out:
 +
* [[wikipedia:How to edit|How to edit]] on [[wikipedia:|Wikipedia]], [[metawikipedia:Cheatsheet|Cheatsheet]] and [[metawikipedia:File:MediaWikiRefCard.pdf|Reference Card]] of MediaWiki on the [[metawikipedia:|Meta Wikipedia]].
 +
* [[RoboWiki:ReadMe|Readme]] page.
 +
If you need [[Help:Help|help]], check out the [[Robocode/FAQ|frequently asked questions]] or ask it on this page. Again, welcome!
 +
 +
—— RoboWiki Administrators
 +
|}
 +
 +
----
 +
 
Hello guys,
 
Hello guys,
 
I see some of you chat around on talk pages, and as there is no real question forum for Robocode or any other kind of community where the beginning programmer (me) can get answers on his stupid questions I am going to try it out here.
 
I see some of you chat around on talk pages, and as there is no real question forum for Robocode or any other kind of community where the beginning programmer (me) can get answers on his stupid questions I am going to try it out here.
Line 29: Line 46:
  
 
Hapiel --[[User:Hapiel|Hapiel =)]] 22:29, 12 January 2011 (UTC)
 
Hapiel --[[User:Hapiel|Hapiel =)]] 22:29, 12 January 2011 (UTC)
 +
 +
Greetings and welcome to the Robowiki! Lots of chat on talk pages indeed, in fact that's the primary use of this place I'd say. A little different than some other wikis.
 +
 +
Anyway, I haven't tested, but looking at that code, I'm pretty sure what you're missing an 'execute' call after 'setTurnRadarRight'. Without the 'execute' call, your loop will immediately skip to the top again, and run 'setTurnRadarRight' over and over without "telling" the robocode engine "I'm done my turn". Make sense?
 +
 +
--[[User:Rednaxela|Rednaxela]] 01:14, 13 January 2011 (UTC)

Revision as of 02:14, 13 January 2011

Welcome!

Hello, Hapiel, and welcome to RoboWiki! This place contains a wealth information about Robocode, from basic to more advanced. I hope you enjoy creating robots and being a robocoder!

If you are posting a comment on this wiki, please sign your messages using four tildes (--~~~~); this will automatically insert your username and the date stamp. If you are not familiar with MediaWiki, these links might help you out:

If you need help, check out the frequently asked questions or ask it on this page. Again, welcome!

—— RoboWiki Administrators


Hello guys, I see some of you chat around on talk pages, and as there is no real question forum for Robocode or any other kind of community where the beginning programmer (me) can get answers on his stupid questions I am going to try it out here.

I have very little experience programming, not too much. I get demotivated quickly, because small errors or problems have huge impact on your programs, and I have never found a good solution for that ;). However, somehow when I saw robo soccer on tv I thought I should try robocode once more!

Aaah, I have a question!

while (true) {
			if (getX() <= 100 || getY() <=100 || getBattleFieldWidth() - getX() <= 100 || getBattleFieldHeight() - getY() <= 100) {
				reverseDirection();
			}
			waitFor(new RadarTurnCompleteCondition(this));
			

			setTurnRadarRight(360);
			
			
		}

So, this is a bit of an edit on one of the samplebots, Crazy. Does not matter much. As you can see I wrote an ugly not working system to detect if my robot is close to a wall. However, it does not work.

It only detects the wall if I replace the waitFor code with execute;, but in that case my radar is constantly spinning (right now my onScannedRobot code prevents it from spinning continiously).

I hoped I would be able to create an IF thingy to check if the radarturn was finished, or create an event on radarturncompletion, but was not able to figure it out! How exactly do conditions work? What does the (this) in the radarturncompletecondition code stand for, and what would be a simple/proper solution to my problem? Please let me know, any help is welcome!!

Hapiel --Hapiel =) 22:29, 12 January 2011 (UTC)

Greetings and welcome to the Robowiki! Lots of chat on talk pages indeed, in fact that's the primary use of this place I'd say. A little different than some other wikis.

Anyway, I haven't tested, but looking at that code, I'm pretty sure what you're missing an 'execute' call after 'setTurnRadarRight'. Without the 'execute' call, your loop will immediately skip to the top again, and run 'setTurnRadarRight' over and over without "telling" the robocode engine "I'm done my turn". Make sense?

--Rednaxela 01:14, 13 January 2011 (UTC)