Cajita | An MPIKokkos library for logically rectilinear grids | Grid library
kandi X-RAY | Cajita Summary
kandi X-RAY | Cajita Summary
A library for computations on logically rectilinear grids.
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 Cajita
Cajita Key Features
Cajita Examples and Code Snippets
Community Discussions
Trending Discussions on Cajita
QUESTION
Hi my problem is that i have to implement a logic that detect if for example the "X" makes a 2x2 square. In this code you have to insert 4 times a string of 4 digits in an ArrayList in which it will be a "X" if its a a "plastic cube" ("plastic cube" helps to visualize that the output is a "plastic form") or a "." if its not.
So if the input is:
..XX
..XX
....
....
I have to detect that is a cube 2X2 and return for example "Its a cube".
I would appreciate if you could help me since I am stuck.
...ANSWER
Answered 2020-Oct-11 at 23:04You can do it like this:
Verify that a user-entered line is exactly 4 long and consists of only
.
andX
, otherwise ask user to re-enter a valid line.Once you have 4 valid lines, count the number of X's. If not 4, then it's not a square.
Find the first X, then:
Check that next position in the line is also an X.
Check that line below has X in same position.
Check that line below has X in next position.
If any of those checks fail, then it's not a square.
Otherwise it's a square.
Have fun coding that.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install Cajita
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