Skip to content

Instantly share code, notes, and snippets.

from os import system
from random import randint
def display_board(board):
system('clear')
print(' | | ')
print(' ' + board[7] + ' | ' + board[8] + ' | ' + board[9] +' ')
print(' | | ')
print('------------')
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
// 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 June 24, 2019 14:16
ES6 Checkpoint
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;
}