Connect 4 board

558fe5180e0e8fc922d31c23ef84d240

I made a 3x3 connect 4 board game now I want to expand it so Its an actual connect 4 game and not tic tac toe. I want to make the board 5x7 please help

from random import randint
def initialiseBoard():
    print('Following is the board and the respective positions.\nEnter the row and column separated by a space to play.')
    board = [['' for x in range(3)] for y in range(3)]
    for i in range(3):
        for j in range(3):
            print('[{0},{1}] '.format(i + 1, j + 1), end='')
        print()
    return board
def inputBoard(board, turn, play):
    print()
    if play == 'player':
        if turn % 2 == 0:
            print('Player X What move do you want to make? Answer as row (vertical) column (horizontal) or save game or load game ')
        else:
            print("Player O What move do you want to make? Answer as row (vertical) column (horizontal) or save game or load game ")
        x, y = map(int, input().split(' '))
        if x > 3 or y > 3 or x < 1 or y < 1:
            print("Enter valid position")
            return True
    if play == 'ai':
        # print('Computer entered its position ')
        while True:
            x = randint(1, 3)
            y = randint(1, 3)
            if board[x - 1][y - 1] == '':
                break
    i = x - 1
    j = y - 1
    if board[i][j] != '':
        print("Enter row and column that hasnt already been chosen.")
        return True
    if turn % 2 == 0:
        board[i][j] = 'X'
    else:
        board[i][j] = 'O'
    return
def checkWin(board, ch, play):
    for i in range(3):
        if board[i][0] == ch and board[i][1] == ch and board[i][2] == ch:
            if play == 'player':
                print('Player ', ch, ' Wins!')
                return True
        if play == 'ai':
            print('Computer wins!')
            return True
    for i in range(3):
        if board[0][i] == ch and board[1][i] == ch and board[2][i] == ch:
            if play == 'player':
                print('Player ', ch, ' Wins!')
                return True
            if play == 'ai':
                print('Computer wins!')
                return True
    if (board[0][0] == ch and board[1][1] == ch and board[2][2] == ch) or (
        board[0][2] == ch and board[1][1] == ch and board[2][0] == ch):
        if play == 'player':
            print('Player ', ch, ' Wins!')
            return True
        if play == 'ai':
            print('Computer wins!')
            return True
    return False
print('AdjoinTheSpheres Main Menu')
while 1:
    print("1) New Game (2 player)")
    print("2) New Game (1 player vs computer)")
    print("3) Exit Game")
    choice = input("Select Option from the Menu: ")
    if choice not in ['1', '2', '3']:
        print("Please enter valid option")
        continue
    else:
        break
while (choice != '3'):
    while True:
        board = initialiseBoard()
# print("X plays first")
        turn = 0
        while turn < 9:
            if choice == '1':
                if (inputBoard(board, turn, 'player')):
                    continue
            elif choice == '2' and turn % 2 == 0:
                if (inputBoard(board, turn, 'player')):
                    continue
            elif choice == '2' and turn % 2 == 1:
                if (inputBoard(board, turn, 'ai')):
                    continue
            for i in range(3):
                for j in range(3):
                    if board[i][j] == '':
                        print('[ ]', ' ', end='')
                    else:
                        print('[', board[i][j], ']', ' ', end='')
                print()
            if turn % 2 == 0:
                if (checkWin(board, 'X', 'player')):
                    break
            if turn % 2 == 1 and choice == '1':
                if (checkWin(board, 'O', 'player')):
                    break
            if turn % 2 == 1 and choice == '2':
                if (checkWin(board, 'O', 'ai')):
                    break
            turn = turn + 1
            if turn == 9:
                print("Its a draw! Everybody sucks!")
        x = input("Want to play again? Press 1 for yes, anything else to exit out.")
        if x == '1':
            break
        else:
            print("Thank you for playing!")
            exit()
        choice = input("Select option\n1)Play against another player\n2)Play against computer\n3)Exit\n")

