View Full Version : othello programing challenge
magicwand
06-13-2004, 09:03 AM
will accept entry until July 31th or even longer if ppl request it :)
and will compete on League format(i think that is what they call)
meaning one will compete with every other player.
read thread from general chat forum for general info.
http://www.actionscript.org/forums/showthread.php3?t=48593&goto=newpost
lets force the move under 1 minute.
if i missed some detail i should mention.
please inform me..
i work full time and have very little time to work on this..
but i will do my best to win.
:D
Start the challenge!~!~!~!~!~
McGiver
06-13-2004, 09:12 AM
1 minute???
I would say 20 seconds on a P3 1ghz should be more than enough. You should not try to precalculate the whole game!
---------------------------------------------------------------------
the stage will load your swf and call a function named "ai".
it will also give a copy of an array containing the whole information you will need in your function. Your function will return an array with the x and the y coordinate of your turn.
example for your function
function ai(infoarray) {
return (/*any x between 0 and 7 i.e.:*/ 4, /*any y between 0 and 7 i.e.:*/ 5);
}
the infoarray will contain the current player (you)
and an array with the current field.
infoarray= [Current_Player, Current_Field_Array];
with Current_Field_Array containing 8 arrays with the x rows, containing 8 arrays with the y fields.
trace(infoarray[1][3][5]) //aka infoarray[1][x][y]
will return the owner of the field x=4, y=6 which is either
0 (empty)
1 (player1)
2 (player2)
so an example for an infoarray would be
infoarray=[1,[
[0,0,0,0,2,0,0,0],
[0,0,0,0,2,0,0,0],
[0,0,0,0,2,0,0,0],
[0,0,0,1,2,0,0,0],
[0,0,1,1,2,0,0,0],
[0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0]
]]
so the fields
[2][4]
[3][3]
[3][4]
are yours (infoarray[1][2][4]==infoarray[0])
and
[4][0]
[4][1]
[4][2]
[4][3]
[4][4]
belong to your enermy
Your function has to return a legal turn (legal x and y coordinates)
legal turns in the upper example are
[5][1]
[5][2]
[5][3]
[5][4]
so your function could
return([5,1])
if you return an invalid turn, you will lose. if your function does not return a turn within the the time limits, your movie will be unloaded and you loose.
-------------------------------------------------------------------
You are not allowed to use
- other code from outside the swf (you may not load an other swf, nor you may pass the variables to an extern script that may calculate your thing,...)
- any _global tag
- any _level tags (i.e.: _level0)
- any setInterval tags
- any on or onClipEvent statements (i.e. onEnterFrame)
- any code outside functions or prototypes (i.e. code that will be called when the movie loads)
-anything that may influence the variables on the stage (_level0) and anything that will run after the return of your answer (i.e. setInterval wit huge for loops that will slow down the other player) that I forgot to name here
You are allowed to use
- _root tag (since the stage will apply flash7's _lockroot on the subswfs )
- as many functions and prototype functions as you want
so basically your swf has to contain a function with the name "ai" that will return a valid turn. the stage size of your Movieclip should be 50x50 and can contain some avatar.
I am still working on the stage, but I have only few time at the moment.
I have to learn, because there (maybe) is a school test on tuesday or wednesday. We have a print date that is much too early for our school newspaper, so I have to work for that too.
My mother is in hospital for pneumonia (she got it from my grandma who is in hospital too), and I visit my ma at least 1 time a day there. I actually got pneumonia too, and I am feeling a little sick now, but I can't allow myself to get really ill or go to hospital, because I won't be abled to finish my work then. (and there would be noone cooking for my little brother and my dad (who is an abolute incapable cook).
magicwand
06-13-2004, 09:19 AM
ok 30 second is enough
:)
magicwand
06-13-2004, 09:21 AM
i mean 20:
farafiro
06-13-2004, 09:30 AM
heheheeeee
20 is cool
okey, who is the first poster??
magicwand
06-13-2004, 10:11 AM
i have invited marshdabeachy from bit-101
he already finished good othello program.
lets hope he comes.
McGiver
06-13-2004, 11:09 AM
hmm even 5 seconds should be enough (still a very long time)
but if people want we can say 20 seconds
McGiver
06-20-2004, 04:19 PM
I didn't forget it, I was just bound to bed with my pneumonia.
As soon as I get up to date with my work, I will do this next :(
CyanBlue
06-20-2004, 04:48 PM
Hey, hope you get better, McGiver... We all want you to... :)
farafiro
06-21-2004, 02:08 AM
We all want you to... :)
lol
WE or YOU
:p:D
dzy2566
06-21-2004, 08:01 AM
Dude, pneumonia???!! That's crazy, get well soon.
if(McGiver._health == pneumonia){
McGiver.onEnterFrame = function(){
McGiver.eat(chickenSoup);
McGiver.getRest();
if(McGiver._health == allBetter){
McGiver.returnToASorgForums();
delete this.onEnterFrame;
}
}
}
:)
McGiver
06-21-2004, 08:58 AM
if(McGiver._health == pneumonia){
McGiver.onEnterFrame = function(){
McGiver.eat(nochickenSoup,vegetarian==true);
McGiver.getRest();
if(McGiver._health == allBetter){
McGiver.writeBelatedTestTomorrow();
McGiver.finishOthelloStage();
McGiver.writeOthelloTutorial()
McGiver.returnToASorgForums();
delete this.onEnterFrame;
}
}
}
thanks guys :)
farafiro
06-21-2004, 09:00 AM
lol
I think it go as if ... else if
and don't use delete for future ifs'
:p
magicwand
06-21-2004, 11:08 PM
McGiver <---smart dude.
since i started this i have to summit something that works :)
let us see who will be the first to summit.
i think it will be McGiver..but..you never know.
just one question...
if both function name is AI then wont you have problem?
i was thinking it dont you have to name two function different?
ai1 and ai2?
correct me if i am wrong.
other than that i think rule is very clear.
thanks McGiver
McGiver
06-23-2004, 11:19 AM
if I load an swf into another, you can access its functions using the path the swf is loaded+function name
like
_root.mymc.loadMovie("test.swf")
_root.onEnterFrame=function(){
trace(_root.mymc.mystrangefunction("hallo"))
}
will call a function called "mystrangefunction" with the variable "'hallo'" in "test.swf"
magicwand
06-29-2004, 06:09 PM
McGiver
is your cold ok?
i hop u feel better.
and finish what you promised.
:)
McGiver
06-30-2004, 12:15 AM
and finish what you promised.
hmm, seems like you won't let me forget about this ;)
cold is already gone for some time, current subterfuge is I just made my final exams, and one party follows the other :D
ok, I promised it, so I will finish it :)
magicwand
07-19-2004, 07:50 PM
HUM....
McGiver!!!!!!
if you are busy...i will finish the arena.
i was very very busy during past 2 weeks.
now i am kinda ok..
i will try to finish the arena this week..
if you finish before mine, let me know.
if this challenge is successful(what ever that means),
i will start another challenge that will actually pay money.
i will talk about that later.
:)
vBulletin® v3.7.1, Copyright ©2000-2008, Jelsoft Enterprises Ltd.