Coder Social home page Coder Social logo

cpp_pushbox's Introduction

Kookmin University Software Department, CPP Project

Hello, This is the Push Box Game using Cpp/C++

What is the Push Box Game?

see Wikipedia

It is a type of classic puzzle game. It is also called Sokoban, push push, etc. How to play is detailed in Wikipedia.

Before progress

  1. Constraint

    • The wall is marked 1.
    • The box is marked 2.
    • The Goal is marked 3.
    • The empty space is marked 0.
    • Outside the wall is marked 4.
    • Do not display player in the map.
    • Use the ncurses library.
  2. Outline

    • Variable names and Function names
      • map
      • level
      • step
      • push
      • goalList
      • position, pair<int x, int y>
      • isSuccess()
      • move()
    • Make a map formatted by text file. Make maps by level. In map first and second integers are the coordinate of the starting point.
    • Using the fstream library read a map. And store coordinates of goals in goalList.
    • Removes index 0 on the coordinate. (Selective)
    • Have to recognize the arrow key input.
    • First, initialize to level 1.
    • When the arrow key is input, execute move().
    • move(direction) { if(when there is empty space in the direction) {setStep(+1)} else if (when there is a wall in the direction) {} else if (when there is a box in the direction) { if (canTheBoxMove) {setPush(+1), setStep(+1)} else {} }
    • In postProcessing(), display the player in the map. And confirm whether player complete current level. And do something properly(change the level, initialize, etc).
    • If (level == final level && isSuccess()) {send a congratulation message}
  3. + alpha

    • Measure the completion time for each level.
    • Reset button.

Progress

  1. libraries

    • fstream: To read a text file.
    • time.h: To measure the completion time.
    • locale.h: To use special characters.
    • curses.h: To display game in one window.
  2. Variable names

    • MAX_SIZE_ROW
    • MAX_SIZE_COL
    • FINALLEVEL
    • map
    • level
    • push
    • goalList
    • userPosition, struct {int x, y}
    • startTimer
    • endTimer
    • records, vector<vector>
  3. Function names

    • readMap(): read a map matching the current level.
    • isSuccess(): return bool. confirm completion.
    • postProcessing(): display the player in the map. And confirm whether player complete current level. And do something properly (change the level, initialize, etc).

cpp_pushbox's People

Contributors

chickengak avatar kmswlee avatar younghwan avatar

Stargazers

 avatar  avatar

Watchers

 avatar

cpp_pushbox's Issues

Make base and map

Used VS2019.

  1. Make base
    1-1) CommonDefinition.h
    1-2) PushBoxGame.h
    1-3) PushBoxGame.cpp
    1-4) Main.cpp
    1-5) level1.txt

  2. Set .gitignore

Redesign

Redesign

  1. Paint color
  2. Two characters are a space in the game.
  3. Align horizontal and vertical center.
  4. Make the title.
  5. Can go next level.

Refactoring

Refactoring whole sources.

What I did in this issue.

  1. Change and Standardize variable names.
  2. Apply Structure. (pair -> x,y)
  3. Separate Classes. And add some functions regarding separating.
  4. Delete unused functions.

Add new functions.

  1. isSuccess() - Can check the success of level.
  2. vector<vector> records - Now can record player's scores.
  3. showWithPlayer() - You can see the player.
  4. afterProcess() - It will be accessed after each turn. And It will change the current level into the next level and send a proper message.

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.