7 Top APIs for Torrents

Featured Imgs 23

A Torrent is a peer-to-peer (P2P) file sharing protocol also known as BitTorrent. The technology can distribute files without depending on a single server, so when users download files, they will come from decentralized sources. A torrent program (client) is required to share files in this way.

Square Announces Terminal API Beta

Featured Imgs 23

Square has announced the beta release of its new Square Terminal API. Through the API, developers can integrate the Square Terminal with their own POS systems. That includes mobile platforms, web, desktop, anything. All payment types are supported, including touchless, NFC technology.

How to Sell on Facebook: Create a Facebook Shop and Engage Billions of Potential Customers

Featured Imgs 26
If you’ve ever tried to learn how to sell on Facebook, you know that it’s (how do I put this lightly) an “interesting” experience. Facebook rules, interfaces, security, and just about every part of the social network changes on a regular basis. Many times, it seems like the modifications have nothing to do with helping out users. And those modifications definitely aren’t trying to help out businesses, unless you’re paying for ads.

7 Handy Tips to Increase MacBook Pro Storage Space and Capability

Category Image 033

With Apple managing to sell over 5 million Macs per quarter these days, MacBooks have become some of the most popular laptops. Popular for their sleek interface and user-friendly experience, it’s easy to see why some consumers gravitate towards Apple laptops. But like any laptop, they have issues users can run into — and one of […]

The post 7 Handy Tips to Increase MacBook Pro Storage Space and Capability appeared first on WPArena.

Chatterbox Plugin Uses WordPress Blocks to Show Conversations

Category Image 052

Chatterbox is a new plugin with a fun and creative use for the block editor. It displays chat or text threads using blocks that are styled as conversations. Users can type in a record of a chat, including timestamps, with a live preview in the editor.

Since written conversations are essentially little blocks of text and media, the block editor lends itself nicely to composing and displaying this type of content. The Chatterbox block can be found under Layout Elements in the block inserter. It includes the option to select a style (Inbound, Outbound, or Event) and add a timestamp.

Dave Ryan, a WordPress developer at Bluehost, said he created the plugin in order to test Gutenberg’s Block Context API and borrowed the chat component from Salesforce’s Lightning Design System. He suggested that Chatterbox could be useful for showing demos of chat bots, publishing chat records in news stories, or simply adding an engaging visual display to conversations.

Once the Block Context API matures, Ryan plans to add message background and text colors, message sender with name and avatar, and the ability to override the message sender on a per-message basis for group chats. The next steps beyond that on the roadmap include the following:

  •  Implement Bookends and other SFDS Chat options
  •  Animated chat sequences
  •  Automated animated sequences, using character lengths for timing
  •  Automate hiding of message meta based on adjacent blocks
  •  Message Images
  •  Message Files

Ryan said some of the planned features will rely on new features in the Gutenberg project. Once those have been released he will update Chatterbox to include more customization options. The plugin is available for free on WordPress.org and contributors can find the code on GitHub.

Apple and Google’s Contact Tracing API Expected by April 28th

Featured Imgs 23

Earlier this week European Commissioner Thierry Breton shared an image on Twitter of him having a video conference with Apple CEO Tim Cook. It has been widely reported that during this meeting Cook told the Commissioner that the COVID-19 contact tracing API being co-developed by Apple and Google will be ready for launch on April 28th.

How To Limit WordPress Search Results By Post Type

Featured Imgs 21

There are occasions in which you may want to limit WordPress search results to a specific post type rather than just the default. Your theme may have custom post types that you want to be included in the search, or perhaps you only want to search the custom post type and not posts or pages. This is relatively simple to do without a plugin, which is usually best practice when possible.

UNLIMITED DOWNLOADS: 500,000+ WordPress & Design Assets

Sign up for Envato Elements and get unlimited downloads starting at only $16.50 per month!




 

Open your theme’s functions.php file and copy the following code snippet at the bottom.

