Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / - DBPro Coding Challenges -

Author
Message
chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 11th Apr 2010 01:14
Hi all.I have been ajusting an old game I made time ago...trying to make all media with code, and trying to get sounds working...but for a game without media, it is hard to do some kind of thins.I would like to add much more...and perhaps in a new version. I hope you enjoy it !





cheers.

I'm not a grumpy grandpa
Valle
18
Years of Service
User Offline
Joined: 10th Mar 2006
Location: in your girlfriends bed
Posted: 12th Apr 2010 01:16
that's funny, not bad without media!
but i can't kill the sheriffs


baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 12th Apr 2010 10:39
Well I'm back from my holiday so I'll take a look and choose a winner from the current entries (as follows):

chafari

...shouldn't take too long!
[/sarcasm]

chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 12th Apr 2010 20:55 Edited at: 13th Apr 2010 18:29
Hi guys!!
@Valle
Yeaah some times it is hard to kill him...I didn`t had enough time ...I have been very busy with the divorce paperwork... my wife is gonna kill me when I say her I have to set the new challenge.

@baxslash
You run far away I guess you are worn out from your vacations...some are lucky.

Let me think about the new challenge.

cheers.

I'm not a grumpy grandpa
chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 12th Apr 2010 23:37
Hi there.
For this new challenge, try to make the ocean, with waves and foam.You can add a ship a seagull or whatever you want to make it more realistic.

The deadline will be in 10 days time the 22th of April 24:00

cheers.

I'm not a grumpy grandpa
BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 13th Apr 2010 04:28 Edited at: 13th Apr 2010 06:58
Hey, haven't done one of these in a while, but this one sounded like a nice challenge so I jumped right into it.

I've just got some wave motion at this point - got a ways to go on the graphics. But this should be the hard part, right?

(Adjustable parameters on line 5)



Quote: "I didn`t had enough time sa heve been very busy with the divorce paperwork... my wife is gonna kill me when I say her I have to set the new challenge."

Hard times...good luck.

Nathan C
14
Years of Service
User Offline
Joined: 26th Jan 2010
Location:
Posted: 13th Apr 2010 05:44
@BMacZero i get an error at line 99 "Parameter for 'MAKE OBJECT' do not match 'Object Number, Mesh Index, Image Number' at line 99."
BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 13th Apr 2010 06:59
What DB version do you have? Mine says the Image Number is optional.

In any case I changed it to use a dummy texture.

baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 13th Apr 2010 10:52
@BMacZero, works fine for me on U74.

Very nice wave effect! Unfortunately as much as I don't want to do another challenge @chafari has tickled my inspiration gland again (also no Holidays planned till Xmas)...

chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 13th Apr 2010 17:22
OK ...if we all agree, we have 10 days.

@BMacZero
Nice code...with the camera close to it and a texture is gonna be great!.


cheers.

I'm not a grumpy grandpa
acelepage
20
Years of Service
User Offline
Joined: 2nd Jun 2004
Location: Plattsville
Posted: 13th Apr 2010 22:27
Haven't submitted in a while so I thought I'd throw one in here.

The foam texture is a bit repetitive, but I think the motion adds to the texture of the water.


( 2b || !2b ), that is the question. The answer: true
chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 14th Apr 2010 01:01
Heeyy!!. Good job acelepage...very soft like good weather sea.


Here is my crap of sea so far



cheers.

I'm not a grumpy grandpa
BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 14th Apr 2010 03:01
Aggh, ace always shows up when I'm working on an entry .

Those both look quite good, it's hard to believe that's just a randomized matrix, chafari!

BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 14th Apr 2010 06:13 Edited at: 14th Apr 2010 17:09
A lot of progress:

[See a few posts down!]

Beware if you get seasick easily!
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 14th Apr 2010 10:18
Quote: "Here is my crap of sea so far"

All aboard the chafari boat!!

