Skip to content

Foundations of Computer Science Competition built based on Laravel 5

Notifications You must be signed in to change notification settings

kevinlinxp/fcsc

Repository files navigation

fcsc

Bulls and Cows Game built based on Laravel 5, as a competition for the students enrolling course "Foundations of Computer Science" in the University of Adelaide.

Live site: http://159.203.247.157/
Live test account: a1203212

Installation on a fresh Ubuntu 14.04 server:

Install sqlite, php and git:
sudo apt-get install sqlite3
sudo apt-get install php5
sudo apt-get install php5-sqlite
sudo apt-get install git
Install composer:
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
Install Laravel using composer:
composer global require "laravel/installer=~1.1"
Clone this project from git and install dependencies:
git clone https://github.com/cqqlin/fcsc
cd fcsc
composer install
Prepare database seeder:
vi database/seeds/StudentTableSeeder.php

Paste the following php script to the editor, and modify the data as needed:

<?php

use Illuminate\Database\Seeder;

class StudentTableSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        $students = [
            ["id" => "id_001", "firstName" => "Louie", "lastName" => "Qin"],
            ["id" => "id_002", "firstName" => "Keith", "lastName" => "Lin"],
            ["id" => "id_003", "firstName" => "Minming", "lastName" => "Qian"],
        ];

        foreach ($students as $student) {
            DB::table('students')->insert([
                'id' => $student['id'],
                'firstName' => $student['firstName'],
                'lastName' => $student['lastName'],
                'lastPlayed' => \Carbon\Carbon::createFromFormat('Y-m-d H:i:s', '1970-01-01 00:00:00'),
                'highestMark' => 0,
                'recordDate' => \Carbon\Carbon::createFromFormat('Y-m-d H:i:s', '1970-01-01 00:00:00')
            ]);
        }
    }
}
Prepare the .env file:
vi .env

Paste the following text to the editor, and modify the configiration as needed (For example, to disable the debug mode, which will show the secret number as you guess, please change to "APP_DEBUG=false". Apart from that, you also need to change END_DATE according to your needs.):

APP_ENV=local
APP_DEBUG=true
APP_KEY=ffvR5FcYprwdZaHsMc4RMQASgzDLSBfF

CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync

MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null

END_DATE=2018-10-18 13:30:00
DEDUCT_ROUND_POINT_INTERVAL=45
Set-up database:
touch storage/database.sqlite
composer dump-autoload
php artisan migrate:refresh --seed
Set-up encripted key:
php artisan key:generate
Start the service:

To test on a local machine:

php -S localhost:8888 -t public

Or to run the service on a server and open to public:

php -S your.ip.address:port -t public &

Or something like:

php -S 129.127.10.84:80 -t public &
Visit the site via:

http://localhost:8888

or

http://your.ip.address:port

or

http://129.127.10.84

You can then login and start a game using a user id (id_001, id_002, id_003 in the case of this instruction) according to your StudentTableSeeder.php file.

About

Foundations of Computer Science Competition built based on Laravel 5

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published