Python code

import random
import sys

def drawBoard(board):
#this function prints out the board that is passed. Returns none.
HLINE=’ +—+—+—+—+—+—+—+—+’
VLINE=’ | | | | | | | | |’

print (‘ 1 2 3 4 5 6 7 8 9’)
for y in range(8):
print(y+1, end=”)
for x in range(8):
print(‘| %s’ % (board[x][y]), end=”)

def resetBoard(board):
#Blanks out the board it is passed, except for the original starting position

for x in range(8):
for y in range(8):

#starting peices

def getNewBoard():
#creates a brand new, blank data structure

for i in range(8):
board.append([”] * 8)
return board

def isValidMove(board, tile, xstart, ystart):
# Returns False if the player’s move on space xstart, ystart is invalid.
# If it is a valid move, returns a list of spaces that would become the player’s if they made a move here.

if board[xstart][ystart] !=’ ‘ or not isOnBoard(xstart, ystart):
return False
board[xstart][ystart] = tile # temporarily set the tile on the board.
if tile == ‘X’:
otherTile = ‘O’
otherTile = ‘X’

for xdirection, ydirection in [[0, 1], [1, 1], [1, 0], [1, -1], [0, -1], [-1, -1], [-1, 0], [-1, 1]]:
x, y = xstart, ystart
x +=xdirection #first step in the direction
y +=ydirection #first step in the direction
if isOnBoard(x,y) and board[x][y] == otherTile:
#There is a peice belonging to the other player next to our piece

x +=xdirection
y +=ydirection
if not isOnBoard(x,y):
while board[x][y] == otherTile:
x +=xdirection
y += ydirection
if not isOnBoard(x,y): #break out of while loop , then continue in fro loop
if not isOnBoard(x,y):
if board[x][y] == tile:
#there are pieces to flip over. Go in the reverse direction untill we reach the original space, noting allthe tiles along the way
while True:
x -=xdirection
y -=ydirection
if x == xstart and y ==ystart :
board[xstart][ystart] =”#restore the empty space

if len(tilesToFlip)==0: #If no tiles were flipped , this is not a valid move.
return False
return tilesToFlip

def isOnBoard(x, y):
#retunrs True if the coordinates are located on the board
return x>=0 and x=0 and y bestScore:
bestMove = [x, y]
bestScore = score
return bestMove

def showPoints(playerTile, computerTile):
# Prints out the current score.
scores = getScoreOfBoard(mainBoard)
print(‘You have %s points. The computer has %s points.’ %(scores[playerTile], scores[computerTile]))

print(‘Welcome to Reversi!’)
while True:
# Reset the board and game.
mainBoard = getNewBoard()
playerTile, computerTile = enterPlayerTile()
showHints = False
turn = whoGoesFirst()
print(‘The ‘ + turn + ‘ will go first.’)
while True:
if turn == ‘player’:
# Player’s turn.
if showHints:
validMovesBoard = getBoardWithValidMoves(mainBoard, playerTile)
showPoints(playerTile, computerTile)
move = getPlayerMove(mainBoard, playerTile)
if move == ‘quit’:
print(‘Thanks for playing!’)
sys.exit() # terminate the program
elif move == ‘hints’:
showHints = not showHints
makeMove(mainBoard, playerTile, move[0], move[1])
if getValidMoves(mainBoard, computerTile) == []:
turn = ‘computer’
# Computer’s turn.
showPoints(playerTile, computerTile)
input(‘Press Enter to see the computer\’s move.’)
x, y = getComputerMove(mainBoard, computerTile)
makeMove(mainBoard, computerTile, x, y)
if getValidMoves(mainBoard, playerTile) == []:
turn = ‘player’
# Display the final score.
scores = getScoreOfBoard(mainBoard)
print(‘X scored %s points. O scored %s points.’ % (scores[‘X’], scores[‘O’]))
if scores[playerTile] > scores[computerTile]:
print(‘You beat the computer by %s points! Congratulations!’ % (scores[playerTile] – scores[computerTile]))
elif scores[playerTile] < scores[computerTile]:
print('You lost. The computer beat you by %s points.' % (scores[computerTile] – scores[playerTile]))
print('The game was a tie!')
if not playAgain():



