Monday, May 19, 2014

C++ coding for Tic Tac Toe game

#include <conio.h>
#include <iostream>
using namespace std;

void ticTacToe() {
    char w = 0, b[9] = { '1','2','3','4','5','6','7','8','9' };
    char player[][9] = { "Player O", "Player X" };
    unsigned int slot = 0, turn = 1, moves = 0;
    for(;;) {
        system("cls");
        cout << "Tic Tac Toe!" << endl << endl;
        cout << "   " << b[0] << "|" << b[1] << "|" << b[2] << endl << "   -+-+-" << endl;
        cout << "   " << b[3] << "|" << b[4] << "|" << b[5] << endl << "   -+-+-" << endl;
        cout << "   " << b[6] << "|" << b[7] << "|" << b[8] << endl << endl;
        if (w || (++moves > 9)) {
            if (w) cout << player[w=='X'] << " is the winner!!!" << endl << endl << endl;
            else   cout << "No Winner!!!" << endl << endl << endl;
            cin.clear(); cin.ignore(~0u>>1, '\n'); _getch();
            return;
        }
        cout << player[turn^=1] << " Choose a Slot... ";
        cin  >> slot;
        if (slot < 1 || slot > 9 || b[slot-1] > '9') {
            cout << "Please Choose A Valid Slot!!!" << endl;
            cin.clear(); cin.ignore(~0u>>1, '\n'); _getch();
            turn^=1; moves--;
            continue;
        }
        b[slot-1] = turn ? 'X' : 'O';
        ((((b[0]==b[1]&&b[0]==b[2]&&(w=b[0])) || (b[3]==b[4]&&b[3]==b[5]&&(w=b[3]))
        || (b[6]==b[7]&&b[6]==b[8]&&(w=b[6])))||((b[0]==b[3]&&b[0]==b[6]&&(w=b[0]))
        || (b[1]==b[4]&&b[1]==b[7]&&(w=b[1])) || (b[2]==b[5]&&b[2]==b[8]&&(w=b[2])))
        ||((b[0]==b[4]&&b[0]==b[8]&&(w=b[0])) || (b[2]==b[4]&&b[2]==b[6]&&(w=b[2])))));
    }
}

int main() {
    for(;;) ticTacToe();
    return 0;
}

Friday, May 02, 2014

Iranian Man Goes Without a Bath for 60 Years







An Iranian man has gone 60 years without a bath and you have to see the results to believe it.  Claiming that cleanliness makes him ill, 80 year-old Amou Haji is now being called the world’s dirtiest man.
Haji spends his life in isolation, essentially living in a hole in Dejgah village, located in the Iranian province, Fars.  His diet consists mainly of rotten meat, porcupine being his favorite, and smokes animal feces.  Haji reports that the very idea of taking a bath after going without for so long makes him ill and angry.
Claiming various emotional setbacks in his younger days, Haji is more than comfortable with the lifestyle he has adopted.  He lives in utter isolation in his small Iranian village, no one around to tell him to bathe or that he smells bad.  It seems to suit him quite well.
Exactly what does a man who goes without bathing for 60 years do for relaxation?  Why, pack his pipe with the feces of animals, of course.  When not smoking animal poo he does like to smoke regular old cigarettes, smoking them five or more at a time.
In addition to his aversion to bathing, Haji also claims an aversion to food and clean drinking water.  He prefers to eat the meat of rotting animals over any fresh kill.  Hydration is not an issue for him, he gets his five liters of drinking water a day out of a rusty old oil can.  Given the fact that Haji is over 80 years-old one would imagine that his diet isn’t doing him too much harm.
Lest we think that Haji has given up on grooming altogether, he does allow himself haircuts.  When in need he simply burns it off and tosses it into the fire.  When he feels like checking on his appearance he simply glances in the side mirrors of cars as they pass him by, clearly slowing down to get a good, long look at someone who has gone without a bath for 60 years.  His wardrobe consists of old rags and, in the colder months, he allows himself to wear an old warm helmet to keep warm.
As for shelter, Amou Haji has two domiciles in which to choose from.  His favorite being a simple hold in the ground, approximately the size of a grave.  The other is an modest brick house that was built by locals who felt sorry for him. He sleeps without the aid of a mattress or pillows, preferring to use the earth as his bed.  Haji has no possessions so there is no fear of being robbed.
Yes, the Iranian man who has gone without a bath for over 60 years may live a different life than most.  But he lives with no mortgage, no electricity bills, no car insurance  His worries are few.  His wants are simple.  He is at peace with himself and the life he has chosen to live. Just don’t ask him to bathe.