In our course, these projects have boosted enrollment, teaching reviews, and student engagement. Important note: All of your search functions need to return a list of actions that will lead the agent from the start to the goal. python pacman.py -l mediumCorners -p AStarCornersAgent -z 0.5, Note: AStarCornersAgent is a shortcut for. The Pacman board will show an overlay of the states explored, and the order in which they were explored (brighter red means earlier Task 3: Varying the Cost Function. If nothing happens, download Xcode and try again. As far as the numbers (nodes expanded) are concerned, they are obtained by running the program. If nothing happens, download GitHub Desktop and try again. Academic Dishonesty: We will be checking your code against other submissions in the class for logical redundancy. The Pac-Man projects were developed for CS 188. Pacman world is represented with booleans, and logical inference is used to solve planning tasks as well as WebMy solutions to the berkeley pacman ai projects. Introduction. WebWelcome to CS188! Learn more. Berkeley-AI-Pacman-Projects has no bugs, it has no vulnerabilities and it has low support. First, test that the SearchAgent is working correctly by running: The command above tells the SearchAgent to use tinyMazeSearch as its search algorithm, which is implemented in search.py. Any non-trivial non-negative consistent heuristic will receive 1 point. The projects were developed by John DeNero, Dan Klein, Pieter Abbeel, and many others. Make sure that your heuristic returns 0 at every goal state and never returns a negative value. In these cases, we'd still like to find a reasonably good path, quickly. To achieve that I used the copy-sign function which returns the magnitude of the first argument, with the sign of the second argument. This file describes several supporting types like AgentState, Agent, Direction, and Grid. Work fast with our official CLI. Designed game agents for the This file describes several supporting types like AgentState, Agent, Direction, and Grid. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. If nothing happens, download GitHub Desktop and try again. In this project, you will implement value iteration and Q-learning. # Student side autograding was added by Brad Miller, Nick Hay, and # Pieter Abbeel These data structure implementations have particular properties which are required for compatibility with the autograder. Now, its time to formulate a new problem and design a heuristic for it. Hint: the shortest path through tinyCorners takes 28 steps. Information about the projects you can find here(, In each project you have to download all the files and you will have to follow the instructions from the link i have for every project, If you are in Linux you don't have to do anything because Python is preinstalled,in Mac and Windows you have to download Python from here(. PointerFLY / Pacman-AI Public. Indeed, one possible implementation requires only a single generic search method which is configured with an algorithm-specific queuing strategy. http://ai.berkeley.edu/project_overview.html. sign in WebFinally, Pac-Man provides a challenging problem environment that demands creative solutions; real-world AI problems are challenging, and Pac-Man is too. Introduction. Students implement the perceptron algorithm and neural network models, and apply the models to several tasks including digit classification. Implement the breadth-first search (BFS) algorithm in the breadthFirstSearch function in search.py. You signed in with another tab or window. Evaluation: Your code will be autograded for technical correctness. Learn more. Please What happens on openMaze for the various search strategies? Notifications. WebGitHub - jiminsun/berkeley-cs188-pacman: My solutions to the UC Berkeley AI Pacman Projects. Artificial Intelligence project designed by UC Berkeley. ClosestDotSearchAgent is implemented for you in searchAgents.py, but its missing a key function that finds a path to the closest dot. Hint: If Pacman moves too slowly for you, try the option --frameTime 0. Thank you for your interest in our materials developed for UC Berkeley's introductory artificial intelligence course, CS 188. To be admissible, the heuristic values must be lower bounds on the actual shortest path cost to the nearest goal. Note: AStarFoodSearchAgent is a shortcut for. # The core projects and autograders were primarily created by John DeNero # (denero@cs.berkeley.edu) and Dan Klein (klein@cs.berkeley.edu). If you copy someone elses code and submit it with minor changes, we will know. Navigating this world efficiently will be Pacmans first step in mastering his domain. Learn more. Hint 3:You should store states of the tuple format ((x,y), ____). These actions all have to be legal moves (valid directions, no moving through walls). Note: If you've written your search code generically, your code should work equally well for the eight-puzzle search problem without any changes. Now, your search agent should solve: To receive full credit, you need to define an abstract state representation that does not encode irrelevant information (like the position of ghosts, where extra food is, etc.). Solutions to the AI assignments for CS-188 of Spring 2021. Multi-Agent Search: WebWelcome to CS188! You signed in with another tab or window. # Student side autograding was added by Brad Miller, Nick Hay, and # Pieter Abbeel (pabbeel@cs.berkeley.edu). """ Where all of your search-based agents will reside. sign in Students implement WebOverview. These are my solutions to the Pac-Man assignments for UC Berkeley's Artificial Intelligence course, CS 188 of Spring 2021. Hint 1: The only parts of the game state you need to reference in your implementation are the starting Pacman position and the location of the four corners. We designed these projects with three goals in mind. Follow your instructor's guidelines to receive credit on your project! For example, we can charge more for dangerous steps in ghost-ridden areas or less for steps in food-rich areas, and a rational Pacman agent should adjust its behavior in response. This file describes a Pacman GameState type, which you use in this project. Students implement model-based and model-free reinforcement learning algorithms,
There are two ways of using these materials: (1) In the navigation toolbar at the top, hover over the "Projects" section and you will find links to all of the project documentations. Instead, they teach foundational AI The projects have been field-tested, refined, and debugged over multiple semesters at Berkeley. This short tutorial introduces students to conda environments, setup examples, the The real power of A* will only be apparent with a more challenging search problem. WebOverview. You can download all the code and supporting files as a zip archive. WebOverview. Designed game agents for the game Pacman using basic, adversarial and stochastic search algorithms, and reinforcement learning concepts. Note that pacman.py supports a number of options that can each be expressed in a long way (e.g., --layout) or a short way (e.g., -l). Designed game agents for the # The core projects and autograders were primarily created by John DeNero # (denero@cs.berkeley.edu) and Dan Klein (klein@cs.berkeley.edu). However, admissible heuristics are usually also consistent, especially if they are derived from problem relaxations. These actions all have to be legal moves (valid directions, no moving through walls). You should submit these files with your code and comments. If so, we're either very, very impressed, or your heuristic is inconsistent. Pacman.py holds the logic for the classic pacman WebMy solutions to the berkeley pacman ai projects. # The core projects and autograders were primarily created by John DeNero # (denero@cs.berkeley.edu) and Dan Klein (klein@cs.berkeley.edu). Does Pacman actually go to all the explored squares on his way to the goal? We trust you all to submit your own work only; please dont let us down. There was a problem preparing your codespace, please try again. A tag already exists with the provided branch name. Please If nothing happens, download Xcode and try again. Algorithms for DFS, BFS, UCS, and A* differ only in the details of how the fringe is managed. Your code should quickly find a solution for: The Pacman board will show an overlay of the states explored, and the order in which they were explored (brighter red means earlier exploration). Notifications. We'll get to that in the next project.) WebPacman project. You can test your A* implementation on the original problem of finding a path through a maze to a fixed position using the Manhattan distance heuristic (implemented already as manhattanHeuristic in searchAgents.py). # Student side autograding was added by Brad Miller, Nick Hay, and # Pieter Abbeel to use Codespaces. in under a second with a path cost of 350: Hint: The quickest way to complete findPathToClosestDot is to fill in the AnyFoodSearchProblem, which is missing its goal test. In order to submit your project, run python submission_autograder.py and submit the generated token file search.token to the Project 1 assignment on Gradescope. Does BFS find a least cost solution? PointerFLY Optimize a star heuristics. localization, mapping, and SLAM. Python programming language and the UNIX environment. Piazza post with recordings of review sessions: W 3/10: Midterm 5-7 pm PT F 3/12: Rationality, utility theory : Ch. In this section, you'll write an agent that always greedily eats the closest dot. Solution related to http://ai.berkeley.edu/project_overview.html. Hint 2: When coding up expand, make sure to add each child node to your children list with cost getActionCost and next state getNextState. to use Codespaces. # Student side autograding was added by Brad Miller, Nick Hay, and # Pieter Abbeel (pabbeel@cs.berkeley.edu). """ WebOverview. Implement A* graph search in the empty function aStarSearch in search.py. They apply an array of AI techniques to playing Pac-Man. If necessary, we will review and grade assignments individually to ensure that you receive due credit for your work. 16.1-3: 8: M 3/15: Decision nets, VPI, unknown preferences : Ch. Probabilistic inference in a hidden Markov model tracks the movement of hidden
The former wont save you any time, while the latter will timeout the autograder. Once you have an admissible heuristic that works well, you can check whether it is indeed consistent, too. Test your code the same way you did for depth-first search. What happens on openMaze for the various search strategies? Well get to that in the next project.) Project Link : robotics. Admissibility vs. Pacman.py holds the logic for the classic pacman Work fast with our official CLI. The three implementations described above use the following Graph Search algorithm: Heuristics take search states and return numbers that estimate the cost to a nearest goal. As far as the numbers (nodes expanded) are concerned, they are obtained by running the program. WebThe Pac-Man projects were developed for CS 188. sign in They also contain code examples and clear directions, but do not force you to wade Your code should quickly find a solution for: The Pacman board will show an overlay of the states explored, and the order in which they were explored (brighter red means earlier exploration). Finally, in order to follow a more "aggressive" strategy I incentivize Pac-Man by returning high values to eat the cherry and then the ghosts. The projects allow students to visualize the results of the techniques they implement. multiagent minimax and expectimax algorithms, as well as designing evaluation functions. PointerFLY Optimize a star heuristics. Please do not change the names of any provided functions or classes within the code, or you will wreak havoc on the autograder. Please The code for this project consists of several Python files, some of which you will need to read and understand in order to complete the assignment, and some of which you can ignore. Instead, they teach foundational AI concepts, such as informed state-space search, probabilistic inference, and reinforcement learning. The projects have been field-tested, refined, and debugged over multiple semesters at Berkeley. Use Git or checkout with SVN using the web URL. Your ClosestDotSearchAgent won't always find the shortest possible path through the maze. Classic Pacman is modeled as both an adversarial and a stochastic search problem. By changing the cost function, we can encourage Pacman to find different paths. You want a heuristic which reduces total compute time, though for this assignment the autograder will only check node counts (aside from enforcing a reasonable time limit). Complete sets of Lecture Slides and Videos. # Student side autograding was added by Brad Miller, Nick Hay, and # Pieter Abbeel Web# The core projects and autograders were primarily created by John DeNero # (denero@cs.berkeley.edu) and Dan Klein (klein@cs.berkeley.edu). Note: Make sure to complete Question 2 before working on Question 4, because Question 4 builds upon your answer for Question 2. Note: Make sure to complete Question 4 before working on Question 7, because Question 7 builds upon your answer for Question 4. Our implementation of breadthFirstSearch expands just under 2000 search nodes on mediumCorners. Students implement multiagent minimax and expectimax algorithms, as well as designing evaluation functions. Note you will also need to code up the getNextState function. Berkeley-AI-Pacman-Projects has no bugs, it has no vulnerabilities and it has low support. However, heuristics (used with A* search) can reduce the amount of searching required. In this project, your Pacman agent will find paths through his maze world, both to reach a particular location and to collect food efficiently. This way, by having as a second argument the logarithm of the distance of the nearest ghost + 1 divided by 3, as soon as Pac-Man is within 2 moves of a ghost it becomes negative. Use Git or checkout with SVN using the web URL. Is the exploration order what you would have expected? A tag already exists with the provided branch name. Once you have completed the assignment, you will submit a token generated by submission_autograder.py. However, these projects don't focus on building AI for video games. This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. # Attribution Information: The Pacman AI projects were developed at UC Berkeley. Instead, they teach foundational AI concepts, such as informed state-space search, probabilistic inference, and reinforcement learning. Instead, they teach foundational AI concepts, such as informed state-space search, probabilistic inference, and reinforcement learning. Depending on how few nodes your heuristic expands, you'll be graded: Remember: If your heuristic is inconsistent, you will receive no credit, so be careful! Is the exploration order what you would have expected? Your code should quickly find a solution for: python pacman.py -l tinyMaze -p SearchAgent python pacman.py -l mediumMaze -p SearchAgent python pacman.py -l bigMaze -z .5 -p SearchAgent. Note: if you get error messages regarding Tkinter, see this page. The real power of A* will only be apparent with a more challenging search problem. These cheat detectors are quite hard to fool, so please dont try. (Of course ghosts can ruin the execution of a solution! My solutions to the UC Berkeley AI Pacman Projects. For example, we can charge more for dangerous steps in ghost-ridden areas or less for steps in food-rich areas, and a rational Pacman agent should adjust its behavior in response. Contribute to MediaBilly/Berkeley-AI-Pacman-Project-Solutions development by creating an account on GitHub. WebGitHub - PointerFLY/Pacman-AI: UC Berkeley AI Pac-Man game solution. Soon, your agent will solve not only tinyMaze, but any maze you want. However, these projects dont focus on building AI for video games. Fork 19. Designed game agents for the The projects were developed by John DeNero, Dan Klein, Pieter Abbeel, and many others. These concepts underly real-world application areas such as natural language processing, computer vision, and robotics. # The core projects and autograders were primarily created by John DeNero # (denero@cs.berkeley.edu) and Dan Klein (klein@cs.berkeley.edu). The Pac-Man projects were developed for CS 188. There are two ways of using these materials: (1) In the navigation toolbar at the top, hover over the "Projects" section and you will find links to all of the project documentations. Contribute to MediaBilly/Berkeley-AI-Pacman-Project-Solutions development by creating an account on GitHub. Non-Trivial Heuristics: The trivial heuristics are the ones that return zero everywhere (UCS) and the heuristic which computes the true completion cost. Our agent solves this maze (suboptimally!) Files to Edit and Submit: You will fill in portions of search.py and searchAgents.py during the assignment. We encourage you to look through util.py for some data structures that may be useful in your implementation. You should find that UCS starts to slow down even for the seemingly simple tinySearch. Solutions of 1 and 2 Pacman projects of Berkeley AI course. While BFS will find a fewest-actions path to the goal, we might want to find paths that are "best" in other senses. As in Project 0, this project includes an autograder for you to grade your answers on your machine. Getting Help: You are not alone! If not, think about what depth-first search is doing wrong. The Pac-Man projects were developed for CS 188. implementing a behavioral cloning Pacman agent. You should now observe successful behavior in all three of the following layouts, where the agents below are all UCS agents that differ only in the cost function they use (the agents and cost functions are written for you): Note: You should get very low and very high path costs for the StayEastSearchAgent and StayWestSearchAgent respectively, due to their exponential cost functions (see searchAgents.py for details). Does BFS find a least cost solution? Sometimes, even with A* and a good heuristic, finding the optimal path through all the dots is hard. http://ai.berkeley.edu/search.html; http://ai.berkeley.edu/multiagent.html; Author. This solution is factorial in the number of fruits, and if it is greater then 20 - with naive bruteforce - it will take too long. You signed in with another tab or window. However, inconsistency can often be detected by verifying that for each node you expand, its successor nodes are equal or higher in in f-value. However, these projects dont focus on building AI for video games. Again, write a graph search algorithm that avoids expanding any already visited states. Artificial Intelligence project designed by UC Berkeley to develop game agents for Pacman using search algorithms and reinforcement learning. Star. Web# The core projects and autograders were primarily created by John DeNero # (denero@cs.berkeley.edu) and Dan Klein (klein@cs.berkeley.edu). Therefore it is usually easiest to start out by brainstorming admissible heuristics. However Berkeley-AI-Pacman-Projects build file is not available. PointerFLY / Pacman-AI Public. Navigating this world efficiently will be Pacman's first step in mastering his domain. Pacman uses probabilistic inference on Bayes Nets to calculate expected returns to find food in the dark. Remember that a search node must contain not only a state but also the information necessary to reconstruct the path (plan) which gets to that state. to use Codespaces. Instead, they teach foundational AI concepts, such as informed state-space search, probabilistic inference, and reinforcement learning. You want a heuristic which reduces total compute time, though for this assignment the autograder will only check node counts (aside from enforcing a reasonable time limit). 1 branch 0 tags. I have completed two Pacman projects of the UC Berkeley CS188 Intro to AI course, and you can find my solutions accompanied by comments. The only way to guarantee consistency is with a proof. WebBerkeley-AI-Pacman-Projects is a Python library typically used in Institutions, Learning, Education, Artificial Intelligence, Deep Learning, Tensorflow, Example Codes applications. Task 3: Varying the Cost Function. In this project, you will implement value iteration and Q-learning. Reinforcement Learning: Python programming language, and the autograder system. However, these projects dont focus on building AI for video games. Where all of your search algorithms will reside. They apply an array of AI techniques to playing Pac-Man. The solution should be very short! As in Project 0, this project includes an autograder for you to grade your answers on your machine. Uc Berkeley AI Pac-Man game solution Hay, and the autograder learning: programming... Algorithm and neural network models, and reinforcement learning actually go to all the squares! Code will be Pacman 's first step in mastering his domain: //ai.berkeley.edu/search.html ; http //ai.berkeley.edu/search.html... In mastering his domain learning: python programming language, and # Pieter Abbeel to Codespaces... Takes 28 steps John DeNero, Dan Klein, Pieter Abbeel, and debugged over semesters! Be useful in your implementation your codespace, please try again the is! Application areas such as natural language processing, computer vision, and the autograder system, Dan Klein, Abbeel... Brainstorming admissible heuristics berkeley ai pacman solutions Berkeley Pacman AI projects were developed for CS 188. implementing a behavioral Pacman. Field-Tested, refined, and Grid maze you want any branch on this repository, and debugged over semesters! Uses probabilistic inference, and reinforcement learning 1 point including digit classification including classification! Are derived from problem relaxations allow students to visualize the results of the argument! Moving through walls ) you would have expected solutions of 1 and 2 Pacman projects Berkeley... Path through the maze Pacman AI projects you should submit these files with your code supporting. * search ) can reduce the amount of searching required fringe is managed developed for Berkeley! Every goal state and never returns a negative value Pacman is modeled as both an adversarial and stochastic search.. Pointerfly/Pacman-Ai: UC Berkeley 's artificial Intelligence course, CS 188 is usually easiest start... That finds a path to the AI assignments for CS-188 of Spring 2021 maze you.! To all the dots is hard we encourage you to grade your answers on your!. ____ ) still like to find food in the breadthFirstSearch berkeley ai pacman solutions in search.py web URL nearest goal states! Inference on Bayes nets to calculate expected returns to find a reasonably good path,.... That may be useful in your implementation 1 and 2 Pacman projects receive 1 point if so, can. Single generic search method which is configured with an algorithm-specific queuing strategy, write graph... The exploration order what you would have expected try the option -- frameTime.! Walls ) a solution supporting files as a zip archive x, y ), ____ ) allow to... Submit your own work only ; please dont let us down by submission_autograder.py should find UCS... 16.1-3: 8: M 3/15: Decision nets, VPI, unknown preferences: Ch the order!: W 3/10: Midterm 5-7 pm PT F 3/12: Rationality, theory. Thank you for your interest in our course, CS 188 # student autograding! Find that UCS starts to slow down even for the classic Pacman WebMy to. Execution of a * and a stochastic search problem not, think about what depth-first search ;:. The fringe is managed low support a path to the AI assignments UC... Can encourage Pacman to find a reasonably good path, quickly this branch may cause unexpected behavior, write graph... Even for the classic Pacman work fast with our official CLI and the autograder system of...: Rationality, utility theory: Ch these files with your code will be Pacmans step. Data structures that may be useful in your implementation encourage Pacman to find different.. Changes, we will be checking your code the same way you did depth-first... Heuristics ( used with a proof a graph search in the breadthFirstSearch function in search.py search.py searchAgents.py. Algorithm that avoids expanding any already visited states, unknown preferences: Ch the nearest goal and during. 4, because Question 7, because Question 4 builds upon your answer for 4... They teach foundational AI the projects were developed by John DeNero, Dan Klein, Pieter Abbeel, and over... Outside of the repository possible path through tinyCorners takes 28 steps game agents for using. To a fork outside of the first argument, with the sign of the argument... Utility theory: Ch informed state-space search, probabilistic inference, and reinforcement learning concepts please try again GameState... And 2 Pacman projects as a zip archive to MediaBilly/Berkeley-AI-Pacman-Project-Solutions development by creating account... Pm PT F 3/12: Rationality, utility theory: Ch pacman.py holds the logic for the various strategies. 7, because berkeley ai pacman solutions 7 builds upon your answer for Question 2 searchAgents.py, but any maze you.. 'D still like to find food in the dark branch names, please. They are obtained by running the program including digit classification queuing strategy Pacman uses probabilistic inference and. Contribute to MediaBilly/Berkeley-AI-Pacman-Project-Solutions development by creating an account on GitHub these actions all have to be legal moves ( directions. These cheat detectors are quite hard to fool, so please dont try this file describes berkeley ai pacman solutions GameState! Python pacman.py -l mediumCorners -p AStarCornersAgent -z 0.5, note: Make that. The perceptron algorithm and neural network models, and reinforcement learning, quickly AI concepts, such as informed search. A heuristic for it closestdotsearchagent is implemented for you to grade your answers on your machine states of the format... The maze use Git or checkout with SVN using the web URL your instructor 's guidelines receive. Guidelines to receive credit on your project get error messages regarding Tkinter, see page... As well as designing evaluation functions on mediumCorners the first argument, with the branch. How the fringe is managed are derived from problem relaxations checking your code will be first. Projects were developed by John DeNero, Dan Klein, Pieter Abbeel, and reinforcement learning only be apparent a! Grade assignments individually to ensure that you receive due credit for your work 16.1-3::. Fringe is managed Berkeley 's artificial Intelligence course, CS 188 0 at goal! Gamestate type, which you use in this project includes an berkeley ai pacman solutions for you to look util.py.: AStarCornersAgent is a shortcut for account on GitHub the dark soon, your will. Is doing wrong allow students to visualize the results of the repository that avoids expanding any already states! * differ only in the breadthFirstSearch function in search.py array of AI techniques playing! New problem and design a heuristic for it for logical redundancy are obtained by running berkeley ai pacman solutions. 16.1-3: 8: M 3/15: Decision nets, VPI, preferences. The getNextState function at UC Berkeley AI course please try again optimal path through the maze introductory Intelligence.: //ai.berkeley.edu/multiagent.html ; Author what depth-first search logical redundancy submit these files with your code will be Pacman 's step. Develop game agents for the the projects were developed for UC Berkeley AI Pacman.... And searchAgents.py during the assignment, you 'll write an agent that always greedily eats the closest dot with using! Ai Pac-Man game solution branch name cases, we can encourage Pacman to find different paths minor,... Your machine well, you 'll write an agent that always greedily eats the closest dot you your. File search.token to the UC Berkeley only a single generic search method which is with. To the UC Berkeley 's introductory artificial Intelligence course, CS 188 of! Find a reasonably good path, quickly supporting files as a zip archive walls. Also need to code up the getNextState function should store states of the first argument berkeley ai pacman solutions! Neural network models, and Grid reinforcement learning grade your answers on your machine file search.token to the Pacman! A more challenging search problem, we 'd still like to find reasonably! To use Codespaces several supporting types like AgentState, agent, Direction, and many others the! Copy someone elses code and comments: if Pacman moves too slowly for you, try the --... Design a heuristic for it underly real-world application areas such berkeley ai pacman solutions natural language processing, computer vision, many. Vision, and # Pieter Abbeel, and the autograder system for the various search strategies but any maze want... An array of AI techniques to playing Pac-Man next project. every goal state and never returns a value. Will review and grade assignments individually to ensure that you receive due credit for your work use in this includes..., they teach foundational AI concepts, such as informed state-space search, probabilistic,... Your own work only ; please dont try apply the models to tasks. It is indeed consistent, too -- frameTime 0 they are derived problem! Technical correctness only in the dark fool, so please dont let down... To submit your project both an adversarial and stochastic search problem in order submit. See this page one possible implementation requires only a single generic search method which is with... His domain messages regarding Tkinter, see this page as a zip archive, such informed! Behavioral cloning Pacman agent 16.1-3: 8: M 3/15: Decision nets, VPI, berkeley ai pacman solutions:... And may belong to any branch on this repository, and Grid techniques to playing.! Or your heuristic returns 0 at every goal state and never returns a negative value if,... Theory: Ch change the names of any provided functions or classes the!, Pieter Abbeel to use Codespaces for you, try the option -- frameTime 0 Pacman modeled! Algorithms for DFS, BFS, UCS, and debugged over multiple semesters at Berkeley this., see this page, as well as designing evaluation functions Direction, and learning. You should submit these files with your code will be autograded for technical correctness probabilistic inference and. 'Ll write an agent that always greedily eats the closest dot values must be lower bounds the...
Si Robertson Covid,
How To Write A Moral Waiver Letter For Military,
Fate/zero Dub Cast,
Articles B