Skip to content

Instantly share code, notes, and snippets.

View xoxo.py
from os import system
from random import randint
def display_board(board):
system('clear')
print(' | | ')
print(' ' + board[7] + ' | ' + board[8] + ' | ' + board[9] +' ')
print(' | | ')
print('------------')
View test.py
def win_check(board,mark):
return ((board[7] == mark and board[8] == mark and board[9] == mark) or # across the top
(board[4] == mark and board[5] == mark and board[6] == mark) or # across the middle
(board[1] == mark and board[2] == mark and board[3] == mark) or # across the bottom
(board[7] == mark and board[4] == mark and board[1] == mark) or # down the middle
(board[8] == mark and board[5] == mark and board[2] == mark) or # down the middle
(board[9] == mark and board[6] == mark and board[3] == mark) or # down the right side
(board[7] == mark and board[5] == mark and board[3] == mark) or # diagonal
(board[9] == mark and board[5] == mark and board[1] == mark)) # diagonal
View classes.js
// Execute using --use_strict tag "node --use_strict classes.js"
class Human {
constructor(name, job, skills = []){
this.name = name;
this.job = job;
this.skills = skills;
}
getJob(){
@Bouzazi
Bouzazi / app.js
Created Jun 24, 2019
ES6 Checkpoint
View app.js
var pets = [
{ name: "Max", type: "dog", bornOn: 2018 },
{ name: "Angel", type: "cat", bornOn: 2015 },
{ name: "Jasper", type: "dog", bornOn: 2016 }
];
const getAge = pet => {
return new Date().getFullYear() - pet.bornOn;
}