Example #1
0
def rooms_info(simple_r,premium_r, vip_r,saman_caribbean):
    
    for simple_room in saman_caribbean:
        clase = 'Simple'
        cost = simple_room['cost']['simple']
        capacity = simple_room['capacity']['simple']
        hallway = simple_room['rooms']['simple'][0]
        hab = simple_room['rooms']['simple'][1]

        room = Rooms(clase, capacity,cost, hallway, hab)
        simple_r.append(room)
        
    for premium_room in saman_caribbean:
        clase = 'Premium'
        cost = premium_room['cost']['premium']
        capacity = premium_room['capacity']['premium']
        hallway = premium_room['rooms']['premium'][0]
        hab = premium_room['rooms']['premium'][1]

        room = Rooms(clase, capacity,cost, hallway, hab)
        premium_r.append(room)

    for vip_room in saman_caribbean:
        clase = 'VIP'
        cost = vip_room['cost']['vip']
        capacity = vip_room['capacity']['vip']
        hallway = vip_room['rooms']['simple'][0]
        hab = vip_room['rooms']['simple'][1]

        room = Rooms(clase, capacity,cost, hallway, hab)
        vip_r.append(room)

         
    return simple_r, premium_r, vip_r
    def create( spec, K=1, scheme = 'none', count = 20, *args ):
        """
        @spec - Specification (size, endpoints, barriers); either exactly
                specified in a file, or with numeric values in a list
        @option_scheme - none|manual|optimal|small-world|random|ozgur's betweenness|ozgur's randomness|end
        @n_actions - Number of steps that need to taken
        comment : optimal(shortest path to destination)??|random|ozgur's betweenness|ozgur's randomness
        """

        env = Rooms.create( spec, K )

        # Percentage
        if isinstance(count,str):
            count = int(count[:-1])
            count = count*env.S/100

        # Add options for all the optimal states
        O = []
        if scheme == "none":
            pass
        elif scheme == "random-node":
            O = OptionGenerator.optimal_options_from_random_nodes( env, count, *args )
        elif scheme == "random-path":
            O = OptionGenerator.optimal_options_from_random_paths( env, count, *args )
        elif scheme == "betweenness":
            O = OptionGenerator.optimal_options_from_betweenness( env, count, *args )
        elif scheme == "small-world":
            O = OptionGenerator.optimal_options_from_small_world( env, count, *args )
        elif scheme == "ultra-small-world":
            O = OptionGenerator.optimal_options_from_ultra_small_world( env, count, *args )
        elif scheme == "betweenness+small-world":
            O = OptionEnvironment.optimal_options_from_betweenness( env, count )
            count_ = count - len( O ) 
            O += OptionEnvironment.optimal_options_from_small_world( env, count_, *args )
        elif scheme == "load":
            O = OptionGenerator.options_from_file( count, *args )
        else:
            raise NotImplemented() 

        return OptionEnvironment( RoomsOptions, env.S, env.A, env.P, env.R, env.R_bias, env.start_set, env.end_set, O )
Example #3
0
def db_test(config):
  test_user = {
    "username" : "test"
    , "password" : "29148931"
    , "salt" : "1234"
    , "admin" : "1"
  }
  users = Users()
  users.create()
  users.save(test_user)

  test_room = {
    "room_id" : "seka"
    , "password" : "29148931"
  }
  test_room2 = {
    "room_id" : "test"
    , "password" : "29148931"
  }

  rooms = Rooms()
  rooms.create()
  rooms.save(test_room)
  rooms.save(test_room2)

  test_entry = {
    "room_id" : "seka"
    , "entry" : u"この内容はテストです"
    , "type"  : "keep"
    , "good"  : 4
  }
  test_entry2 = {
    "room_id" : "seka"
    , "entry" : u"この内容はテストです"
    , "type"  : "try"
    , "good"  : 5
  }

  entries = Entry()
  entries.create()
  entries.save(test_entry)
  entries.save(test_entry)
  entries.save(test_entry)
  entries.save(test_entry2)
  entries.save(test_entry2)

  goods = Goods()
  goods.create()

  test_comment = {
    "kpt_id" : 1
    , "text" : u"テストのコメントです"
  }

  test_comment2 = {
    "kpt_id" : 1
    , "text" : u"テストのコメントです2"
  }
  test_comment3 = {
    "kpt_id" : 2
    , "text" : u"テスト2のコメントです"
  }

  comments = Comments()
  comments.create()
  comments.save(test_comment)
  comments.save(test_comment2)
  comments.save(test_comment3)
Example #4
0
from Rooms import Rooms

rooms = Rooms("input.txt")

# Part 1
print(f'Valid Rooms Sector Id Sum = {rooms.sector_id_sum()}')

