Code Monkey home page Code Monkey logo

game-tree's Introduction

Ștefan MĂGIRESCU

GameTree

In designing the game tree I used an array of pointers to each node's children. Generally, I designed new functions for each of the exercises, but I occasionaly borrowed functions from the other exercises.

Exercise no. 1:

  • read reads from input file
  • printTicTac writes to output file
  • printTree accesory function, prints to console
  • checkLvl checks where I am in the tree, by counting spaces in the tic tac toe board
  • checkWin checks which player wins
  • tictacMaker generates move
  • newNode allocates memory for new node in tree
  • insert builds the tree
  • freeTree frees allocated memory

Exercise no. 2:

  • insert2 builds the tree
  • TorF goes through tree and assigns T or F to each node, judging by its children
  • printTorF writes to output file

Exercise no. 3:

  • freeTreeMin frees allocated memory
  • parse parses the input text
  • minimaxTreeBuilder builds the tree breadth first, using a queue
  • minimax applies the MiniMax algorithm to each node
  • printMinimax writes to output file

General functions:

  • ProbOne deals with exercise no. 1
  • ProbTwo deals with exercise no. 2
  • ProbThree deals with exercise no. 3
  • initQ allocates memory for root node
  • isEmpty checks if queue is empty
  • enqueue adds element to queue
  • dequeue deletes element from queue

For more on how the functions work, check comments.

game-tree's People

Contributors

magynon 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.