Coder Social home page Coder Social logo

tic-tac-toe's Introduction

Tic Tac Toe

Description

Learning Python through creating a game

Module

  • random

틱택토 게임 설계

  1. 2차원 리스트를 사용하여 게임판을 생성하고 각각의 칸을 빈칸으로 초기화

    • 빈칸에 대한 지정한 기호(*)를 사용
  2. 게임판에 빈칸이 남아있는지 확인

    • 게임판 전체를 확인하고 True/False 반환
  3. 둘 중 한 플레이어가 승리했는지 확인

    • 8가지의 승리 상황에 따른 가능성을 확인
    • 각각의 행, 열과 두 개의 대각선 방향을 확인
  4. 게임판의 현재 상태를 출력

  5. 게임 시작

    • 무작위로 선공할 플레이어를 선택
    • 게임 루프를 기동
    • 게임판의 현재 상태를 출력하고 다음 플레이어가 빈칸을 선택
    • 플레이어가 선택할 빈칸의 위치(행과 열 번호)를 입력받음
      • 사용자일 경우 사용자 입력을 통해 행과 열 번호를 입력받음
      • 컴퓨터일 경우 무작위로 행과 열 번호를 선택
    • 플레이어가 선택한 위치에 기호를 표시하고 게임판을 업데이트
    • 현재 플레이어가 승리했는지 확인
      • 승리 상황인 경우, 승리한 플레이어에 대한 메시지를 출력하고 게임 루프를 종료
    • 게임판에 빈칸이 남아있는지 확인
      • 게임판이 가득찬 경우, 무승부 메시지를 출력하고 게임 루프를 종료
    • 게임이 종료될때까지 게임루프를 반복

tic-tac-toe's People

Contributors

celine-yoon avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.