Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - maverick

Pages: 123 45 ... 7
61
The Flood / Probably not going to be able to sleep for a couple hours
« on: June 05, 2017, 02:54:09 AM »
Recommend me some interesting late night youtube videos to watch

62
Tired of going unrecognized on these forums.

63
The Flood / Whatever happened to kupo
« on: May 24, 2017, 08:29:06 PM »
first one to talk gets to stay on my aircraft

64
The Flood / Hello fellow robots
« on: May 23, 2017, 07:21:46 AM »
Stayed up all night making this beatable AI tic tac toe game.

Spoiler
Code: [Select]
#include <iostream>
#include <stdlib.h>
#include <cstdlib>
#include <ctime>

using namespace std;

void MakeMove(char[]);
void PrintBoard(char[]);
void GameOver(char[]);
void algorithm(char[]);

int main()
{
    srand(time(0));
    int choice;
    char mark;
    char board[10] = {'o', '1', '2', '3', '4', '5', '6', '7', '8', '9'};
    MakeMove(board);
}

void MakeMove(char board[])
{
    char choice;
    PrintBoard(board);
    cout << "\n   Choose Square #: ";
    cin >> choice;
    cout << endl << endl;
    if (choice == '1' && board[1] == '1')
    {
        board[1] = 'X';
        if (board[5] == '5')
            board[5] = 'O';
        else algorithm(board);
        PrintBoard(board);
        GameOver(board);
        MakeMove(board);
    }
    else if (choice == '2' && board[2] == '2')
    {
        board[2] = 'X';
        if (board[5] == '5')
            board[5] = 'O';
        else algorithm(board);
        PrintBoard(board);
        GameOver(board);
        MakeMove(board);
    }
    else if (choice == '3' && board[3] == '3')
    {
        board[3] = 'X';
        if (board[5] == '5')
            board[5] = 'O';
        else algorithm(board);
        PrintBoard(board);
        GameOver(board);
        MakeMove(board);
    }
    else if (choice == '4' && board[4] == '4')
    {
        board[4] = 'X';
        if (board[5] == '5')
            board[5] = 'O';
        else algorithm(board);
        PrintBoard(board);
        GameOver(board);
        MakeMove(board);
    }
    else if (choice == '5' && board[5] == '5')
    {
        board[5] = 'X';
        static int table[] = {1, 3, 7, 9};
        int i = rand() % (sizeof table / sizeof *table);
        board[i] = 'O';
        PrintBoard(board);
        GameOver(board);
        MakeMove(board);
    }
    else if (choice == '6' && board[6] == '6')
    {
        board[6] = 'X';
        if (board[5] == '5')
            board[5] = 'O';
        else algorithm(board);
        PrintBoard(board);
        GameOver(board);
        MakeMove(board);
    }
    else if (choice == '7' && board[7] == '7')
    {
        board[7] = 'X';
        if (board[5] == '5')
            board[5] = 'O';
        else algorithm(board);
        PrintBoard(board);
        GameOver(board);
        MakeMove(board);
    }
    else if (choice == '8' && board[8] == '8')
    {
        board[8] = 'X';
        if (board[5] == '5')
            board[5] = 'O';
        else algorithm(board);
        PrintBoard(board);
        GameOver(board);
        MakeMove(board);
    }
    else if (choice == '9' && board[9] == '9')
    {
        board[9] = 'X';
        if (board[5] == '5')
            board[5] = 'O';
        else algorithm(board);
        PrintBoard(board);
        GameOver(board);
        MakeMove(board);
    }
    else
        MakeMove(board);
}

void PrintBoard(char b[])
{
    system("cls");
    cout << "\n\n\t   Tic Tac Toe\n\n";
    cout << "   Player 1 (X)  -  Player 2 (O)" << endl << endl;
    cout << "\t     |     |     " <<endl;
    cout << "\t  " << b[1] << "  |  " << b[2] << "  |  " << b[3] << "  " <<endl;
    cout << "\t—--|—--|—--" <<endl;
    cout << "\t  " << b[4] << "  |  " << b[5] << "  |  " << b[6] << "  " <<endl;
    cout << "\t—--|—--|—--" <<endl;
    cout << "\t  " << b[7] << "  |  " << b[8] << "  |  " << b[9] << "  " <<endl;
    cout << "\t     |     |     " <<endl << endl;
}