Ben Stuff

Behold ,
He always stood,
For sometime now at a glance,
His face looked distance,
Buried in a deep unknown thoughts,
No one knew anything behind that look,
But rumour had it,
That he carried that which no man could,
Bestowed upon him was the burden of all and sundry,
But do we cry,
He beats his drum at the disposal of his hands,
He plays the guitar at the tenderness of his fingers,
Beating the dust out of her heart,
She who understands his clenching fists,
And swayed by his tunes,

View original post

Break the shackle and be the next big thing

Our ultimate goal in life always revolve around making life better, having good family, owning some business ventures (wide range of investments) and all the goods that can be attained in life. We always read great books “How to succeed in life, Principles for a good life” and all those books in the bead to get right information to better our selves.
However, we; the youth have always been buried in some sort of cocoon that have prevented us from making it out and be what we want to be. Be what we`ve always have since time immemorial in our dreams. We always want to be better within a blink of a moment, we want to ankukia some thousands if not millions of cash from the blues and start investing big fortunes, buy some luxury cars, good house, etc, (Thanks to Sportpesa, elitebet and other betting sites for almost making this a reality though sometime at a cost).
Below are some of the reasons that have prevented us from making out to be better
Tied to the societal traditional norm.
The society has always had a belief. A believe that we have to follow a certain set of rules in order to succeed and every one in it have to be guided by it towards his/her goals. One has to have university degrees, masters, PhD’s, and all those big tittles to succeed in his/her life. I`m not saying, however, we should not go to school to earn all those titles. Some have succeeded but it is not a guarantee for everybody. We have accustomed to focusing on titles we would have rather than the reality of life we want to have; good life which titles often don`t bring to us.
Suli Breaks in his spoken word “SAY YES” said “you don`t have to go to University, if it is not for you”
So it is time we break this traditional societal norm. Find passion and follow it. Some of the great people we know of in the world did not complete their formal education, some in our backgrounds did not see the door to classroom yet they are successful in life.
I, you, them, us, we neglect the small things that matter. There is an event in town of entrepreneurship workshop where entrepreneurship skills would be taught. Who bothers to go? No one, it is only some few young men and women make it there. Contrary, same day, there is a function in the same town, a bash, a party, in some club. The capacity is unbelievable. We throng there in large numbers in contrast to the entrepreneurship forum. Partying is good. It is one way of enjoying life. But sometimes a balance between the comfort zones and a little effort in our struggles can do us much better given time because life begins at the end of that place you call comfort zone.
Fear of failure
We often fear to try something out new with the fear of the results. What if it fails, what if it turns out to be the opposite of my expectations, are all strings of thoughts that flows in our minds.
We have to try it anyway. Who would care of our results anywhere, it only matter to us . The sweetest part of life is breaking the shackles of fear. Try it, fail, learn from it, and try it again. In the end we would be joining the dots to form tunes humming together in perfect harmony with each other making us better.
Failing to implement the ideas we have
We always think we have to have mega brains, be geniuses to have valid ideas worth implementation. Build next Face book app, build an app that do wonders in the world. But let me tell you something; small ideas become big when we take a step to implement it. There is a story of Tom Osborn, a Kenyan who is the inventor of ‘green’ charcoal. He started his invention not knowing how big it would be. Erick Kinoti, founder and director of Shades Systems East Africa Limited started when he was selling eggs and somebody was looking for tents on hire. It is then that he realized that no one had, leading him towards his quest to coming up with the company.
The ideas we have are worth what it takes. They always lead us to something bigger than we imagined however small they initially are.
We don`t trust our struggles
We have at times been derailed by happenings in our lives, regrets have followed us, opportunities have slipped through our hands like sand grains, like water under the bridge never to be seen again. But at the end there is one thing that never fails us, our struggle.
The struggles we put in our daily lives always add up to something big someday ahead and putting trust in it will make who we wanted to be.

All the best as you set out to be better your life.

One hand washes the other before they can both was the face

As my pen is to the paper,

And my heart to my loved ones,

My sense to common sense,

I give up on corrupt leaders,

I give up on disloyalty,

But I will never give up on my own,

Play brother to me and let brotherly love flow,

Lift me up and I will catch your tear drop and prevent another from falling,

And as it always goes,

One hand washes the other,

Before they can both wash the face,

So is to the kinship we would always enjoy,

Understanding our innermost thoughts,

Yet not sounding too-off-the-wall,

And we would live in a more rewarding, fulfilling and enlightened life of us,

Of unity, of cooperation and delight,

And together we prosper,

Why is the child in hands of the beggar always sleeping?

I was browsing over the net and came across this post by the Buddhist Broadcasting Network and thought I should share it it.  “Why is the child in hands of the beggar always sleeping?

 “Near the metro station, sits a woman of uncertain age. Her hair is confused and dirty, her head bowed in grief.

The woman sits on the dirty floor and next to her lies a bag. Into that bag, people throw money. In the woman’s hands, asleep, is a two year old baby. He is in a dirty hat and dirty clothes

“Madonna with baby” – numerous passers-by will donate money. The people of our kind – we always feel sorry for those less fortunate. We are ready to give unfortunate people our last shirt, the last penny out of our pocket and never think another issue. Helping, seems like a “Good job done.”

I walked past the beggar for a month. I did not give any money, as I knew that this is a gang-operated scam, and that money collected by the beggar, will be given to whoever controls beggars in the area. Those people own numerous luxury properties and cars. The beggar also gets something, of course, “A bottle of vodka in the evening and a döner kebab.” A month later, walking past the beggar, a shock suddenly hit me….
I’m standing at a busy crossing, staring at the baby. He is dressed, as always, in a dirty track suit. I realized that it seemed “wrong”, finding a child in a dirty underground station from morning to evening. The baby was always asleep. He never sobbed or screamed, he always slept, burying his face in the knee of a woman who was his MUM.

Do any of you, dear readers, have children? Remember how often they slept at the age of 1, 2 or 3 years old? An hour, two, maximum three (and never consecutive). An afternoon nap, and there was always movement. For the whole month, every day I walked to the underground station, I never saw the child awake! I looked at the tiny little man, with his face buried in the knee of his mother, then at the beggar, and my suspicion was gradually formed. “Why does he sleep all the time?” I asked, staring at the baby.

The beggar pretended not to hear me. She lowered her eyes and hid her face in the collar of her shabby jacket. I repeated the question. The woman again looked up. She looked somewhere behind my back, tired with utter irritation. Her look was similar to the creatures from a different planet.

“F *** off,” her lips murmured.

“Why is he asleep?!” I almost cried.

Behind me, someone put their hand on my shoulder. I looked back. An old man was looking at me disapprovingly:

“What do you want from her? Can’t you see how hard she’s got it in her life? Eh?”

He took some coins from his pocket and threw them in the beggar’s bag.

The beggar made a cross by waving her hand, portraying the face of humility and universal grief. The guy removed his hand from my shoulder and strolled out of the underground station. I bet, at home, he will tell how he defended poor, distraught woman from a soulless man in a tube station.

Next day, I called a friend. He was a funny man with eyes like olives. His nationality – Romanian. He only managed to complete three and a half years of education. His lack of education did not prevent him from moving around the City streets in expensive foreign cars and live in a “small” house with a countless number of windows and balconies. From my friend, I managed to find out that the beggar is part of a business. Despite the genuine appearance, it is clearly organized. It is supervised by organized crime rings. The children used are “rented” from families of alcoholics, or simply stolen.

I needed to get the answer to my question – Why is the baby always sleeping? And I received it. My friend explained it to me, casually and with a calm voice that twisted me in shock, just like he was talking about weather report: “They are on heroin, or vodka.”

I was dumbfounded. “Who is on heroin or vodka?!”

He answered, “The Child, so he doesn’t scream. The women will be sitting whole day with him, imagine how he might get bored?

In order to make the baby slept the whole day, it pumped up with vodka or drugs. Of course, children’s bodies are not able to cope with such a shock. And children often die. The most terrible thing – sometimes children die during the “working day”. And imaginary mother must hold another dead child on her hands until the evening. These are the rules. And the by passers-by will throw some money in the bag, and believe that they are moral. Helping the mother alone.”

The next day, I was walking near the same underground station. I built up journalistic confidence and was ready for a serious conversation. But the conversation didn’t work out. Instead, it turned out the following way … the woman was sitting on the floor and in her hands she was holding a different child. I asked her a question about the documents of the child, and, most importantly, where was the child from yesterday. She simply ignored me. My questions were not ignored by passers-by though. I was told that I was out of my mind, questioning a poor beggar with a child. Eventually, I was escorted out of the station in disgrace. The one thing that remained was to call the police. When the police arrived, the beggar with the baby had disappeared. I stood with a full sense of “trying to fight windmills.”

When you see in the subway, or on the street, women with children, begging, think before your hand them your money. Think about it, that if it wasn’t for your hundreds of thousands of handouts, the business like this would have died. The business would die and not the children, pumped full of vodka or drugs. Do not look at the sleeping child with affection… See horror… Since you are reading this article, you know now why the child is sleeping in beggars hands.

NB: Share it on after reading this. Why is the child in hands of the beggar always sleeping?

The Lesson – Maya Angelou

Elena Xtina

I keep on dying again.
Veins collapse, opening like the
Small fists of sleeping
Memory of old tombs,
Rotting flesh and worms do
Not convince me against
The challenge. The years
And cold defeat live deep in
Lines along my face.
They dull my eyes, yet
I keep on dying,
Because I love to live.

The Lesson – Maya Angelou

My family had the most amazing news yesterday. The past few months have been a struggle but have made me even more thankful for my life, for the health and happiness of my family and friends. Ultimately – they come first. When you have to be strong for them, step up. Most of all I am just thankful my padre can go on his trip back home that he thought wouldn’t happen. I have never seen him so happy, and that makes me happy 😀

View original post

Let`s find our way out.

