Android Question Dart board

Colin Evans

Active Member
Licensed User
Longtime User
Hi, I need to create a dart board, with four sections in each number (1-20 in standard dart board numbering), is this possible graphically?
 
Upvote 0
Lol I had to do a couple of nudges, away from VB towards B4X, and manually add Pane1 in the layout designer, but other than that, I'd call this a pass:


1758600775488.png


Code: Copy
using the b4j dialect of programming language BASIC,
and the B4XPages cross-platform framework,
please write code to draw a circular dartboard,
divided into twenty sectors,
numbered 1 to 20 but in usual dartboard sequence,
shaded alternately in red and green,
with each sector having double and triple zones (rings)
and a bullseye circle in the middle
Code: Copy
B4XPath does not have .ArcTo method,
so please change that to approximate an arc using short (~1 degree ) line segments
Code: Copy
Please use B4J Iif function instead of VB If function
 

Attachments

Upvote 0
Last edited:
Upvote 0
I find this incredible. Ideally the board should be rotated nine degrees anticlockwise but I am sure that will be a no-brainer for Grok.
 
Upvote 0
I tried with Copilot with this prompt. Had the same 9deg offset as others - but easy to fix

Prompt:
you know the layout of a normal dartboard. Can you produce the B4X code needed to draw it on a canvas. Colours not needed and it can just be monochrome to start with.
 
Upvote 0
Thanks for your replies, perhaps I should have been a bit more specific, I need it for b4a, it's for the game of killer, so the dart board has to have each of the twenty segments divided into four sections, not sure it's possible but thought I'd ask🤣
 
Upvote 0
a message says it can't answer CURRENTLY!

Yeah, that's been happening a lot lately. But every time, I hit retry, and then it works. Admittedly, I've been logged in.

I assume either they're hitting some capacity limit during busy times, or it's a ploy to get people to upgrade to a paid login.
 
Upvote 0
Upvote 0
Attached the xDartboardDemo project and the xDartboard.b4xlib.
It is a B4XPages project and the dart board is a b4xlib library.
Clicking on the dart board raises an event returning the ring index and sector.

1758710130536.png


EDIT: The files have been removed. The latest files are HERE.
 

Attachments

Last edited:
Upvote 0
Hi Klaus, thanks but I'm missing the xDartboardDemo project, I can only see the b4xlib file
 
Last edited:
Upvote 0
Back
Top