function 1wd_searchfilter($query) { 
    if ($query->is_search && !is_admin() ) {
        $query->set('post_type',array('post','page'));
    } 
return $query;
} 
add_filter('pre_get_posts','1wd_searchfilter');

Note the line where it says

$query->set('post_type',array('post','page'));

Change that line where it says ‘post’, ‘page’ to whatever post type you want the search to be filtered through. So, for example, your code would look like this:

function 1wd_searchfilter($query) { 
    if ($query->is_search && !is_admin() ) {
        $query->set('post_type',array('custom_post_type_name_1','custom_post_type_name_2'));
    } 
return $query;
} 
add_filter('pre_get_posts','1wd_searchfilter');

Be sure to change the name of the custom post type to your own.

We hope that helps you next time you need to limit WordPress search results by post type. Be sure to check out our other WordPress tutorials for more useful tips!

VB.NET times table

558fe5180e0e8fc922d31c23ef84d240

A teacher wants the program to:
show a visual representation of a multiplication
ask the child to key in an answer

E.G
3 x 4

What is the answer?

This is as far as I can go

Please help. I can't go horizontal. I only go vertical

Module Module1

    Sub Main()
        Dim a, b As Integer
        Dim star As String = "*"

        Dim rand As New Random
        a = rand.Next(1, 10)
        b = rand.Next(1, 10)

        Console.WriteLine(a & " X " & b)
        Dim sum As Double = a * b

        Dim i, x As Integer

        If a > b Then
            i = b
        Else
            i = a
        End If
        For x = 1 To i
            Console.Write(star)
            Console.WriteLine(star)
        Next
        Console.WriteLine()
        Console.WriteLine(sum)
        Console.ReadKey()
    End Sub

End Module

Gutenberg Hub Launches Online Block Template Builder

Category Image 091

Gutenberg Hub launched the first version of its block template builder last week. The template builder allows users to select from the team’s existing library of nearly 200 templates. It is essentially an online builder that allows users to craft a full page layout by mixing and matching various sections. They can then copy the resulting output at the click of a button and paste it into the editor on their sites.

“I intend to speed up the workflow for WordPress users to spin up beautiful Gutenberg pages, even full websites, faster,” said Munir Kamal, founder of Gutenberg Hub. “So all I am trying to do is headed in that direction.”

Kamal has also released a Chrome browser extension that allows end-users to add templates from the growing library of options.

“The idea is to help DIYers, freelancers, or anyone with creating new website pages faster,” he said. “I have many feature ideas to make this builder great, but I want to hear out the feedback and suggestions from the community about it.”

Currently, Kamal is calling this version of the builder a “prototype” because he wants to validate the idea with the community before moving forward with new features.

Using the Template Builder

Building a template or full page is simple. Users merely need to visit the template builder page. On the page, the builder has an “Add Section” button, which will slide the template library panel open. From that point, users can choose from an extensive list of templates that includes designs for hero sections, testimonials, sliders, and more.

Screenshot of Gutenberg Hub's template builder library.
Gutenberg Hub’s templates library.

The idea is to build a full page by combining multiple sections. Users will want to add new sections and organize them for their needs. Each section can be trashed, duplicated, or moved up/down using the available buttons.

Trying my hand at building a simple product page, I was able to pick and choose the sections I wanted to add in just a few minutes.

Screenshot of a custom combination of templates in Gutenberg Hub's template builder.
Custom combination of templates with the builder.

Once everything is in place, users can copy the full template code and paste it their block editor. From that point, they can edit it on their own site.

Sometimes, it may be necessary to copy additional CSS and insert it via the WordPress customizer or through a plugin like Blocks CSS. Some options also require users to install a plugin to use specific blocks.

This is the type of power I want in the hands of WordPress users. Plug-and-play template systems like this will push the platform into the future. However, such systems need to be integrated directly into WordPress. Copying and pasting from a third-party website is merely a stepping stone toward that future, catering to user needs in the here and now.

The Future of the Builder and More