@BMacZero, I get an illegal image size for your 'get image' at about line 170? Any idea why?

Kira Vakaan
15
Years of Service
User Offline
Joined: 1st Dec 2008
Location: MI, United States
Posted: 14th Apr 2010 13:31
Wow, these are looking good

It's been forever since I've done one of these, but chafari's challenge got me thinking again.

Here's what I'm working on. At the moment, I'm just working on getting the waves to move correctly and I'll worry about textures later.

I wrote a function to create a bit of Perlin noise for the waves, but as you can see, I'm having a bit of an issue with the seams

chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 14th Apr 2010 14:57
@BMacZero
Yeah...it was just for fun...I`m getting lazy
I`m on the same boat as baxslash, error on file 170 ???

@baxslash
heyy!! you`r late...the boat is gone !!..

@Kira Vakaan
I would like to manage memblock as good as you ...nice sea!!... I colored on blue, and look even better .

I have to say with my bad english, that I`m very glad, as this is one of the first times I have seen so many participants in just two days.

cheers.

I'm not a grumpy grandpa
BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 14th Apr 2010 16:23 Edited at: 14th Apr 2010 17:11
Quote: "@BMacZero, I get an illegal image size for your 'get image' at about line 170? Any idea why?"

Gah, no one's computer likes my images! I have no idea about that one.

Made the image smaller and added SET DISPLAY MODE:


Any luck?
acelepage
20
Years of Service
User Offline
Joined: 2nd Jun 2004
Location: Plattsville
Posted: 14th Apr 2010 16:42
@BMacZero,
I got the same error, but placing the set display mode at the beginning fixes it.
I really like the water texture. It turned out quite good from random dots.

( 2b || !2b ), that is the question. The answer: true
BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 14th Apr 2010 17:10
Thanks! Problem solved, yay!
chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 14th Apr 2010 20:14
@BMzcZero
Wow!!, that`s awesome !!. the swing of the buoy make it more realistic.In your line 36, I made a change and looks (ôô) very cool!! I`m loving it !!,I will keep it under my pillow.




cheers.

I'm not a grumpy grandpa
BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 15th Apr 2010 02:31
Thank you, chafari! The fresh sea breeze must make it easier to sleep . I have to admit I don't really see the benefit of your change, though...it cuts off the water right at the buoy, eliminating the depth you get from seeing the waves behind it.
chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 15th Apr 2010 12:22
@BMacZero
You are right ..it cuts off the water behind the buoy...I was just making changes to see the difference.

cheers.

I'm not a grumpy grandpa
BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 19th Apr 2010 06:37
Final Version, since I'm spending all my coding time on pathfinding right now.



baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 19th Apr 2010 10:47
@BMacZero, wow, nice work!! I'll be learning from this one...

chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 19th Apr 2010 14:17
@BMacZero
Tha`s cool!! , now waves are more realistic.You are a crack !!

cheers.

I'm not a grumpy grandpa
BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 19th Apr 2010 16:31
Thanks, guys! I learned a lot from this, too. First time I've ever really messed with memblock meshes to make an object from scratch (or even modify it).

Dared1111
18
Years of Service
User Offline
Joined: 25th Oct 2006
Location:
Posted: 21st Apr 2010 21:10
I'm going to participate in the next one. Need to get some "skillz".

Trial and error for the win...

Signature? There is no signature!
chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 23rd Apr 2010 11:53
Hi all.
It is hard to decide.
BMacZero
acelepage
Kira Vakaan
All three codes are very nice.The waves look nearly the same in all three codes.

Only one winner.....and the one I like best:

CONGRATULATION !!

cheers.

I'm not a grumpy grandpa
BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 24th Apr 2010 03:23 Edited at: 24th Apr 2010 19:35
Alright, thanks chafari!

How does everyone feel about another one of those AI challenges? I think maybe it was RUCCUS (not sure) that did one a while ago. Entrants have to make an AI for a simple game (for example, the last one was rock-papers-scissors). The AIs go head-to-head to see which is best.

chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 24th Apr 2010 19:21
Ok...I`v got some little projects

