Coder Social home page Coder Social logo

qarthak / a4-tictactoe-android Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 766 KB

TicTacToe game developed in Android Studio, mostly using Java. Allows register using Firebase Auth, sign-in and out, and single and multiplayer mode

License: MIT License

Java 100.00%
android androidstudi firebase-auth firebase recyclerview navigation-component viewmodel

a4-tictactoe-android's Introduction

Tic Tac Toe

Name of the project: Tic Tac Toe

Name: Sarthak Chaudhary

Email: [email protected]

Description:

The app allows a person to sign in and play tic-tac-toe. His password will be remembered on FirebaseAuth and is not visible to the developer under the current settings.

UPDATE: I confirmed that the passwords are all encrypted so one of the warnings below is not needed. Still leaving it there as proof of work

1638901524781.png1638901550561.png1638901566190.png1638901610578.png

Bugs:

[FIXED] Clicking on log out closes the app as there is an error with the navigation. If I simply remove the navigation code the user is signed out but the app remains in the dashboard. Although I would fix this in the future, the app closing on logging out can be thought of a feature.

Task Description

Task 1

The register feature does store emails and password on the backend but the sign in feature is not yet implemented, at least not on the same button. Having two buttons would've made it much easier as I do have the sign in code(commented after the register code) but the only way to tell if it's sign in or register is through the app crashing The app can run offline as firebase apps automatically handle temporary network interruptions. Cached data is available while offline and Firebase resends any writes when network connectivity is restored.

Code taken from:

https://stackoverflow.com/questions/40093781/check-if-given-email-exists

https://www.youtube.com/watch?v=d88BPU4Daso

https://www.examplefiles.net/cs/1026361

https://firebase.google.com/docs/auth/android/password-auth?authuser=0

Floating Button and log out also works, along with the log out and exit feature. The dashboard doesn't work

The game works perfectly well in both layouts with persistance

Task 2

I made a separate TicTacToeBoard class to implement the game logic along with the AI Logic. I initially started with the idea of creating a Monte Carlo Search Tree(MCTS) Algo to play TicTacToe but I have the implementation in python and porting is hard. The TicTacToeBoard has a robust API with methods like getBoardState and whoWon and isGameOver which are all self explanatory.

The game works flawlessly(I've tested it too many times, even using monkey) and I have implemented a viewModel to hold the game state so it persists through configuration changes. There is also a popup which shows the number of turns since the game started once it ends and it also shows whether the game was a draw or a win or a tie. Navigation here is implemented well as the user is taken back to the dashboard once the game ends.

The forfeit dialog button is also implemented well. The lack of dashboard means that certain features are not there though.

Dependancies:

I've used Firebase and Firebase Auth and everything else is standard. Android studio will install these while synching the gradle files

Time taken and difficulty

It took me 18 hours Difficulty: 8/10

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.