Skip to content

Instantly share code, notes, and snippets.

@ntsh
ntsh / gist:4564746
Last active December 11, 2015 07:09
Objective C Tic Tac Toe code for checking if particular move (x,y) by the player was a winning move. where player = 'X' or 'O' TicTacToe size = 3x3 matrix contains the current state of the TicTacToe
- (int) checkWin:(char)player :(int)x :(int)y
{
int row = 0;
int col = 0;
int diag = 0;
int rdiag = 0;
for (int i = 0; i < 3; i++)
{
if(matrix[x][i] == player) col++;
if(matrix[i][y] == player) row++;
@ntsh
ntsh / twit_faves_cli.py
Created August 2, 2012 19:31
Twitter favorites of a user through command line
'''
Usage:
> python twit_faves_cli.py username
'''
import httplib
import urllib
import json
import sys
base_url = 'api.twitter.com'