cheers.

I'm not a grumpy grandpa
Kira Vakaan
15
Years of Service
User Offline
Joined: 1st Dec 2008
Location: MI, United States
Posted: 24th Apr 2010 20:10
@BMacZero: Chess? It has easy base rules and many many possible positions, so there is a lot of room for strategy. I think that would be very interesting.

BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 25th Apr 2010 03:02
I've actually already got one made up for Battleship, I was just trying to see if enough people were interested in this sort of thing.

I think chess might be a little too in-depth for a short-term challenge like this - chess AI is something you could spend months on because it is ALL strategy.

BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 26th Apr 2010 23:31 Edited at: 4th May 2010 05:36
Okay, I don't hear any nays, so I'm going to give this a shot.

The next challenge is to create an AI for Battleship. The AIs created will each be run through the program three times, and the number of turns it takes to achieve victory will be recorded. The highest and lowest scores will be dropped. The player with the lowest remaining time will be the winner!

In the code below (the code that will be used to pit the AIs against each other), you are writing contents for the function on line 92 (AITarget1()). You can do (almost) whatever you need to (with exceptions, see below) to figure out what square on the enemy's board you need to hit this turn. You then store your choice in Target.X and Target.Y

The only resource you are allowed to access (other than those you create) is the function GetP2Board(X,Y). Each side of the board is a 10x10 grid, from 0 to 9. This function takes the coordinates and returns a 0 if that point has not been hit yet, a 1 if it has been hit and was a miss, a 2 if it has been hit and was an enemy ship, a 3 if it is part of a fully destroyed enemy ship, and a -1 if the coordinates were off the board (ex. number=GetP1Board(0,5)).



I look forward to seeing entries . The deadline is Saturday, May 8th.

baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 27th Apr 2010 18:54
I had a go at this so here's my entry. There are some globals that need to go in at the start somewhere (I assume that's OK as we're using functions?):


My AI doesn't check for adjacent ships so maybe if someone could add that to their code they'll have an advantage...

This was fun!

Valle
18
Years of Service
User Offline
Joined: 10th Mar 2006
Location: in your girlfriends bed
Posted: 27th Apr 2010 20:03
wouldn't this be much more interesting if each player could place their ships? Like this it's too much coincidence IMO, still interesting though


BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 28th Apr 2010 02:10 Edited at: 28th Apr 2010 02:22
@baxslash

Sure, I'll copy globals to the top, or you could just simulate it like this:



I just realized that I forgot to set a deadline.

I also noticed that unlike in Rock-Paper-Scissors, the two players in Battleship really have no direct interaction, therefore there is little to be gained from pitting two AIs against each other. I've altered the original competition post/judging stuff to reflect this. I changed the code too (compatibility is still the same).

@Valle
I don't think that would really add anything to the challenge, as this is a coding challenge and that part of it would just be theory of battleship rather than the coding aspect. Of course if anyone else thinks this would add something I'm open to supporting it .

baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 28th Apr 2010 08:50
Thanks @BMacZero, if I add anything more to my entry I'll make this change.

Quote: "I also noticed that unlike in Rock-Paper-Scissors, the two players in Battleship really have no direct interaction, therefore there is little to be gained from pitting two AIs against each other. I've altered the original competition post/judging stuff to reflect this. I changed the code too (compatibility is still the same)."

Good idea IMO!

I also agree with your opinion ReValle's idea.

Looking forward to seeing everyone's ideas! I always learn a lot from these posts!!



chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 28th Apr 2010 12:40 Edited at: 28th Apr 2010 12:42
Hi all.
@baxslash.I`v got an error at start. any idea?



I'm not a grumpy grandpa

Attachments

Login to view attachments
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 28th Apr 2010 12:50
@chafari, you have to paste my code into @BMacZero's code for the challenge (mine's just one function)

chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 28th Apr 2010 13:24
OooHH. I´m a fool ... sorry

cheers.

I'm not a grumpy grandpa
acelepage
20
Years of Service
User Offline
Joined: 2nd Jun 2004
Location: Plattsville
Posted: 30th Apr 2010 17:40
@baxslash,
I copied your code and took a look at it. I see 2 AITarget1() functions defined. I would like to test my code within your code, and am wondering if one of these functions is misnamed, or should it be deleted?

( 2b || !2b ), that is the question. The answer: true
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 30th Apr 2010 18:10 Edited at: 30th Apr 2010 18:12
Quote: "I see 2 AITarget1() functions defined"

Strange, I just had another look and there's only one function of that name in my code...

Maybe you've had one too many ?

...or if you are trying to pit mine against yours you'll need to make some edits to my function such as changing "AITarget1()" to "AITarget2()"
and "hit=GetP2Board(PrevX,PrevY)" to "hit=GetP1Board(PrevX,PrevY)"?

acelepage
20
Years of Service
User Offline
Joined: 2nd Jun 2004
Location: Plattsville
Posted: 30th Apr 2010 18:15
Grabbed the code again, and it is OK. I think I might have selected too much in the browser and grabbed your entry in the post right after the original code. My browser is acting odd today, but then, Windows is like that.
Sorry to bother. Will get to work now.

( 2b || !2b ), that is the question. The answer: true
BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 1st May 2010 02:00
Quote: "...or if you are trying to pit mine against yours you'll need to make some edits to my function such as changing "AITarget1()" to "AITarget2()"
and "hit=GetP2Board(PrevX,PrevY)" to "hit=GetP1Board(PrevX,PrevY)"?"

Remember that the new code now does not pit the AIs actually against each other, but evaluates them individually.

Also, even though I mentioned it before, I again forgot to set a deadline!

Let's make it Saturday, May 8th.

IBOL
Retired Moderator
20
Years of Service
User Offline
Joined: 30th Mar 2004
Location: @IBOL17
Posted: 3rd May 2010 00:50
Quote: "The only resource you are allowed to access (other than those you create) is the function GetP2Board(X,Y). Each side of the board is a 10x10 grid, from 0 to 9. This function takes the coordinates and returns a 0 if that point has not been hit yet, a 1 if it has been hit and was a miss, or a 2 if it has been hit and was an enemy ship (ex. number=GetP1Board(0,5)).
"


i may be giving awawy a bit, but can we have a value of 3, which indicates if a ship has been hit and SUNK...?

that is something players know in battleship...

(i haven't posted on here for 2+years, but this interests me.
i also don't have a working version of dbp, but i might try anyway)

thanks,
bob

Neuro Fuzzy
17
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 3rd May 2010 01:09
Quote: "i may be giving awawy a bit, but can we have a value of 3, which indicates if a ship has been hit and SUNK...?"

I second that motion.


BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 3rd May 2010 04:30
Agg, I didn't think of that...

Do you think just a value of three for a square with a sunk ship is sufficient? I guess in a normal battleship game you would know exactly what the sunk ship was and where it was.

That could get too complicated, though, so I like the 3 idea.

IBOL
Retired Moderator
20
Years of Service
User Offline
Joined: 30th Mar 2004
Location: @IBOL17
Posted: 3rd May 2010 05:56 Edited at: 3rd May 2010 06:08
i'm predicting that you are writing this, and debugging it now. so thank you very much, i will use it!

BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 3rd May 2010 06:01
Don't worry about it, I've got it done, just debugging it real quick and I'll put it up.

Also, too complicated? It's all of like 8 lines (okay, a few more now that I've added the destroyed-ship flag).

I'd like everyone to use the same function for copy-paste compatibility and fairness.

Login to post a reply

Server time is: 2024-11-24 04:36:15
Your offset time is: 2024-11-24 04:36:15