Ben Stuff

With everything that is going on in our lives,
With everything happening in our lives,
It`s always hard to keep track,
Of what happened and what`s available now,
What is promised?
What has been around for some time?
We push on blindly always,
Groping in the dark for a helping hand,
Trying to find a way out of the darkness we are entangled in,
We get our feet wet and muddy,
By jumping into a pool of mud we have a prior knowledge of,
Not afraid of the consequences,
However, we always do unknowingly some things,
With no knowledge of it being wrong or right,
Only to realize later it was either,
Right, good of u,
Wrong, bad of you,
Amidst all however,
We forget that we are the master of our lives,
Drivers of our auto motives,
And that we have to do some favour to our lives,

View original post 46 more words


It`s yet another sad day for Kenya early this morning after an unknown gunmen attacked Moi University, Garissa campus. According to KTN there are 30 casualties and four are in critical conditions. We wish all the best the KDF and other military/security personnel as they try their best to counter the assailants.

My Home My Village.

Ben Stuff


A rising white smoke at a distance,
A sound of a mowing cow from a distance is heard,
With twinkling sound of a bell hanging down from its neck,
Marching towards the homesteads,
A mother calling her son,
A faded reply would be heard from a distance,
The sun is setting,
Everyone is busy,
Up and down winding up their chores,
It`s the sound of the village,
A sudden feeling of peace engulfs me,
It`s yet another warm feeling,
Away from the city noise,
So serene and conducive,
Bringing brotherhood closer,
Bonded by blood and culture,
The conformity in doing things,
It`s my home,
It`s my village,
With which I`m proud of,

View original post

How to make a bootable USB using CMD in windows.

Insert the flash disk onto your computer then open command prompt (CMD) as an administrator.
On the terminal type the following in order as below:
1. Diskpart
2. List disk
3. Select disk 2 (select your USB disk number, mine is disk 2).
4. Clean
5. Create partition primary
6. Select partition 1
7. Format fs=ntfs quick
8. Active
9. Assign
10. Exit
11. Exit

Below is the screen shot of the same. After doing that you copy the files the windows files into the flash drive. And from there you are good to go.