Giter VIP home page Giter VIP logo

c4's Introduction

c4 is a Connect-4 game I wrote in 2005.


Build instructions
==================
gcc -ansi -o c4 c4.c
./c4


Game rules
==========
  Connect Four (a.k.a Four-in-a-Line) is a two-player connection game
	played on a 7x6 board. Players take turns to drop a piece in one of
	the seven columns where the piece falls straight down, occupying the
	lowest empty cell in that column. The first player who connects at
	least four of one's own pieces in a line, either vertically,
	horizontally, or diagonally, wins. The game may also end in a draw
	if the board is full and neither player wins.


User interface
==============
  1 ~ 7 - column indices.
  .     - empty cell.
  X     - AI's piece. (AI always plays first.)
  O     - your piece.


Keys
====
  1 ~ 7 - drop a piece in the corresponding column if it's not full.
  0     - surrender.

  Invalid input will be discarded by the program.


Emoticons
=========
  :D    - You're probably going to lose in a few moves.
  :S    - You're probably going to win in a few moves.
  :)    - Neutral.


AI
==
  The core of the algorithm is traditional alpha-beta pruning plus a tiny
	opening book and a little bit of randomness in move selection. Based on
	some beta-testers' feedback, its strength was tweaked so that an average
	player would find it quite challenging, but not too hard.


Main obfuscation techniques
===========================
- Weave code logic into distracting three-letter words and acronyms
  which are a ternary extension of the "opaque predicate"[1][2][6] concept.
- Dismantle code locality information from the AI algorithm by splitting
  the recursive function, flattening its control flow graph[3][4][5], with a
  further twist of a seemingly incorrect run-time pointer permutation.
- Intertwine data heavily[1][3]; assign multiple meanings to most variables.


References
==========
[1] C. Collberg, C. Thomborson, and D. Low.  A taxonomy of obfuscating
    transformations.  Technical Report 148.  Department of Computer Science,
    University of Auckland, 1997.
[2] C. Collberg, C. Thomborson, and D. Low.  Manufacturing Cheap, Resilient,
    and Stealthy Opaque Constructs.  ACM SIGPLAN-SIGACT Symposium on
    Principles of Programming Languages, 1998.
[3] C. Collberg, C. Thomborson, and D. Low.  Breaking Abstractions and
    Unstructuring Data Structures.  International Conference on Computer
    Languages, 1998.
[4] C. Wang, J. Hill, J. Knight, and J. Davidson. Software Tamper Resistance:
    Obstructing Static Analysis of Programs. Technical Report CS-2000-12,
    University of Virginia, 2000.
[5] C. Wang.  A Security Architecture for Survivability Mechanisms.  PhD
    Dissertation. Department of Computer Science, University of Virginia, 2000
[6] C. Collberg and C. Thomborson.  Watermarking, Tamper-proofing, and
    Obfuscation - Tools for Software Protection.  IEEE Transactions on
    Software Engineering, 2002.

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.