void GameOver(char board[])
{
    if (board[1] != '1' && board[2] != '2' && board[3] != '3' &&
        board[4] != '4' && board[5] != '5' && board[6] != '6' &&
        board[7] != '7' && board[8] != '8' && board[9] != '9')
    {
        cout << "Cat's game!" << endl << endl;
        exit(0);
    }
    else if (board[1] == 'X' && board[2] == 'X' && board[3] == 'X')
        {cout << "You win!" << endl << endl;
        exit(0);}
    else if (board[1] == 'X' && board[4] == 'X' && board[7] == 'X')
        {cout << "You win!" << endl << endl;
        exit(0);}
    else if (board[2] == 'X' && board[5] == 'X' && board[8] == 'X')
        {cout << "You win!" << endl << endl;
        exit(0);}
    else if (board[4] == 'X' && board[5] == 'X' && board[6] == 'X')
        {cout << "You win!" << endl << endl;
        exit(0);}
    else if (board[3] == 'X' && board[6] == 'X' && board[9] == 'X')
        {cout << "You win!" << endl << endl;
        exit(0);}
    else if (board[7] == 'X' && board[8] == 'X' && board[9] == 'X')
        {cout << "You win!" << endl << endl;
        exit(0);}
    else if (board[1] == 'X' && board[5] == 'X' && board[9] == 'X')
        {cout << "You win!" << endl << endl;
        exit(0);}
    else if (board[3] == 'X' && board[5] == 'X' && board[7] == 'X')
        {cout << "You win!" << endl << endl;
        exit(0);}
    else if (board[1] == 'O' && board[2] == 'O' && board[3] == 'O')
        {cout << "You lose!" << endl << endl;
        exit(0);}
    else if (board[1] == 'O' && board[4] == 'O' && board[7] == 'O')
        {cout << "You lose!" << endl << endl;
        exit(0);}
    else if (board[2] == 'O' && board[5] == 'O' && board[8] == 'O')
        {cout << "You lose!" << endl << endl;
        exit(0);}
    else if (board[4] == 'O' && board[5] == 'O' && board[6] == 'O')
        {cout << "You lose!" << endl << endl;
        exit(0);}
    else if (board[3] == 'O' && board[6] == 'O' && board[9] == 'O')
        {cout << "You lose!" << endl << endl;
        exit(0);}
    else if (board[7] == 'O' && board[8] == 'O' && board[9] == 'O')
        {cout << "You lose!" << endl << endl;
        exit(0);}
    else if (board[1] == 'O' && board[5] == 'O' && board[9] == 'O')
        {cout << "You lose!" << endl << endl;
        exit(0);}
    else if (board[3] == 'O' && board[5] == 'O' && board[7] == 'O')
        {cout << "You lose!" << endl << endl;
        exit(0);}
}

void algorithm(char board[])
{
    //offensive moves
    if (board[1] == 'O' && board[2] == 'O' && board[3] == '3')
        board[3] = 'O';
    else if (board[1] == 'O' && board[4] == 'O' && board[7] == '7')
        board[7] = 'O';
    else if (board[1] == 'O' && board[5] == 'O' && board[9] == '9')
        board[9] = 'O';
    else if (board[1] == 'O' && board[3] == 'O' && board[2] == '2')
        board[2] = 'O';
    else if (board[1] == 'O' && board[7] == 'O' && board[4] == '4')
        board[4] = 'O';
    else if (board[1] == 'O' && board[9] == 'O' && board[5] == '5')
        board[5] = 'O';
    else if (board[2] == 'O' && board[3] == 'O' && board[1] == '1')
        board[1] = 'O';
    else if (board[2] == 'O' && board[5] == 'O' && board[8] == '8')
        board[8] = 'O';
    else if (board[2] == 'O' && board[8] == 'O' && board[5] == '5')
        board[5] = 'O';
    else if (board[3] == 'O' && board[6] == 'O' && board[9] == '9')
        board[9] = 'O';
    else if (board[3] == 'O' && board[9] == 'O' && board[1] == '6')
        board[6] = 'O';
    else if (board[3] == 'O' && board[5] == 'O' && board[7] == '7')
        board[7] = 'O';
    //defensive moves
    else if (board[1] == 'X' && board[2] == 'X' && board[3] == '3')
        board[3] = 'O';
    else if (board[1] == 'X' && board[4] == 'X' && board[7] == '7')
        board[7] = 'O';
    else if (board[1] == 'X' && board[5] == 'X' && board[9] == '9')
        board[9] = 'O';
    else if (board[1] == 'X' && board[3] == 'X' && board[2] == '2')
        board[2] = 'O';
    else if (board[1] == 'X' && board[7] == 'X' && board[4] == '4')
        board[4] = 'O';
    else if (board[1] == 'X' && board[9] == 'X' && board[5] == '5')
        board[5] = 'O';
    else if (board[2] == 'X' && board[3] == 'X' && board[1] == '1')
        board[1] = 'O';
    else if (board[2] == 'X' && board[5] == 'X' && board[8] == '8')
        board[8] = 'O';
    else if (board[2] == 'X' && board[8] == 'X' && board[5] == '5')
        board[5] = 'O';
    else if (board[3] == 'X' && board[6] == 'X' && board[9] == '9')
        board[9] = 'O';
    else if (board[3] == 'X' && board[9] == 'X' && board[1] == '6')
        board[6] = 'O';
    else if (board[3] == 'X' && board[5] == 'X' && board[7] == '7')
        board[7] = 'O';
    //misc moves
    else if (board[1] == '1')
        board[1] = 'O';
    else if (board[2] == '2')
        board[2] = 'O';
    else if (board[3] == '3')
        board[3] = 'O';
    else if (board[4] == '4')
        board[4] = 'O';
    else if (board[5] == '5')
        board[5] = 'O';
    else if (board[6] == '6')
        board[6] = 'O';
    else if (board[7] == '7')
        board[7] = 'O';
    else if (board[8] == '8')
        board[8] = 'O';
    else if (board[9] == '9')
        board[9] = 'O';
}

