Giter Club home page Giter Club logo

amity-room-allocation's Introduction

####Coverage Status

#amity-room-allocation

#####Just as the name implies this short Algorithm was created to randomly allocate company members to randomly generated rooms.

Within the Scope of this algorithm the code has a pre-defined number of offices for allocation and a predefined number of hostels to allocate to male and female fellows who opted for it. This definition can be found in the Rooms.py file. You can always modify that after you fork this repo.

Offices prepopulated are:'Carat', 'Anvil', 'Crucible', 'Kiln', 'Forge', 'Foundry', 'Furnace', 'Boiler', 'Mint', 'Vulcan'
Malerooms prepopulated are:'topaz', 'silver', 'gold', 'onyx', 'opal'
Femalerooms prepopulated are: 'ruby', 'platinum', 'jade', 'pearl', 'diamond'

Algorithm  Basic Conditions are:

1. No staff should be allocated to Male or Female Rooms
2. No Male or Female room should exceed 4 persons
3. No office allocation should exceed 6 persons

######The input into this Script can be found in the input.txt file where the input format can be viewed or seen below:

BOLA AHMED   M FELLOW Y
JOHN OBI     M FELLOW N
ISSAC NNADI  M STAFF   
CRIBS JANE   F FELLOW Y

The above input format specifies the Name of the Company's member, the member's gender, the member's position and the member's choice. One more thing here, Staffs are not allocated to either male or female offices and so they have no choice to make from the sample data input.(note: Ensure that you leave several spaces after 'STAFF' for input)

###Work Flow

The fileparser.py reads data, sorts them and stores them in different class instance from persons.py, according to the conditions given.

The rooms.py stores the class definition, pre-defined offices and livingspaces, it also uses its add method to add people to rooms.

The Building.py makes use of the data returned from the fileparser.py script and the class definitions and rooms definition found in the rooms.py script. The Building.py script allocates based on conditions given ensuring that each room meets desired condition before allocating to the next room. Ofcourse, no one knows who is going to be placed in any room and which room will be called first because everything is random and there is no certainty.

The viewresult.py outputs your result in details. Methods used in the viewresult.py are:

amity = Building('input.txt');
amity.populate_rooms()
amity.get_fellows()

amity.allocate_to_office()
amity.allocate_to_livingspace()

amity.allocated_members_list()
amity.unallocated_members_list()

amity.maleroom_members('opal')
amity.femaleroom_members('ruby')
amity.officeroom_members('Mint')

These methods are gotten from the Building.py script.

###To use Script

Install Python 2.7+ if you don't have it installed

Give Script input data following the sample input.txt given above and you can add or modify rooms to rooms.py using a Text Editor.

Run command from command line(CLI) python viewresult.py and your result will be printed to screen.

To COPY result to text file run python viewresult.py > result.txt .

To dynamically Input text file and not make use of default name of input.txt as your input file modify the code amity = Building('your .txt file goes here') in building.py and you are good to go.

Note: Your input file needs to be in same directory with the script.

####Have fun!!!!!

amity-room-allocation's People

Stargazers

Ogbara Godwin avatar Seyi Adekoya avatar samuelvarejames avatar

Watchers

Ashish avatar James Cloos avatar Chidiebere Nnadi avatar samuelvarejames 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.