<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ioan Papuc</title>
    <description>The latest articles on DEV Community by Ioan Papuc (@ioanpapuc).</description>
    <link>https://dev.to/ioanpapuc</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1409588%2Fbd96f1bf-b5d0-416b-8c86-6de19aa9eb39.jpg</url>
      <title>DEV Community: Ioan Papuc</title>
      <link>https://dev.to/ioanpapuc</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ioanpapuc"/>
    <language>en</language>
    <item>
      <title>Movies Recommendation Software</title>
      <dc:creator>Ioan Papuc</dc:creator>
      <pubDate>Thu, 18 Jul 2024 19:26:07 +0000</pubDate>
      <link>https://dev.to/ioanpapuc/movies-recommendation-software-1fkd</link>
      <guid>https://dev.to/ioanpapuc/movies-recommendation-software-1fkd</guid>
      <description>&lt;p&gt;The program presented below is basically a recommendation tool that has the ability to suggest a group of films belonging to a genre chosen by the user. The link to the Github repository that contains the Python files with the complete source code is: &lt;a href="https://dev.tourl"&gt;https://github.com/IoanPapuc/recommendation_software.git&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjk2856y9q3ftv95mj7hf.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjk2856y9q3ftv95mj7hf.PNG" alt="Image description" width="660" height="513"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;First, being asked to enter the desired genre, the user has the possibility to type the entire word or just the first characters into the terminal. The categories that match the input will be displayed  and the user will be asked again to insert his choice from the available possibilities. This process will continue until a single option is printed and the user decides either on listing the recommended films from that variety or chose another genre.&lt;/p&gt;

&lt;h2&gt;
  
  
  Algoritms and Data Structures
&lt;/h2&gt;

&lt;p&gt;Regarding the Python code written for building the movie recommendation software, it is structured in three different files for an easier interaction: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;dataset.py&lt;/em&gt;, that stores the collection of movies, genres and the corresponding data,&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;algorithms.py&lt;/em&gt;, where algorithms and classes we need are defined, &lt;/li&gt;
&lt;li&gt;
&lt;em&gt;recommendation_software.py&lt;/em&gt;, that includes the main functions for running the software.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now let's mention the most important steps in the development of our program as well as briefly describe the problems, resources and methods that each one envolves.&lt;/p&gt;

&lt;p&gt;The first thing the software does is getting the desired genre from the user, hence a function is defined in &lt;em&gt;recommendation_software.py&lt;/em&gt; file for this purpose: &lt;code&gt;construct_user_choice(genres_list)&lt;/code&gt;, where  unsorted &lt;code&gt;genres_list = ['genre_a', 'genre_b', 'genre_c', 'genre_d', ... ]&lt;/code&gt; is located in &lt;em&gt;dataset.py&lt;/em&gt; file. Inside the function, the user is asked to enter a genre or just to type the beginning of that word into the terminal; afterwards, the program prints a list of possible options to choose from. In order to provide options that match input, a simple linear pattern search is performed:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def linear_search(genres_list, target):
    matches = []
    for item in genres_list:
        if target == item[0:len(target)]:
            matches.append(item)
    return matches
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Even if this process has a &lt;code&gt;O(len(genres_list))&lt;/code&gt; time complexity, the number of genres remains relatively small if we do not consider the subgenres, hence the computing cost will be low.&lt;/p&gt;

&lt;p&gt;Next, having a movie genre chosen by the user, a list of films belonging to that genre would be printed by the second function defined in &lt;em&gt;recommendation_software.py&lt;/em&gt;: &lt;code&gt;print_movies(genres_list, movies_collection)&lt;/code&gt;, where &lt;code&gt;movies_collection&lt;/code&gt; is the array of movie data which can be found in &lt;em&gt;dataset.py&lt;/em&gt; file. &lt;/p&gt;

