hexagony | A two-dimensional , hexagonal programming language | Interpreter library
kandi X-RAY | hexagony Summary
kandi X-RAY | hexagony Summary
Hexagony has a number of important (and partially unique) concepts which need introduction.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of hexagony
hexagony Key Features
hexagony Examples and Code Snippets
Community Discussions
Trending Discussions on hexagony
QUESTION
I'm designing a hexagon grid and I need to be able to name each hexagon, so I can refer to them later. Below is my class, it generates the hexagon grid, and I've labeled the code throughout so you can understand what's happening. I've been searching for a while now reading a lot about Graphics, but I can't get a working design with the answers I've seen offered. Perhaps, I'm going about this wrong by using Graphics, but my plan is to be able to click on each hexagon and do something with it.
Note: If you see a way to improve my code let me know. It's appreciated!
...ANSWER
Answered 2018-May-30 at 08:46You'll need to create some Hexagon class with it's coordinates and (maybe name, if really needed). And save them to some suitable collection (2-dimensional array maybe?) This should happen somewhere outside your Paint event and might be recalculated on grid SizeChanged event.
Inside your Paint event you'll just iterate throught existing collection and render according to pre-computed coordinates.
OnClick event will loop throught the same collection to find specific Hexagon for updating (changing background color for example) and forcing form to repaint to take effect.
For large rendering you should consider rendering to bitmap first and drawing that final bitmap to e.Graphics for faster work. Your bitmap could be cached as well to speed up even more.
EDIT: Code sample added
Turn Option Strict On in your project properties to avoid many problems in your code that you're not aware of.
QUESTION
I'm trying to wrap my head around the programming language Hexagony. I've looked at a few sample programs and have tried writing a simple program to read input and print Hey [input]!
. Here's what I have.
ANSWER
Answered 2018-Jan-16 at 11:54Here's a diagram for how the memory movement commands work:
The memory pointer (MP) has a position (which is an edge of the memory grid) and an orientation along that edge. In the diagram, the initial position of the MP is marked with the red arrow, so it currently points north.
The MP movement commands are always relative to the current position and orientation of the MP. I've annotated the four adjacent edges based on which command gets you there. So {
moves the MP forward and to left, and '
moves it backward and to the right, for example.
To figure out its new orientation, you can think of this movement as rotating the MP by 60 degrees about one of the adjacent hexagons. So depending on the chosen command, the MP would point in the following directions for the above diagram:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install hexagony
On a UNIX-like operating system, using your system’s package manager is easiest. However, the packaged Ruby version may not be the newest one. There is also an installer for Windows. Managers help you to switch between multiple Ruby versions on your system. Installers can be used to install a specific or multiple Ruby versions. Please refer ruby-lang.org for more information.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page