<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: SchawnnahJ</title>
    <description>The latest articles on DEV Community by SchawnnahJ (@schawnnahj).</description>
    <link>https://dev.to/schawnnahj</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F731992%2F198f78c6-924d-4509-8b02-4694d7f1de86.png</url>
      <title>DEV Community: SchawnnahJ</title>
      <link>https://dev.to/schawnnahj</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/schawnnahj"/>
    <language>en</language>
    <item>
      <title>Quarto Challenge</title>
      <dc:creator>SchawnnahJ</dc:creator>
      <pubDate>Tue, 16 Aug 2022 18:37:50 +0000</pubDate>
      <link>https://dev.to/schawnnahj/quarto-challenge-347e</link>
      <guid>https://dev.to/schawnnahj/quarto-challenge-347e</guid>
      <description>&lt;p&gt;Quatro is a 2 player game invented by Blaies Müller.&lt;/p&gt;

&lt;p&gt;It is played on a 4 X 4 board with 16 pieces each of which is either&lt;/p&gt;

&lt;p&gt;Red or Blue&lt;br&gt;
Short or Tall&lt;br&gt;
Hollow or Solid&lt;br&gt;
Circular or Square&lt;br&gt;
The game begins with one player choosing the piece and the other placing it on the board. A player wins by placing 4 pieces on the board horizontally, vertically or diagonally all of which have a common attribute ( red or tall or hollow etc ).&lt;/p&gt;

&lt;p&gt;In this game, each of the 16 pieces are represented using 4 bits.&lt;/p&gt;

&lt;p&gt;Red or Blue ( 0 or 1 respectively forming the most significant bit )&lt;br&gt;
Short or Tall ( 0 or 1 respectively forming the 3rd bit )&lt;br&gt;
Hollow or Solid ( 0 or 1 respectively forming the 2nd bit )&lt;br&gt;
Circular or Square ( 0 or 1 respectively forming the least significant bit )&lt;br&gt;
So, a Red Tall Hollow Circular piece is represented by ( 0100 = 4 )&lt;/p&gt;

&lt;p&gt;Input Format&lt;br&gt;
The first line of the input contains the player id 1 or 2. The second line of the input is a string PICK or PLACE indicating whether a player has to pick a piece or place an already picked piece on the board. 4 lines follow, each line containing 4 space separated integers ( -1 indicating an empty slot on the board and a positive number indicating a piece ).&lt;br&gt;
Next line contains N, total number of pieces left to be placed on the board.&lt;br&gt;
N lines follow each line containing the decimal representation of the piece.&lt;br&gt;
An optional next line contains an integer indicating the piece to be placed on the board if the move is PLACE.&lt;/p&gt;

&lt;p&gt;Board is indexed according to Matrix Convention&lt;/p&gt;

&lt;p&gt;Output Format&lt;/p&gt;

&lt;p&gt;If the input is PICK, out of the available pieces, pick one to be placed by our opponent on the board and print its number to STDOUT.&lt;br&gt;
If the input is PLACE, print 2 space separated integers indicating the row and column where the piece has to be placed.&lt;/p&gt;

&lt;p&gt;Sample Input #00&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;2&lt;br&gt;
PICK&lt;br&gt;
-1 -1 1 -1&lt;br&gt;
-1 -1 -1 -1&lt;br&gt;
10 0 14 15&lt;br&gt;
9 -1 -1 12&lt;br&gt;
9&lt;br&gt;
2&lt;br&gt;
3&lt;br&gt;
4&lt;br&gt;
5&lt;br&gt;
6&lt;br&gt;
7&lt;br&gt;
8&lt;br&gt;
11&lt;br&gt;
13&lt;br&gt;
Sample Output #00&lt;/p&gt;

&lt;p&gt;7&lt;br&gt;
Explanation #00&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Here, the 2nd player on receiving the input, PICKs 7 ( Red Tall Hollow Circular ) piece to be placed on the board whose position is decided by the opponent.&lt;/p&gt;

&lt;p&gt;Sample Input #01&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;1&lt;br&gt;
PLACE&lt;br&gt;
-1 -1 1 -1&lt;br&gt;
-1 -1 -1 -1&lt;br&gt;
10 0 14 15&lt;br&gt;
9 -1 -1 12&lt;br&gt;
8&lt;br&gt;
2&lt;br&gt;
3&lt;br&gt;
4&lt;br&gt;
5&lt;br&gt;
6&lt;br&gt;
8&lt;br&gt;
11&lt;br&gt;
13&lt;br&gt;
7&lt;br&gt;
Sample Output #01&lt;/p&gt;

&lt;p&gt;1 1&lt;br&gt;
Explanation #01&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;On receiving this input, the 1st player decides to place 7 ( the last integer in input ) at the position 1 1.&lt;/p&gt;

&lt;p&gt;Sample Input #02&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;2&lt;br&gt;
PLACE&lt;br&gt;
2 -1 1 -1&lt;br&gt;
-1 -1 -1 -1&lt;br&gt;
10 0 14 15&lt;br&gt;
9 -1 -1 12&lt;br&gt;
7&lt;br&gt;
4&lt;br&gt;
5&lt;br&gt;
6&lt;br&gt;
7&lt;br&gt;
8&lt;br&gt;
11&lt;br&gt;
13&lt;br&gt;
3&lt;br&gt;
Sample Output #02&lt;br&gt;
1 0&lt;br&gt;
Explanation #02&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;After placing 3 at 1 0, the 2nd player wins the game as&lt;/p&gt;

&lt;p&gt;2 3 10 9 ( the first column ) all share the same 2nd most significant bit which is 0.&lt;/p&gt;

&lt;p&gt;0010 0011 1010 1001&lt;/p&gt;

&lt;p&gt;as you can see, the 2nd most significant bit is all 0 and therefore, all the pieces have the common attribute of being SHORT.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&amp;gt; Submit your code down below&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>programming</category>
      <category>python</category>
      <category>aws</category>
      <category>datascience</category>
    </item>
  </channel>
</rss>
