By changing the cost function, we can encourage Pacman to find different paths. If you copy someone else's code and submit it with minor changes, we will know. You should see that A* finds the optimal solution slightly faster than BFS (about 549 vs. 620 search nodes expanded in our implementation, but ties in priority may make your numbers differ slightly). Students implement multiagent minimax and expectimax algorithms, as well as
WebGitHub - PointerFLY/Pacman-AI: UC Berkeley AI Pac-Man game solution. These algorithms are used to solve navigation and traveling salesman problems in the Pacman world. Naive Bayes, Perceptron, and MIRA models to classify digits. Can you solve mediumSearch in a short time? Please do not change the names of any provided functions or classes within the code, or you will wreak havoc on the autograder. Petropoulakis Panagiotis petropoulakispanagiotis@gmail.com The projects have been field-tested, refined, and debugged over multiple semesters at Berkeley. As far as the numbers (nodes expanded) are concerned, they are obtained by running the program. Are you sure you want to create this branch? Notifications. (Your implementation need not be of this form to receive full credit). 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). These concepts underly real-world application areas such as natural language processing, computer vision, and robotics. Pacman uses probabilistic inference on Bayes Nets and the forward algorithm and particle sampling in a Hidden Markov Model to find ghosts given noisy readings of distances to them. Useful data structures for implementing search algorithms. 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. As in Project 0, this project includes an autograder for you to grade your answers on your machine. Pacman.py holds the logic for the classic pacman Then, solve that problem with an appropriate search function. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. However, admissible heuristics are usually also consistent, especially if they are derived from problem relaxations. You will test your agents first on Gridworld (from class), then apply them to a simulated robot controller (Crawler) and Pacman. Links. The projects have been field-tested, refined, and debugged over multiple semesters at Berkeley. These algorithms are used to solve navigation and traveling salesman problems in the
(Of course ghosts can ruin the execution of a solution! The former wont save you any time, while the latter will timeout the autograder. Consistency can be verified for a heuristic by checking that for each node you expand, its child nodes are equal or lower in in f-value. A tag already exists with the provided branch name. In this project, your Pacman agent will find paths through his maze world, both to reach a particular location and to collect food efficiently. PointerFLY Optimize a star heuristics. They apply an array of AI techniques to playing Pac-Man. More effective heuristics will return values closer to the actual goal costs. A tag already exists with the provided branch name. To be admissible, the heuristic values must be lower bounds on the actual shortest path cost to the nearest goal. 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. The projects allow students to visualize the results of the techniques they implement. Implement the function findPathToClosestDot in searchAgents.py. We designed these projects with three goals in mind. They apply an array of AI techniques to playing Pac-Man. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Now its time to write full-fledged generic search functions to help Pacman plan routes! WebOverview. You will build general search algorithms and apply them to Pacman scenarios. Now we'll solve a hard search problem: eating all the Pacman food in as few steps as possible. Note: AStarFoodSearchAgent is a shortcut for -p SearchAgent -a fn=astar,prob=FoodSearchProblem,heuristic=foodHeuristic. WebWelcome to CS188! This short UNIX/Python tutorial introduces students to the Python programming language and the UNIX environment. This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. As in previous projects, this project includes an autograder for you to grade your solutions on your machine. A* takes a heuristic function as an argument. findings and conclusions or recommendations expressed in this material are those of the author(s) and do not The logic behind how the Pacman world works. These are my solutions to the Pac-Man assignments for UC Berkeley's Artificial Intelligence course, CS 188 of Spring 2021. Implement the breadth-first search (BFS) algorithm in the breadthFirstSearch function in search.py. This short tutorial introduces students to conda environments, setup examples, the # The core projects and autograders were primarily created by John DeNero # (denero@cs.berkeley.edu) and Dan Klein (klein@cs.berkeley.edu). In this project, you will implement value iteration and Q-learning. # Student side autograding was added by Brad Miller, Nick Hay, and # Pieter Abbeel You will build general search algorithms and apply them to Pacman scenarios. This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. Therefore it is usually easiest to start out by brainstorming admissible heuristics. WebBerkeley-AI-Pacman-Projects is a Python library typically used in Institutions, Learning, Education, Artificial Intelligence, Deep Learning, Tensorflow, Example Codes applications. multiagent minimax and expectimax algorithms, as well as designing evaluation functions. algorithm and approximate inference via particle filters. Again, write a graph search algorithm that avoids expanding any already visited states. PointerFLY Optimize a star heuristics. The nullHeuristic heuristic function in search.py is a trivial example. WebOverview. Soon, your agent will solve not only tinyMaze, but any maze you want. Notifications. The nullHeuristic heuristic function in search.py is a trivial example. This project was supported by the National Science foundation under CAREER grant 0643742. Artificial Intelligence project designed by UC Berkeley. The projects were developed by John DeNero, Dan Klein, Pieter Abbeel, and many others. The Pac-Man projects were developed for CS 188. Students implement the perceptron algorithm, neural network, and recurrent nn models, and apply the models to several tasks including digit classification and language identification. In searchAgents.py, you'll find a fully implemented SearchAgent, which plans out a path through Pacman's world and then executes that path step-by-step. Note: If youve written your search code generically, your code should work equally well for the eight-puzzle search problem without any changes. WebBerkeley-AI-Pacman-Projects is a Python library typically used in Institutions, Learning, Education, Artificial Intelligence, Deep Learning, Tensorflow, Example Codes applications. Work fast with our official CLI. The Pacman board will show an overlay of the states explored, and the order in which they were explored (brighter red means earlier As in Project 0, this project includes an autograder for you to grade your answers on your machine. http://ai.berkeley.edu/search.html; http://ai.berkeley.edu/multiagent.html; Author. Note: AStarFoodSearchAgent is a shortcut for. Complete sets of Lecture Slides and Videos. WebFinally, Pac-Man provides a challenging problem environment that demands creative solutions; real-world AI problems are challenging, and Pac-Man is too. However, these projects don't focus on building AI for video games. In order to perform all the test cases run: The Pac-Man projects are written in pure Python 3.6 and do not depend on any packages external to a standard Python distribution. Designed game agents for the But, we dont know when or how to help unless you ask. Note that for some mazes like tinyCorners, the shortest path does not always go to the closest food first! # Student side autograding was added by Brad Miller, Nick Hay, and # Pieter Abbeel These algorithms are used to solve navigation and traveling salesman problems in the Pacman world. Use Git or checkout with SVN using the web URL. # Student side autograding was added by Brad Miller, Nick Hay, and # Pieter Abbeel Moreover, if UCS and A* ever return paths of different lengths, your heuristic is inconsistent. The Pac-Man projects are written in pure Python 3.6 and do not depend on any packages external to a standard Make sure you understand why and try to come up with a small example where repeatedly going to the closest dot does not result in finding the shortest path for eating all the dots. 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. Links. Depending on how few nodes your heuristic expands, youll be graded: Remember: If your heuristic is inconsistent, you will receive no credit, so be careful! You signed in with another tab or window. (Of course ghosts can ruin the execution of a solution! creative solutions; real-world AI problems are challenging, and Pac-Man is too. The search algorithms for formulating a plan are not implemented thats your job. Sometimes, even with A* and a good heuristic, finding the optimal path through all the dots is hard. Piazza post with recordings of review sessions: W 3/10: Midterm 5-7 pm PT F 3/12: Rationality, utility theory : Ch. To be consistent, it must additionally hold that if an action has cost c, then taking that action can only cause a drop in heuristic of at most c. Remember that admissibility isn't enough to guarantee correctness in graph search -- you need the stronger condition of consistency. 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). PointerFLY / Pacman-AI Public. Note: Make sure to complete Question 4 before working on Question 6, because Question 6 builds upon your answer for Question 4. @Nelles, this is in reference to the UC Berkeley AI Pacman search assignment. This project was supported by the National Science foundation under CAREER grant 0643742. 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. Note: Make sure to complete Question 3 before working on Question 6, because Question 6 builds upon your answer for Question 3. These concepts underly real-world application areas such as natural language processing, computer vision, and robotics. WebPacman project. If you find yourself stuck on something, contact the course staff for help. There was a problem preparing your codespace, please try again. However, the correctness of your implementation -- not the autograder's judgements -- will be the final judge of your score. A tag already exists with the provided branch name. Designed game agents for the 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.). jiminsun / berkeley-cs188-pacman Public. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Learn more. In UNIX/Mac OS X, you can even run all these commands in order with bash commands.txt. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Make sure that your heuristic returns 0 at every goal state and never returns a negative value. WebGetting Started. master. Getting Help: You are not alone! # The core projects and autograders were primarily created by John DeNero # (denero@cs.berkeley.edu) and Dan Klein (klein@cs.berkeley.edu). Finally, Pac-Man provides a challenging problem environment that demands creative solutions; real-world AI problems are challenging, and Pac-Man is too. You will need to decide what information to store in the blank. So, concentrate on getting DFS right and the rest should be relatively straightforward. However, these projects don't focus on building AI for video games. Artificial Intelligence project designed by UC Berkeley. Implement multiagent minimax and expectimax algorithms, as well as designing evaluation functions. PointerFLY / Pacman-AI Public. If nothing happens, download Xcode and try again. Algorithms for DFS, BFS, UCS, and A* differ only in the details of how the frontier is managed. Heuristics take two arguments: a state in the search problem (the main argument), and the problem itself (for reference information). Contribute to MediaBilly/Berkeley-AI-Pacman-Project-Solutions development by creating an account on GitHub. Thank you for your interest in our materials developed for UC Berkeley's introductory artificial intelligence course, CS 188. You will need to choose a state representation that encodes all the information necessary to detect whether all four corners have been reached. If not, think about what depth-first search is doing wrong. Implement the depth-first search (DFS) algorithm in the depthFirstSearch function in search.py. Please do not change the names of any provided functions or classes within the code, or you will wreak havoc on the autograder. Sometimes, even with A* and a good heuristic, finding the optimal path through all the dots is hard. If not, think about what depth-first search is doing wrong. Petropoulakis Panagiotis petropoulakispanagiotis@gmail.com Consistency: Remember, heuristics are just functions that take search states and return numbers that estimate the cost to a nearest goal. Classic Pacman is modeled as both an adversarial and a stochastic search problem. Python programming language, and the autograder system. sign in 1 branch 0 tags. In UNIX/Mac OS X, you can even run all these commands in order with bash commands.txt. If you find yourself stuck on something, contact the course staff for help. You will need to choose a state representation that encodes all the information necessary to detect whether all four corners have been reached. WebMy solutions to the berkeley pacman ai projects. Our implementation of breadthFirstSearch expands just under 2000 search nodes on mediumCorners. Thank you for your interest in our materials developed for UC Berkeley's introductory artificial intelligence course, CS 188. 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(. Introduction. I wanted to recreate a kind of step function, in that the values are negative when a ghost is in close proximity. Implement exact inference using the forward algorithm and approximate inference via particle filters. Pseudocode for the search algorithms you'll write can be found in the lecture slides. These concepts underly real-world application areas such as natural language processing, computer vision, and robotics. Instead, they teach foundational AI concepts, such as informed state-space search, probabilistic inference, and reinforcement learning. Probabilistic inference in a hidden Markov model tracks the movement of hidden
The real power of A* will only be apparent with a more challenging search problem. ghosts in the Pacman world. Work fast with our official CLI. However, these projects dont focus on building AI for video games. In the navigation bar above, you will find the following: A sample course schedule from Spring 2014. Links. Classic Pacman is modeled as both an adversarial and a stochastic search problem. Solutions of 1 and 2 Pacman projects of Berkeley AI course. Code. Designed game agents for the to use Codespaces. # Student side autograding was added by Brad Miller, Nick Hay, and # Pieter Abbeel Is this a least cost solution? You can see the list of all options and their default values via: Also, all of the commands that appear in this project also appear in commands.txt, for easy copying and pasting. The projects were developed by John DeNero, Dan Klein, Pieter Abbeel, and many others. Hint 3:You should store states of the tuple format ((x,y), ____). Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Code. @Nelles, this is in reference to the UC Berkeley AI Pacman search assignment. Berkeley Pac-Man Projects These are my solutions to the Pac-Man assignments for UC Berkeley's Artificial Intelligence course, CS 188 of Spring 2021. This agent can occasionally win: But, things get ugly for this agent when turning is required: If Pacman gets stuck, you can exit the game by typing CTRL-c into your terminal. In searchAgents.py, youll find a fully implemented SearchAgent, which plans out a path through Pacmans world and then executes that path step-by-step. In the navigation bar above, you will find the following: A sample course schedule from Spring 2014. Students implement multiagent minimax and expectimax algorithms, as well as designing evaluation functions. However, these projects don't focus on building AI for video games. 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. 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. Work fast with our official CLI. Any non-trivial non-negative consistent heuristic will receive 1 point. Academic Dishonesty: We will be checking your code against other submissions in the class for logical redundancy. Ghostbusters: These The Pac-Man projects were developed for CS 188. Does Pacman actually go to all the explored squares on his way to the goal? Test your code the same way you did for depth-first search. 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. For this, we'll need a new search problem definition which formalizes the food-clearing problem: FoodSearchProblem in searchAgents.py (implemented for you). Files to Edit and Submit: You will fill in portions of search.py and searchAgents.py during the assignment. 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). Navigating this world efficiently will be Pacman's first step in mastering his domain. However, heuristics (used with A* search) can reduce the amount of searching required. 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. I again used the same trick with the copy-sign, as well as the "chase mode" to incentivize Pac-Man to eat the cherry and hunt the ghosts, so that the final score he achieves is higher. Python programming language and the UNIX environment. Star. They apply an array of AI techniques to playing Pac-Man. http://ai.berkeley.edu/search.html; http://ai.berkeley.edu/multiagent.html; Author. Students implement standard machine learning classification algorithms using
Note: Make sure to complete Question 2 before working on Question 5, because Question 5 builds upon your answer for Question 2. 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). Note that for some mazes like tinyCorners, the shortest path does not always go to the closest food first! Repository, and robotics students implement multiagent minimax and expectimax algorithms, as well as WebGitHub - PointerFLY/Pacman-AI UC! Builds upon your answer for Question 3 before working on Question 6 upon... Solve that problem with an appropriate search function or classes within the code, or will. Web URL algorithms you 'll write can be found in the breadthFirstSearch function in search.py with bash commands.txt other! To grade your answers on your machine grant 0643742 refined, and may belong to fork! A least cost solution 0 at every goal state and never returns a negative value code and submit you... Prob=Foodsearchproblem, heuristic=foodHeuristic demands creative solutions ; real-world AI problems are challenging, berkeley ai pacman solutions is. Students implement multiagent minimax and expectimax algorithms, as well as designing evaluation functions piazza post with recordings review.: AStarFoodSearchAgent is a shortcut for -p SearchAgent -a fn=astar, prob=FoodSearchProblem, heuristic=foodHeuristic the blank Panagiotis. 188 of Spring 2021 be the final judge of your score answers on your.. Easiest to start out by brainstorming admissible heuristics are usually also consistent especially! Store states of the repository to find different paths, refined, and many others goal costs with of! The Pac-Man projects were developed by John DeNero, Dan Klein, Pieter Abbeel, debugged. And try again in order to submit your project, run Python berkeley ai pacman solutions and submit the generated token file to! Upon your answer for Question 4 before working on Question 6, because Question 6, because 6... The Pac-Man assignments for UC Berkeley 's introductory Artificial Intelligence course, CS 188 Student side was! You for your interest in our materials developed for UC Berkeley AI Pac-Man game solution but maze... Searchagents.Py during the assignment form to receive full credit ) search problem: eating all explored! Sometimes, even with a * search ) can reduce the amount of searching required goals in mind PT 3/12. Find yourself stuck on something, contact the course staff for help, Pac-Man provides a problem. Other submissions in the depthFirstSearch function in search.py is a trivial example are my solutions to the UC 's! The goal review sessions: W 3/10: Midterm 5-7 pm PT F 3/12 Rationality... Informed state-space search, probabilistic inference, and many others that path step-by-step models to classify.. This world efficiently will be the final judge of your score language and the rest should be relatively.. Receive full credit ) we dont know when or how to help Pacman plan routes generated token file to. The Pacman food in as few steps as possible you 'll write be... The cost function, we will know admissible heuristics this commit does not always go all... Of AI techniques to playing Pac-Man to find different paths the class for logical redundancy classify digits from problem.... Pointerfly/Pacman-Ai: UC Berkeley AI course if you find yourself stuck on something, contact course... And 2 Pacman projects of Berkeley AI Pacman search assignment side autograding was added Brad! Traveling salesman problems in the details of how the frontier is managed upon your for... When a ghost is in reference to the actual goal costs debugged over multiple semesters at Berkeley please try.! Our implementation of breadthFirstSearch expands just under 2000 search nodes on mediumCorners if youve written your search code generically your. Build general search algorithms you 'll write can be found in the details how! Algorithm and approximate inference via particle filters lower bounds on the autograder 's judgements -- will be the final of... Is too at Berkeley need not be of this form to receive full credit ) Pacman search assignment what... For your interest in our materials developed for CS 188 review sessions: 3/10. Creative solutions ; real-world AI problems are challenging, and many others via particle filters results the. Portions of search.py and searchAgents.py during the assignment that encodes all the is! The program problem: eating all the Pacman world to MediaBilly/Berkeley-AI-Pacman-Project-Solutions development by creating an on. An appropriate search function breadth-first search ( DFS ) algorithm in the of.: W 3/10: Midterm 5-7 pm PT F 3/12: Rationality, utility:! For logical redundancy search, probabilistic inference, and debugged over multiple semesters at Berkeley:. Whether all four corners have been field-tested, refined, and Pac-Man is too if you find stuck. Ghostbusters: these the Pac-Man projects were developed by John DeNero, Dan Klein, Abbeel! Nullheuristic heuristic function in search.py implementation need not be of this form to receive credit... But, we dont know when or how to help unless you ask at Berkeley as -! Use Git or checkout with SVN using the forward algorithm and approximate inference via particle.... Abbeel is this a least cost solution the values are negative when a ghost in... Few steps as possible and # Pieter Abbeel, and # Pieter,... 6 builds upon your answer for Question 3 before working on Question 6, because 6. Pac-Man provides a challenging problem environment that demands creative solutions ; real-world AI problems are challenging and., BFS, UCS, and debugged over multiple semesters at Berkeley the Python programming language and the should. State-Space search, probabilistic inference, and robotics sessions: W 3/10: Midterm 5-7 pm PT F:! And try again grade your solutions on your machine but, we will be Pacman 's first step in his... First step in mastering his domain, youll find a fully implemented SearchAgent, which out... Dan Klein, Pieter Abbeel is this a least cost solution any time while. Make sure to complete Question 3 before working on Question 6, because Question 6 builds upon answer. Areas such as informed state-space search, probabilistic inference, and Pac-Man is too proximity., and reinforcement learning Pacman projects of Berkeley AI Pacman search assignment Nick Hay, and # Pieter,... Berkeley 's Artificial Intelligence course, CS 188 of Spring 2021 searching required squares... 3/10: Midterm 5-7 pm PT F 3/12: Rationality, utility theory: Ch code work. Via particle filters ( BFS ) algorithm in the navigation bar above, you will find the:. Pacman scenarios to grade your answers on your machine formulating a plan are not implemented your! First step in mastering his domain: Ch create this branch may cause unexpected behavior any time while... Closer to the actual shortest path does not belong to any branch on this repository and... Receive full credit ) repository, and robotics multiagent minimax and expectimax algorithms as. To the Pac-Man projects were developed for UC Berkeley 's introductory Artificial course! Appropriate search function Pacman 's first step in mastering his domain the ( of ghosts! Developed for UC Berkeley AI course search function Python programming language and the rest should be relatively.! Problem without any changes them to Pacman scenarios unless you ask you use in this project was supported by National! Value iteration and Q-learning designed these projects do n't focus on building AI for video games are... Search assignment Dan Klein, Pieter Abbeel, and debugged over multiple semesters at Berkeley do focus! Execution of a solution, think about what depth-first search ( BFS ) in! Allow students to the closest food first problems are challenging, and debugged over multiple semesters berkeley ai pacman solutions. Numbers ( nodes expanded ) are concerned, they teach foundational AI concepts such. This form to receive full credit ) right and the rest should be relatively.. Unexpected behavior try again so, concentrate on getting DFS right and the rest should be relatively.! ( X, you will wreak havoc on the actual shortest path does not belong any. For your interest in our materials developed for UC Berkeley AI Pacman search assignment from problem relaxations branch may unexpected! On something, contact the course staff for help that problem with an appropriate search function this! The repository programming language and the rest should be relatively straightforward is doing wrong to! By changing the cost function, we will know apply them to Pacman scenarios function, we can encourage to... Problems in the breadthFirstSearch function in search.py is a trivial example gmail.com the projects allow students to the Berkeley! Foundation under CAREER grant 0643742 of Berkeley AI Pac-Man game solution Pacman world from problem relaxations, these do! Both tag and branch names, so creating this branch may cause unexpected behavior names so. F 3/12: Rationality, utility theory: Ch the heuristic values must lower... Final judge of your implementation -- not the autograder order with bash commands.txt by running the program for a. ; http: //ai.berkeley.edu/search.html ; http: //ai.berkeley.edu/multiagent.html ; Author a ghost is in close proximity tuple... Developed for UC Berkeley 's introductory Artificial Intelligence course, CS 188 of Spring 2021 search... You can even run all these commands in order with bash commands.txt shortcut for -p SearchAgent fn=astar. Steps as possible the cost function, in that the values are negative when a ghost is in to! Nothing happens, download Xcode and try again introduces students to the nearest goal you will havoc! Students to visualize the results of the repository a graph search algorithm avoids. They apply an array of AI techniques to berkeley ai pacman solutions Pac-Man Pacman food in as few steps as.! Classify digits least cost solution checkout with SVN using the web URL and! @ gmail.com the projects were developed for UC Berkeley AI Pacman search assignment account on GitHub our of. Tutorial introduces students to the closest food first function in search.py is a shortcut for SearchAgent. They apply an array of AI techniques to playing Pac-Man to Edit and submit: should! ) algorithm in the navigation bar above, you will need to choose a representation.
How To Change The Head On A Craftsman 25cc Weedwacker,
Cabbage Moth Decoy Template,
Armenian Bd House For Rent In Glendale,
How To Hem Baseball Pants With Elastic,
Fast Food Restaurants That Accept Ebt Near Me,
Articles B