&lt;p&gt;If we store the movies data as lists in movies_collection as below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;movies_collection = [[Movie_Title_1, genre_1, year_1, score_1],
                     [Movie_Title_2, genre_2, year_2, score_2],
                     [Movie_Title_3, genre_3, year_3, score_3],
                     ...
                    ]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;the program will iterate throughout the entire stock in order to gather all the movies corresponding to a specific type, in which case will generate a &lt;code&gt;O(len(movies_collection))&lt;/code&gt; time complexity. To avoid this situation, a &lt;code&gt;MoviesCollection&lt;/code&gt; HashMap class was created in &lt;em&gt;algorithms.py&lt;/em&gt; file. Therefore, printing the movies from a certain category will take &lt;code&gt;len(genres_list) + len(movies_of_certain_genre)&lt;/code&gt; in the worst case scenario when the computed hashcode for almost every key will lead to a collision.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Tic Tac Toe Terminal Game</title>
      <dc:creator>Ioan Papuc</dc:creator>
      <pubDate>Thu, 11 Apr 2024 20:25:11 +0000</pubDate>
      <link>https://dev.to/ioanpapuc/tic-tac-toe-terminal-game-4efp</link>
      <guid>https://dev.to/ioanpapuc/tic-tac-toe-terminal-game-4efp</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a Python Terminal Game that was part of a Portfolio Project for the Computer Science Codecademy course.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The source code can be found on Github using the following link:  &lt;code&gt;https://github.com/IoanPapuc/tic_tac_toe_terminal_game-.git&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fah2tyc1sqfjlds7z9bwv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fah2tyc1sqfjlds7z9bwv.png" alt="Image description" width="800" height="455"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Description and Functionalities
&lt;/h2&gt;

&lt;p&gt;The presented program, written in Python, generates a terminal version of the &lt;strong&gt;Tic Tac Toe&lt;/strong&gt; game, also known as &lt;strong&gt;Xs and Os&lt;/strong&gt;, which can be played by two users. &lt;/p&gt;

&lt;p&gt;The players are asked successively to input the location, consisting of row and column, where they want their specific character to be inserted. Every time a user enters a new symbol, the grid is updated and displayed into the terminal.&lt;/p&gt;

&lt;p&gt;Errors generated by the introduction of non-valid inputs are identified and treated accordingly: the user is asked to re-enter a row and a column if the entered values are integers different from 1, 2 or 3 or if the respective location has been previously filled. The same thing happens if non-integer data types are entered instead of a row or column. The only exception to the last rule is made for the character 'Q' which can be entered by any player to quit the current game.&lt;/p&gt;

&lt;p&gt;The game ends when a player first satisfies one of the three winning conditions, when a draw is reached or when one of the player uses the 'Q' option.&lt;/p&gt;

&lt;p&gt;Users have the possibility to play multiple games in a row without running the source code from the file each time, due to a menu-managed game framework that has been set. The menu provides two options: 'S' to start a game and 'E' to exit the program.&lt;/p&gt;

&lt;h2&gt;
  
  
  Short Overview of the functions
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;u&gt;new_board()&lt;/u&gt; - creates a new empty grid&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;u&gt;print_board()&lt;/u&gt; - displays the grid in a suitable manner&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;u&gt;insert_symbol(board, symbol)&lt;/u&gt; - asks the users to input the row and column of their own character and updates the grid accordingly before printing it; also checks and ensures the accuracy in data entry &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;u&gt;full_row(board, symbol)&lt;/u&gt;, &lt;u&gt;full_column(board, symbol)&lt;/u&gt;, &lt;u&gt;full_diag(board, symbol)&lt;/u&gt; - return 'True' if a sequence of three identical symbols are placed in a row, column or diagonal&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;u&gt;winning_verification(board, symbol)&lt;/u&gt; - returns 'True' if one of the three winning criteria from above is satisfied&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;u&gt;play_game()&lt;/u&gt; - the main function in the program; includes all of the previously mentioned function and establishes the conditions for stopping the game&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;u&gt;game_menu()&lt;/u&gt; - very simple menu-driven interface created to make multi-game sessions easier to play&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Obviously, this is just a basic version of the classic Tic Tac Toe game. It can be improved and completed in countless ways such that, with enough imagination, can lead to a sufficiently complex and challenging game.&lt;/p&gt;

</description>
      <category>python</category>
      <category>terminal</category>
      <category>beginners</category>
      <category>learning</category>
    </item>
  </channel>
</rss>