Feel free to let me know how shitty it is.

65
The Flood / What should I do with my day tomorrow?
« on: May 10, 2017, 08:15:35 PM »
please help

66
Serious / edit
« on: April 11, 2017, 11:08:39 AM »
ian beat me to it

67
The Flood / Thor: Ragnarok
« on: April 10, 2017, 12:52:24 PM »
YouTube


Figure some of you might be interested.

68
Gaming / Wii U or Nintendo Switch?
« on: March 26, 2017, 10:13:38 AM »
Been wanting to pick up Zelda but I don't have a current enough console. Since Switch is the newest one and there's not that much of a price difference, I should probably get that but I've been hearing there's all kinds of problems with it. What would you guys recommend?

69
The Flood / How are your brackets doing?
« on: March 23, 2017, 10:14:48 PM »
?

70
The Flood / Guardians of the Galaxy trailer #2
« on: March 01, 2017, 03:11:14 PM »
YouTube


71
The Flood / Could Logan be the next TDK?
« on: February 19, 2017, 03:38:21 PM »

72
The Flood / itt: discuss why flat earth theory is the ultimate redpill
« on: February 16, 2017, 03:33:26 PM »
in a perfect world everyone sees NASA and the US government for the decievers ththat they are, this is literal objective truth

73
The Flood / Is Beyonce the most overrated artist of our time?
« on: February 12, 2017, 08:06:15 PM »
?

74
The Flood / I know who Foman and Jen Bush are
« on: February 09, 2017, 04:05:21 PM »
AMA me anything

75
The Flood / Were you baptized?
« on: February 08, 2017, 07:03:15 PM »
?

77
The Flood / What to open with when sliding into the DMs
« on: December 26, 2016, 07:36:57 PM »
Need some ideas for good openers. I know you guys won't let me down.

Please discuss and thank you.

78
The Flood / Spider-Man Homecoming trailer
« on: December 09, 2016, 10:58:31 AM »
YouTube

79
Gaming / Possible Damien Wayne Batman game might be coming
« on: November 27, 2016, 04:19:22 PM »
YouTube

80
The Flood / Finally saw X Men Apocalypse
« on: November 25, 2016, 11:51:05 AM »
wtf was that shit

How do you go from DOFP to that

81
What did these geniuses expect when they put men & women together?

82
The Flood / DR STRANGE EPIC REVIEW
« on: November 03, 2016, 10:28:29 PM »
Very standard Marvel origin story. Not sure why some people seems to think it's one of the greats. It's everything you'd usually expect so people who love Marvel will love it and people who hate Marvel probably won't.

6/10

83
The Flood / Game of Thrones season 7 possible plot leak
« on: October 27, 2016, 04:56:00 PM »
https://youtu.be/ggZoVm27ABk

Aaaand it's fucking terrible

84
The Flood / PSU is trash
« on: October 22, 2016, 10:44:41 PM »
garbage team

85
Serious / Liberals BTFO
« on: October 13, 2016, 10:40:08 AM »
YouTube

86
The Flood / Now that the dust has settled
« on: October 04, 2016, 10:28:52 PM »
Rank the Star Wars movies in order from favorite to least favorite and if you want add where you think Rogue One or any other future Star Wars movies is going to rank.

87
Serious / Washington mall shooting: Manhunt underway after gunman kills 5
« on: September 24, 2016, 10:39:47 AM »
CNN

Quote
A man carrying a rifle entered a Macy's store at a mall in Washington state, shot dead four women and a man, and vanished into the night, police said.

Authorities believe only one person fired the shots Friday night at Cascade Mall in Burlington, about an hour north of Seattle.

88
The Flood / Who's more attractive: me or class?
« on: September 22, 2016, 09:31:02 AM »
Me:
Spoiler
Class:
Spoiler

89
The Flood / Picasso is dead. Steve Jobs is dead. Walt Disney is dead.
« on: September 18, 2016, 10:27:36 PM »
Name somebody living that you can name in the same breath as them.

90
The Flood / What is Nolan's best movie?
« on: September 17, 2016, 09:49:15 AM »
Please discuss and thank you

Pages: 123 45 ... 7