Long term, Gutenberg Hub’s work may be a better fit into the upcoming pattern system. The team could release a plugin that would integrate seamlessly into the block editor. That way, end-users could build their templates without ever leaving the comfort of the post-editing screen, or at least avoid switching between browser tabs. However, patterns are still months away from inclusion in core WordPress. In the meantime, this feels like a solid stop-gap. Plus, the team can build a nice library and garner feedback and data from users on the most popular templates/patterns.

While Kamal wants to hear feedback before moving forward, he does have some big ideas of his own for the builder. “For example, this builder may let you create projects, and under projects, you may create multiple pages,” he said. “For each project, you may define custom branding (typography, color scheme, etc.), and all the templates from the library will adapt to that branding when you create pages under a specific project.”

The most important thing he wants to accomplish is to build tools that speed up workflows for everyone.

He will also open the template library to third-party developers and designers soon. There will be a public submission process. If enough people contribute, the library could balloon to an untold number of options that would be directly available as part of the builder.

“Besides the templates and builder, I am planning something around the Gutenberg Templates API,” said Kamal. He stresses that it is still in the planning phase. If the previous work that he has put out is any indication, this could be an interesting project. He is also working on a form builder plugin for the block editor, which is currently seeing regular updates.

#265: Flutter

Featured Imgs 23

Show Description

Andrew Brogdon from the Flutter team chats with Marie and Alex about the new Flutter editor on CodePen.

Time Jumps

  • 01:07 What is Flutter?
  • 05:03 How did CodePen integrate Flutter?
  • 08:20 Dartpad
  • 14:45 Sponsor: Jetpack
  • 17:09 How do you get started with Flutter?
  • 20:26 How did CodePen enable a new editor

Sponsor: Jetpack

Jetpack is full of features. If you have had the feeling that you’re paying for more than you need, you’re in luck, Jetpack is starting to have features you can buy individually. Jetpack Backup is one of them, the best way to backup a WordPress site there is. If that’s the only paid feature you need, you got it. Just $3 a month for daily backups or $20 a month for realtime backups.

Show Links

CodePen Links

The post #265: Flutter appeared first on CodePen Blog.

Google Shopping Is Now Open to Free Product Listings

Set Up Woocommerce

Google announced today that it is bringing free listings to the Shopping tab in the United States before the end of April and will expand globally by the end of the year. Previously, merchants were required to pay for ad placement and product listings, which led to major online retailers dominating the Shopping tab.

“Beginning next week, search results on the Google Shopping tab will consist primarily of free listings, helping merchants better connect with consumers, regardless of whether they advertise on Google,” Bill Ready, Google’s president of commerce, said. “With hundreds of millions of shopping searches on Google each day, we know that many retailers have the items people need in stock and ready to ship, but are less discoverable online.”

This change comes at a critical time when the retail industry has taken a significant hit due to shelter-in-place orders aimed at mitigating the spread of the coronavirus. Free listings make showing up in the Google Shopping tab more accessible for independent stores.

“For retailers, this change means free exposure to millions of people who come to Google every day for their shopping needs,” Ready said. “For shoppers, it means more products from more stores, discoverable through the Google Shopping tab.”  Existing Merchant Center users will retain their ads for specific products as promoted listings but will also now be able to list their full inventories for free.

Google also announced a new partnership with PayPal that will streamline the onboarding process for merchants who want to link their accounts. The announcement identified WooCommerce, Shopify, and BigCommerce as existing partners that offer platforms to help businesses sell online. In light of the current crisis, WooCommerce has ramped up its efforts to make e-commerce more approachable. The team recently hosted a free webinar on how to start selling online and produced a guide to adding a store to an existing WordPress website.

Although Google cites the coronavirus pandemic as a factor in advancing the company’s plans to make it free for merchants to sell on Google, the move is a strategic step towards wooing back the overwhelming amount of traffic it sends to Amazon. If Google’s Shopping tab can become a better source for price comparisons with a diversity of stores, consumers may return to searching Google first when intending to make a purchase.