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.

The 20 Line Challenge / [DBP] Places Carcassonne Tiles (13 lines, 1702 characters)

Author
Message
BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 16th Nov 2014 23:44 Edited at: 10th Apr 2015 07:21
Here's some code golf code I wrote in DBP (problem).

The code finds valid placements for tiles in the board game Carcassonne.
- map.png is the current state of the board
- next.png is the next tile to be placed (if it doesn't exist, uses a random tile 1-25.png)
- The tile is placed somewhere such that: (1) it touches at least one existing tile (2) the edges of all touching tiles match visually (3) if there is a move that does not cause an area of color on the board to be "closed off", that move is preferred
- The tile can be rotated
- map.png is overwritten with the result



I didn't count the #constants because they don't affect the line count, only the character count.

Media is attached.


Uncompressed but no less terrible:



On Steam!

Attachments

Login to view attachments
Derek Darkly
13
Years of Service
User Offline
Joined: 22nd Sep 2011
Location: Whats Our Vector, Victor?
Posted: 17th Nov 2014 03:07
Runtime Error -Not placed at line 17

(yes, pics are in same folder as code.)

BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 17th Nov 2014 03:13
Just try it again - that means there wasn't a valid spot for whatever tile it happened to be trying to use.

Golf code doesn't lead to good UI .

Login to post a reply

Server time is: 2024-11-21 08:32:50
Your offset time is: 2024-11-21 08:32:50