Post History
A chequer board (also spelt "checker board" in some places) is an 8 by 8 grid of squares alternating between 2 colours. Check whether a provided pattern could be a region of a chequer board. The c...
#3: Post edited
- A chequer board (also spelt "checker board" in some places) is an 8 by 8 grid of squares alternating between 2 colours. Check whether a provided pattern could be a region of a chequer board.
- The colours in the pattern will be represented by letters of the alphabet.
- The squares of a chequer board all have the same side length. For this challenge, this length can be any positive integer.
- Some of the squares may be cut by the boundary of the input region (the edges of the region shown in the input will not necessarily coincide with the edges of the squares). For example:
- ```text
- abba
- baab
- baab
- abba
- ```
- This shows a small region of a chequer board with squares of side length 2. Only the central square shows in its full 2 by 2 size. The squares adjacent to it have been sliced in half by the edges of the region.
- Here is a diagram showing the adjacent squares being sliced in half by the region outlined in red:
- ![A chequer board with a region outlined in red that slices some of the squares in half]
- This diagram is just to illustrate the reason that some squares on the boundary of the input region may appear smaller. The actual challenge is purely text based.
- ## Input
- - Text in a rectangular grid (newline separated lines of equal length)
- - Each character is a letter of the English alphabet (a to z, or A to Z - you can choose which case to accept)
- - No other characters will be present - just letters and newlines
- - You can choose whether the inputs have a trailing newline
- - The input will contain at least one letter (the input region will be non-empty)
- - You can choose to accept a grid of letters in a different format, such as lists/arrays of strings, or 2D arrays of characters
- - The input will not be more than 255 by 255 letters
- ## Output
- - A truthy output if the input is a region of an 8 by 8 chequer board (axis aligned - not squares at any other angle) and a falsy output otherwise
- - Falsy if there are more than 8 squares (including partial squares) horizontally or vertically
- - Falsy if there are more than 2 colours (more than 2 distinct letters)
- ## Test cases
- ### Truthy test cases
- ```text
- aa
- aa
- b
- cccccccc
- aabba
- aabba
- bbaab
- cddddddddd
- dccccccccc
- dccccccccc
- abababab
- babababa
- abababab
- babababa
- abababab
- babababa
- abababab
- babababa
- aqqaaq
- qaaqqa
- ba
- ab
- zzzzaaaazzzzaaaazzzzaaaazzzzaaaa
- zzzzaaaazzzzaaaazzzzaaaazzzzaaaa
- zzzzaaaazzzzaaaazzzzaaaazzzzaaaa
- zzzzaaaazzzzaaaazzzzaaaazzzzaaaa
- ```
- ### Falsy test cases
- ```text
- abbaaa
- c
- c
- d
- c
- aabb
- abba
- ccdcc
- cdddc
- ddddd
- cdddc
- ccdcc
- aba
- aba
- cdcdcdcdc
- c
- d
- c
- d
- c
- d
- c
- d
- c
bbaabbaabbaabbaabbaabbaabbaabb- abbaabbaabbaabba
- abc
- aabb
- bbcc
- ```
- > Explanations in answers are optional, but I'm more likely to upvote answers that have one.
- [A chequer board with a region outlined in red that slices some of the squares in half]: https://codegolf.codidact.com/uploads/X15JuPWLeQUTYcuYdz67pBWD
- A chequer board (also spelt "checker board" in some places) is an 8 by 8 grid of squares alternating between 2 colours. Check whether a provided pattern could be a region of a chequer board.
- The colours in the pattern will be represented by letters of the alphabet.
- The squares of a chequer board all have the same side length. For this challenge, this length can be any positive integer.
- Some of the squares may be cut by the boundary of the input region (the edges of the region shown in the input will not necessarily coincide with the edges of the squares). For example:
- ```text
- abba
- baab
- baab
- abba
- ```
- This shows a small region of a chequer board with squares of side length 2. Only the central square shows in its full 2 by 2 size. The squares adjacent to it have been sliced in half by the edges of the region.
- Here is a diagram showing the adjacent squares being sliced in half by the region outlined in red:
- ![A chequer board with a region outlined in red that slices some of the squares in half]
- This diagram is just to illustrate the reason that some squares on the boundary of the input region may appear smaller. The actual challenge is purely text based.
- ## Input
- - Text in a rectangular grid (newline separated lines of equal length)
- - Each character is a letter of the English alphabet (a to z, or A to Z - you can choose which case to accept)
- - No other characters will be present - just letters and newlines
- - You can choose whether the inputs have a trailing newline
- - The input will contain at least one letter (the input region will be non-empty)
- - You can choose to accept a grid of letters in a different format, such as lists/arrays of strings, or 2D arrays of characters
- - The input will not be more than 255 by 255 letters
- ## Output
- - A truthy output if the input is a region of an 8 by 8 chequer board (axis aligned - not squares at any other angle) and a falsy output otherwise
- - Falsy if there are more than 8 squares (including partial squares) horizontally or vertically
- - Falsy if there are more than 2 colours (more than 2 distinct letters)
- ## Test cases
- ### Truthy test cases
- ```text
- aa
- aa
- b
- cccccccc
- aabba
- aabba
- bbaab
- cddddddddd
- dccccccccc
- dccccccccc
- abababab
- babababa
- abababab
- babababa
- abababab
- babababa
- abababab
- babababa
- aqqaaq
- qaaqqa
- ba
- ab
- zzzzaaaazzzzaaaazzzzaaaazzzzaaaa
- zzzzaaaazzzzaaaazzzzaaaazzzzaaaa
- zzzzaaaazzzzaaaazzzzaaaazzzzaaaa
- zzzzaaaazzzzaaaazzzzaaaazzzzaaaa
- ```
- ### Falsy test cases
- ```text
- abbaaa
- c
- c
- d
- c
- aabb
- abba
- ccdcc
- cdddc
- ddddd
- cdddc
- ccdcc
- aba
- aba
- cdcdcdcdc
- c
- d
- c
- d
- c
- d
- c
- d
- c
- aabbaabbaabbaabba
- abbaabbaabbaabbaa
- abbaabbaabbaabba
- abc
- aabb
- bbcc
- ```
- > Explanations in answers are optional, but I'm more likely to upvote answers that have one.
- [A chequer board with a region outlined in red that slices some of the squares in half]: https://codegolf.codidact.com/uploads/X15JuPWLeQUTYcuYdz67pBWD
#2: Post edited
- A chequer board (also spelt "checker board" in some places) is an 8 by 8 grid of squares alternating between 2 colours. Check whether a provided pattern could be a region of a chequer board.
- The colours in the pattern will be represented by letters of the alphabet.
- The squares of a chequer board all have the same side length. For this challenge, this length can be any positive integer.
- Some of the squares may be cut by the boundary of the input region (the edges of the region shown in the input will not necessarily coincide with the edges of the squares). For example:
- ```text
- abba
- baab
- baab
- abba
- ```
- This shows a small region of a chequer board with squares of side length 2. Only the central square shows in its full 2 by 2 size. The squares adjacent to it have been sliced in half by the edges of the region.
- Here is a diagram showing the adjacent squares being sliced in half by the region outlined in red:
- ![A chequer board with a region outlined in red that slices some of the squares in half]
- ## Input
- - Text in a rectangular grid (newline separated lines of equal length)
- - Each character is a letter of the English alphabet (a to z, or A to Z - you can choose which case to accept)
- - No other characters will be present - just letters and newlines
- - You can choose whether the inputs have a trailing newline
- - The input will contain at least one letter (the input region will be non-empty)
- - You can choose to accept a grid of letters in a different format, such as lists/arrays of strings, or 2D arrays of characters
- - The input will not be more than 255 by 255 letters
- ## Output
- - A truthy output if the input is a region of an 8 by 8 chequer board (axis aligned - not squares at any other angle) and a falsy output otherwise
- - Falsy if there are more than 8 squares (including partial squares) horizontally or vertically
- - Falsy if there are more than 2 colours (more than 2 distinct letters)
- ## Test cases
- ### Truthy test cases
- ```text
- aa
- aa
- b
- cccccccc
- aabba
- aabba
- bbaab
- cddddddddd
- dccccccccc
- dccccccccc
- abababab
- babababa
- abababab
- babababa
- abababab
- babababa
- abababab
- babababa
- aqqaaq
- qaaqqa
- ba
- ab
- zzzzaaaazzzzaaaazzzzaaaazzzzaaaa
- zzzzaaaazzzzaaaazzzzaaaazzzzaaaa
- zzzzaaaazzzzaaaazzzzaaaazzzzaaaa
- zzzzaaaazzzzaaaazzzzaaaazzzzaaaa
- ```
- ### Falsy test cases
- ```text
- abbaaa
- c
- c
- d
- c
- aabb
- abba
- ccdcc
- cdddc
- ddddd
- cdddc
- ccdcc
- aba
- aba
- cdcdcdcdc
- c
- d
- c
- d
- c
- d
- c
- d
- c
- bbaabbaabbaabba
- abbaabbaabbaabb
- abbaabbaabbaabba
- abc
- aabb
- bbcc
- ```
- > Explanations in answers are optional, but I'm more likely to upvote answers that have one.
- [A chequer board with a region outlined in red that slices some of the squares in half]: https://codegolf.codidact.com/uploads/X15JuPWLeQUTYcuYdz67pBWD
- A chequer board (also spelt "checker board" in some places) is an 8 by 8 grid of squares alternating between 2 colours. Check whether a provided pattern could be a region of a chequer board.
- The colours in the pattern will be represented by letters of the alphabet.
- The squares of a chequer board all have the same side length. For this challenge, this length can be any positive integer.
- Some of the squares may be cut by the boundary of the input region (the edges of the region shown in the input will not necessarily coincide with the edges of the squares). For example:
- ```text
- abba
- baab
- baab
- abba
- ```
- This shows a small region of a chequer board with squares of side length 2. Only the central square shows in its full 2 by 2 size. The squares adjacent to it have been sliced in half by the edges of the region.
- Here is a diagram showing the adjacent squares being sliced in half by the region outlined in red:
- ![A chequer board with a region outlined in red that slices some of the squares in half]
- This diagram is just to illustrate the reason that some squares on the boundary of the input region may appear smaller. The actual challenge is purely text based.
- ## Input
- - Text in a rectangular grid (newline separated lines of equal length)
- - Each character is a letter of the English alphabet (a to z, or A to Z - you can choose which case to accept)
- - No other characters will be present - just letters and newlines
- - You can choose whether the inputs have a trailing newline
- - The input will contain at least one letter (the input region will be non-empty)
- - You can choose to accept a grid of letters in a different format, such as lists/arrays of strings, or 2D arrays of characters
- - The input will not be more than 255 by 255 letters
- ## Output
- - A truthy output if the input is a region of an 8 by 8 chequer board (axis aligned - not squares at any other angle) and a falsy output otherwise
- - Falsy if there are more than 8 squares (including partial squares) horizontally or vertically
- - Falsy if there are more than 2 colours (more than 2 distinct letters)
- ## Test cases
- ### Truthy test cases
- ```text
- aa
- aa
- b
- cccccccc
- aabba
- aabba
- bbaab
- cddddddddd
- dccccccccc
- dccccccccc
- abababab
- babababa
- abababab
- babababa
- abababab
- babababa
- abababab
- babababa
- aqqaaq
- qaaqqa
- ba
- ab
- zzzzaaaazzzzaaaazzzzaaaazzzzaaaa
- zzzzaaaazzzzaaaazzzzaaaazzzzaaaa
- zzzzaaaazzzzaaaazzzzaaaazzzzaaaa
- zzzzaaaazzzzaaaazzzzaaaazzzzaaaa
- ```
- ### Falsy test cases
- ```text
- abbaaa
- c
- c
- d
- c
- aabb
- abba
- ccdcc
- cdddc
- ddddd
- cdddc
- ccdcc
- aba
- aba
- cdcdcdcdc
- c
- d
- c
- d
- c
- d
- c
- d
- c
- bbaabbaabbaabba
- abbaabbaabbaabb
- abbaabbaabbaabba
- abc
- aabb
- bbcc
- ```
- > Explanations in answers are optional, but I'm more likely to upvote answers that have one.
- [A chequer board with a region outlined in red that slices some of the squares in half]: https://codegolf.codidact.com/uploads/X15JuPWLeQUTYcuYdz67pBWD
#1: Initial revision
Chequer checker
A chequer board (also spelt "checker board" in some places) is an 8 by 8 grid of squares alternating between 2 colours. Check whether a provided pattern could be a region of a chequer board. The colours in the pattern will be represented by letters of the alphabet. The squares of a chequer board all have the same side length. For this challenge, this length can be any positive integer. Some of the squares may be cut by the boundary of the input region (the edges of the region shown in the input will not necessarily coincide with the edges of the squares). For example: ```text abba baab baab abba ``` This shows a small region of a chequer board with squares of side length 2. Only the central square shows in its full 2 by 2 size. The squares adjacent to it have been sliced in half by the edges of the region. Here is a diagram showing the adjacent squares being sliced in half by the region outlined in red: ![A chequer board with a region outlined in red that slices some of the squares in half] ## Input - Text in a rectangular grid (newline separated lines of equal length) - Each character is a letter of the English alphabet (a to z, or A to Z - you can choose which case to accept) - No other characters will be present - just letters and newlines - You can choose whether the inputs have a trailing newline - The input will contain at least one letter (the input region will be non-empty) - You can choose to accept a grid of letters in a different format, such as lists/arrays of strings, or 2D arrays of characters - The input will not be more than 255 by 255 letters ## Output - A truthy output if the input is a region of an 8 by 8 chequer board (axis aligned - not squares at any other angle) and a falsy output otherwise - Falsy if there are more than 8 squares (including partial squares) horizontally or vertically - Falsy if there are more than 2 colours (more than 2 distinct letters) ## Test cases ### Truthy test cases ```text aa aa b cccccccc aabba aabba bbaab cddddddddd dccccccccc dccccccccc abababab babababa abababab babababa abababab babababa abababab babababa aqqaaq qaaqqa ba ab zzzzaaaazzzzaaaazzzzaaaazzzzaaaa zzzzaaaazzzzaaaazzzzaaaazzzzaaaa zzzzaaaazzzzaaaazzzzaaaazzzzaaaa zzzzaaaazzzzaaaazzzzaaaazzzzaaaa ``` ### Falsy test cases ```text abbaaa c c d c aabb abba ccdcc cdddc ddddd cdddc ccdcc aba aba cdcdcdcdc c d c d c d c d c bbaabbaabbaabba abbaabbaabbaabb abbaabbaabbaabba abc aabb bbcc ``` > Explanations in answers are optional, but I'm more likely to upvote answers that have one. [A chequer board with a region outlined in red that slices some of the squares in half]: https://codegolf.codidact.com/uploads/X15JuPWLeQUTYcuYdz67pBWD