# Part 2
decrypted_rooms = rooms.decrypt_room_names()
for dr in decrypted_rooms:
    if dr[0] == "northpole object storage":
        print(f'Sector Id of North Pole Object Storage = {dr[1]}')

    ## Flag which notify when the user types 'play'
    "PLAY": False,
    ## Contains the name of the desired room entered by the user
    "TARGET_ROOM": "None",
    ## Contains the color of the detected ball (room)
    "NEW_ROOM_COLOR": "None",
    ## Flag indicating if the FIND mode is active or not
    "FIND_MODE": False
}

## Initialization of the move_base client in order to assign target position to the move_base action server
client = actionlib.SimpleActionClient('move_base', MoveBaseAction)
## Publisher to the startRD topic which allows to enable/disable the room detector
roomD_pub = rospy.Publisher('startRD', Bool, queue_size=10)
## Object of the class Rooms necessary for the knowledge representation of the environment
rooms = Rooms()


## Callback mathod of the UIsubscriber which handels the commands sent by the user.
# @param data is a string message coming from the UI ROS node
def UIcallback(data):
    global control_variables, rooms, client, roomD_pub
    if data.data == "play" or data.data == "Play":
        rospy.loginfo("[CommandManager] Recived a 'play' request!")
        control_variables["PLAY"] = True
        client.cancel_all_goals()
        # stop detecting
        roomD_pub.publish(False)
        time.sleep(3)
    elif data.data == "list":
        rospy.loginfo("The discovered rooms are:")
 def reset_rewards( env, spec, K=1, *args ):
     O = env.O
     env = Rooms.reset_rewards( env, spec, K )
     return OptionEnvironment( RoomsOptions, env.S, env.A, env.P, env.R, env.R_bias, env.start_set, env.end_set, O )
Example #7
0
 def open_rooms(self):
     """opens rooms page"""
     self.newwindow = Toplevel(self.window)
     Rooms(self.newwindow)
import OptionGenerator
from Rooms import Rooms

class RoomsOptions( ):

    @staticmethod
    def create( spec, K=1 scheme = 'none', count = 20, *args ):
        """
        @spec - Specification (size, endpoints, barriers); either exactly
                specified in a file, or with numeric values in a list
        @option_scheme - none|manual|optimal|small-world|random|ozgur's betweenness|ozgur's randomness|end
        @n_actions - Number of steps that need to taken
        comment : optimal(shortest path to destination)??|random|ozgur's betweenness|ozgur's randomness
        """

        env = Rooms.create( spec, K )

        # Percentage
        if isinstance(count,str):
            count = int(count[:-1])
            count = count*env.S/100

        # Add options for all the optimal states
        O = []
        if scheme == "none":
            pass
        elif scheme == "random-node":
            O = OptionGenerator.optimal_options_from_random_nodes( env, count, *args )
        elif scheme == "random-path":
            O = OptionGenerator.optimal_options_from_random_paths( env, count, *args )
        elif scheme == "betweenness":
Example #9
0
def test_sector_id_sum(file, sector_id_sum):
    rooms = Rooms(file)
    assert (rooms.sector_id_sum() == sector_id_sum)
Example #10
0
def test_decrypt_room_name(file, decrypted_room_name, sector_id):
    rooms = Rooms(file)
    decrytped = rooms.decrypt_room_names()
    assert (decrytped[0][0] == decrypted_room_name
            and decrytped[0][1] == sector_id)
Example #11
0
# from Mechanics import *
from os import system
from time import time
from Player.Player import Player
from Rooms import Rooms
from Mechanics.Mechanics import PlayerDead 

if __name__ == '__main__':
    player = Player()
    try:
        while player.location:
            system('cls')
            player.location = getattr(Rooms, player.location)(player)
    except PlayerDead:
        Rooms.death(player)
Example #12
0
 def reset_rewards( env, spec, K=1, *args ):
     O = env.O
     env = Rooms.reset_rewards( env, spec, K )
     return OptionEnvironment( RoomsOptions, env.S, env.A, env.P, env.R, env.R_bias, env.start_set, env.end_set, O )
Example #13
0
import OptionGenerator
from Rooms import Rooms

class RoomsOptions( ):

    @staticmethod
    def create( spec, K=1 scheme = 'none', count = 20, *args ):
        """
        @spec - Specification (size, endpoints, barriers); either exactly
                specified in a file, or with numeric values in a list
        @option_scheme - none|manual|optimal|small-world|random|ozgur's betweenness|ozgur's randomness|end
        @n_actions - Number of steps that need to taken
        comment : optimal(shortest path to destination)??|random|ozgur's betweenness|ozgur's randomness
        """

        env = Rooms.create( spec, K )

        # Percentage
        if isinstance(count,str):
            count = int(count[:-1])
            count = count*env.S/100

        # Add options for all the optimal states
        O = []
        if scheme == "none":
            pass
        elif scheme == "random-node":
            O = OptionGenerator.optimal_options_from_random_nodes( env, count, *args )
        elif scheme == "random-path":
            O = OptionGenerator.optimal_options_from_random_paths( env, count, *args )
        elif scheme == "betweenness":